]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Pass SignMode to MSBuild
authorOwen Smith <owen.smith@citrix.com>
Fri, 18 Nov 2022 10:06:10 +0000 (10:06 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Wed, 30 Nov 2022 15:29:37 +0000 (15:29 +0000)
Allows overriding of SignMode to "Off" to prevent signing binaries with the PFX
file. This is useful if wrapper builds sign binaries with alternative signatures
or when signing is not required.

Signed-off-by: Owen Smith <owen.smith@citrix.com>
Small whitespace fix.

Signed-off-by: Paul Durrant <paul@xen.org>
build.ps1
msbuild.ps1
vs2019/package/package.vcxproj
vs2022/package/package.vcxproj

index 88d57a67489d84dcf00e94928d343be7f73305fa..08b9715ce95f9109ae1ea3a9dec32f730a7fc0c0 100644 (file)
--- a/build.ps1
+++ b/build.ps1
@@ -6,6 +6,7 @@ param(
        [Parameter(Mandatory = $true)]
        [string]$Type,
        [string]$Arch,
+       [string]$SignMode = "TestSign",
        [switch]$CodeQL,
        [switch]$Sdv
 )
@@ -28,7 +29,8 @@ Function Build {
                SolutionDir = $solutiondir[$visualstudioversion];
                ConfigurationBase = $configurationbase[$visualstudioversion];
                Arch = $Arch;
-               Type = $Type
+               Type = $Type;
+               SignMode = $SignMode
                }
        & ".\msbuild.ps1" @params
        if ($LASTEXITCODE -ne 0) {
@@ -47,7 +49,8 @@ Function SdvBuild {
                SolutionDir = $solutiondir[$visualstudioversion];
                ConfigurationBase = $configurationbase[$visualstudioversion];
                Arch = $arch;
-               Type = "sdv"
+               Type = "sdv";
+               SignMode = $SignMode
                }
        & ".\msbuild.ps1" @params
 }
@@ -62,7 +65,8 @@ function CodeQLBuild {
                SolutionDir = $solutiondir[$visualstudioversion];
                ConfigurationBase = $configurationbase[$visualstudioversion];
                Arch = $arch;
-               Type = "codeql"
+               Type = "codeql";
+               SignMode = $SignMode
                }
        & ".\msbuild.ps1" @params
 }
index 846abd290df6843316ec45c1bf6ed538b5c59cec..1ec8508a02f9918cf9c6c763cd0395f1b8fdbbc8 100644 (file)
@@ -7,7 +7,8 @@ param(
        [Parameter(Mandatory = $true)]
        [string]$Arch,
        [Parameter(Mandatory = $true)]
-       [string]$Type
+       [string]$Type,
+       [string]$SignMode = "TestSign"
 )
 
 Function Run-MSBuild {
@@ -25,6 +26,7 @@ Function Run-MSBuild {
        $c += " /m:4"
        $c += [string]::Format(" /p:Configuration=""{0}""", $Configuration)
        $c += [string]::Format(" /p:Platform=""{0}""", $Platform)
+       $c += [string]::Format(" /p:SignMode=""{0}""", $SignMode)
        $c += [string]::Format(" /t:""{0}"" ", $Target)
        if ($Inputs) {
                $c += [string]::Format(" /p:Inputs=""{0}"" ", $Inputs)
@@ -99,6 +101,7 @@ Function Run-CodeQL {
        $a += " /t:Build"
        $a += [string]::Format(" /p:Configuration=""{0}""", $Configuration)
        $a += [string]::Format(" /p:Platform=""{0}""", $Platform)
+       $a += [string]::Format(" /p:SignMode=""{0}""", $SignMode)
        $a += " "
        $a += Join-Path $projpath $project
        $a | Set-Content $bat
index 00af1a3780f7f52b4b1881286cb6950fcaed076f..4d03e231146b6e895b2ddb090ce2c76ddc32566d 100644 (file)
   <ItemGroup>
     <PackageFiles Include="$(OutDir)\$(ProjectName)\*" />
   </ItemGroup>
-  <Target Name="Archive" AfterTargets="TestSign">
+  <Target Name="ArchiveUnsigned" AfterTargets="Inf2Cat" Condition="('$(SignMode)' != 'TestSign') AND ('$(SignMode)' != 'ProductionSign')">
     <Copy
        SourceFiles="@(PackageFiles)"
        DestinationFiles="@(PackageFiles->'$(ArchiveDir)\%(FileName)%(Extension)')"
-    />
+       />
+  </Target>
+  <Target Name="ArchiveSigned" AfterTargets="TestSign;ProductionSign" Condition="('$(SignMode)' == 'TestSign' or '$(SignMode)' == 'ProductionSign')">
+    <Copy
+       SourceFiles="@(PackageFiles)"
+       DestinationFiles="@(PackageFiles->'$(ArchiveDir)\%(FileName)%(Extension)')"
+       />
   </Target>
 </Project>
index 00af1a3780f7f52b4b1881286cb6950fcaed076f..885ce5aa01d2060bf74f0334b75068b4e70b3478 100644 (file)
   <ItemGroup>
     <PackageFiles Include="$(OutDir)\$(ProjectName)\*" />
   </ItemGroup>
-  <Target Name="Archive" AfterTargets="TestSign">
+  <Target Name="ArchiveUnsigned" AfterTargets="Inf2Cat" Condition="('$(SignMode)' != 'TestSign') AND ('$(SignMode)' != 'ProductionSign')">
     <Copy
-       SourceFiles="@(PackageFiles)"
-       DestinationFiles="@(PackageFiles->'$(ArchiveDir)\%(FileName)%(Extension)')"
-    />
+        SourceFiles="@(PackageFiles)"
+        DestinationFiles="@(PackageFiles->'$(ArchiveDir)\%(FileName)%(Extension)')"
+       />
+  </Target>
+  <Target Name="ArchiveSigned" AfterTargets="TestSign;ProductionSign" Condition="('$(SignMode)' == 'TestSign' or '$(SignMode)' == 'ProductionSign')">
+    <Copy
+        SourceFiles="@(PackageFiles)"
+        DestinationFiles="@(PackageFiles->'$(ArchiveDir)\%(FileName)%(Extension)')"
+       />
   </Target>
 </Project>