[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Pass SignMode to MSBuild


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Fri, 18 Nov 2022 10:06:10 +0000
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Fri, 18 Nov 2022 10:06:22 +0000
  • Ironport-data: A9a23:TCprIKNGI9fUtIPvrR3/l8FynXyQoLVcMsEvi/4bfWQNrUoq1DcEy WtJXz+HPfzbZjD9edxxYdi/oR8CvZfRzdNjTAto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQA+KmU4YoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9SuvzrRC9H5qyo4mpB5wxmPJingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0utTWjhh0 fMAEREyRQ7ZmPy4mej4a9A506zPLOGzVG8eknRpzDWfBvc6W5HTBa7N4Le03h9p2JoIR6yHI ZNEN3w/N3wsYDUWUrsTIJUhkeHunXz+bz1wo1OJv6snpWPUyWSd1ZC9bYOPI4PSFa25mG6/h ULg7UP8IioiF9uhmDGu/V2M37TQyHaTtIU6S+Tjq68CbEeo7nMSDlgOSx63rOe0jma6WslDM AoE9yw2t68w+Ue3CN7nUHWFTGWs50BGHYAKSqtjtV/LmvG8Dxul6nYsQxoaMfMCu9cPZAMBy AWWgd2wX39OiejAIZ6CzYu8oTS3MCkTCGYNYy4YUAcIi+XeTJEPYgHnFYg6TvPs5jHhMXSpm m3R8nBi71kGpZRTv5hX62wrlN5FSnLhagcurjvaUWu+hu+STN70Ptf4gbQ3ABspEWp4crVjl CJa8yR9xLpUZX1oqMBqaLtlIV1Rz6zZWAAweHY2d3Thnhz0k5JZQahe4StlOGBiOdsedDnib Sf74F0PtMAJYSb3N/EuO+pd7vjGK4C6TbwJsdiNP7JzjmVZLlfbrEmCm2bPt4wSrKTcuf5mY srKGSpdJX0bFb5m3FKLqxQ1iNcWK+FX7T27eK0XODz8jOvCNCDPFOZt3ZnnRrlR0Z5oaT79q 753X/ZmAT0GOAEiSkE7KbIuEG0=
  • Ironport-hdrordr: A9a23:0/DZUan5KSO7l2pUBI0/5BnVbwzpDfIg3DAbv31ZSRFFG/Fxl6 iV8sjzsiWE7Ar5OUtQ/+xoV5PhfZqxz/JICOoqTNKftWvdyQiVxehZhOOIqVDd8kXFh4lgPM xbEpSWZueeMbEDt7eZ3DWF
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

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@xxxxxxxxxx>
---
 build.ps1                      | 10 +++++++---
 msbuild.ps1                    |  5 ++++-
 vs2019/package/package.vcxproj | 12 +++++++++---
 vs2022/package/package.vcxproj | 12 +++++++++---
 4 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/build.ps1 b/build.ps1
index 88d57a6..08b9715 100644
--- 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
 }
diff --git a/msbuild.ps1 b/msbuild.ps1
index 846abd2..1ec8508 100644
--- a/msbuild.ps1
+++ b/msbuild.ps1
@@ -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
diff --git a/vs2019/package/package.vcxproj b/vs2019/package/package.vcxproj
index 00af1a3..f1e0919 100644
--- a/vs2019/package/package.vcxproj
+++ b/vs2019/package/package.vcxproj
@@ -70,10 +70,16 @@
   <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>
diff --git a/vs2022/package/package.vcxproj b/vs2022/package/package.vcxproj
index 00af1a3..f1e0919 100644
--- a/vs2022/package/package.vcxproj
+++ b/vs2022/package/package.vcxproj
@@ -70,10 +70,16 @@
   <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>
-- 
2.32.0.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.