-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Switch to new Microsoft.DotNet.SharedFramework.Sdk and refactor Host/Installer build subsets #38457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ba14e1d
6802ad1
a36a296
c6f72c7
8757c50
cbd46d2
db70570
7ad7304
ece261c
84ab2b0
0b54120
290d0fa
2083c85
49fbab6
0c9b00c
6dfa868
63cdc70
5c637d2
c8bd51e
890dc74
5ef903f
98bb6c9
4a0ecf0
3ac3696
361e750
13753c6
31fcde4
6683b7a
7137375
f8d1fbe
388711d
006a761
0fdcd70
a118d3d
1d84487
6752318
ae145b3
e2e6624
54496ab
0ce63ef
2612fba
d2adc6c
3d994ff
06d242b
90baa80
f5434af
7b7526d
1840af7
15026fb
442fed4
a2cdf87
d9838ff
2f6d892
b97b134
c9597c4
af5bcc8
f521759
4c5828d
dd86d7f
d26bad7
494d9bd
cf95aa7
d23d093
9c54206
160a2dd
1a35bcc
4479907
a65d4c8
b4804c8
d6be480
6f9b6d5
78849bf
9b3bb51
d0f5313
8fe251c
29f38aa
1a71e7b
33407b5
a87e9a1
7fe5c8e
a63c911
14e80f4
160bf5d
ac5ce6c
299745d
642e0f4
faf52ec
a589182
6ee0569
9e4ce3c
1f34d31
1bd45aa
829d01a
a72bc60
55d36ba
dbf59d7
3b60cad
3027275
220044f
aafd6b1
75a3c72
417f0d6
77cf013
acf1a04
e2f5cb7
68909e2
147aec4
152cf0e
3ac62de
590d95d
e7bdc72
454214d
e111c6e
f931142
7be2e3b
e36639b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<Project> | ||
<Project InitialTargets="SetupFilesToSign"> | ||
|
||
<!-- If this file was pulled in via prepare-artifacts.proj (a non-SDK project, these files are already | ||
imported. --> | ||
|
@@ -12,7 +12,7 @@ | |
|
||
During post build signing, there are no packages to sign during SignFinalPackages. | ||
--> | ||
<AllowEmptySignList Condition="'$(SignFinalPackages)' != 'true' or '$(PostBuildSign)' == 'true'">true</AllowEmptySignList> | ||
<AllowEmptySignList>true</AllowEmptySignList> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
|
@@ -22,10 +22,6 @@ | |
--> | ||
<ItemsToSign Remove="@(ItemsToSign)" /> | ||
|
||
<!-- Find bundle artifacts, which need multiple stages to fully sign. --> | ||
<BundleInstallerEngineArtifact Include="$(ArtifactsPackagesDir)**/*engine.exe" /> | ||
<BundleInstallerExeArtifact Include="$(ArtifactsPackagesDir)**/*.exe" /> | ||
|
||
<!-- apphost and comhost template files are not signed, by design. --> | ||
<FileSignInfo Include="apphost.exe;singlefilehost.exe;comhost.dll" CertificateName="None" /> | ||
|
||
|
@@ -49,126 +45,32 @@ | |
<FileExtensionSignInfo Include=".deb;.rpm" CertificateName="LinuxSign" /> | ||
</ItemGroup> | ||
|
||
<!-- When doing post build signing, the file containers (e.g. nupkg, msi, etc.) are | ||
processed for signing (opened up, individually signed, etc.) and these individual ItemsToSign | ||
elements are unnecessary. When signing within the build, we need to individually process | ||
dll's, exes, etc. that go into msi's because these containers are not able to be processed | ||
by SignTool after they are packed up. What makes this possible for post build signing | ||
is that the build will produce a zip file containing the inputs to the Wix light linker | ||
which can be used to create the installer later, after the inputs have been signed and replaced. --> | ||
<Choose> | ||
<When Condition="'$(PostBuildSign)' != 'true'"> | ||
<ItemGroup Condition="'$(SignBinaries)' == 'true'"> | ||
<!-- Sign CoreCLR. --> | ||
<ItemsToSign Include="$(CoreCLRSharedFrameworkDir)*.dll" /> | ||
<ItemsToSign Include="$(CoreCLRSharedFrameworkDir)*.exe" /> | ||
|
||
<ItemsToSign Include="$(CoreCLRArtifactsPath)System.Private.CoreLib.dll" /> | ||
|
||
<ItemsToSign Include="$(CoreCLRCrossgen2Dir)crossgen2.exe" /> | ||
<ItemsToSign Include="$(CoreCLRCrossgen2Dir)crossgen2.dll" /> | ||
<ItemsToSign Include="$(CoreCLRCrossgen2Dir)ILCompiler.DependencyAnalysisFramework.dll" /> | ||
<ItemsToSign Include="$(CoreCLRCrossgen2Dir)ILCompiler.ReadyToRun.dll" /> | ||
<ItemsToSign Include="$(CoreCLRCrossgen2Dir)ILCompiler.TypeSystem.ReadyToRun.dll" /> | ||
<ItemsToSign Include="$(CoreCLRCrossgen2Dir)jitinterface_$(TargetArchitecture).dll" /> | ||
|
||
<ItemsToSign Include="$(CoreCLRCrossgen2Dir)clrjit_win_x86_$(TargetArchitecture).dll" /> | ||
<ItemsToSign Include="$(CoreCLRCrossgen2Dir)clrjit_win_arm_$(TargetArchitecture).dll" /> | ||
<ItemsToSign Include="$(CoreCLRCrossgen2Dir)clrjit_unix_arm_$(TargetArchitecture).dll" /> | ||
<ItemsToSign Condition="'$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'x64'" Include="$(CoreCLRCrossgen2Dir)clrjit_win_x64_$(TargetArchitecture).dll" /> | ||
<ItemsToSign Condition="'$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'x64'" Include="$(CoreCLRCrossgen2Dir)clrjit_win_arm64_$(TargetArchitecture).dll" /> | ||
<ItemsToSign Condition="'$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'x64'" Include="$(CoreCLRCrossgen2Dir)clrjit_unix_x64_$(TargetArchitecture).dll" /> | ||
<ItemsToSign Condition="'$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'x64'" Include="$(CoreCLRCrossgen2Dir)clrjit_unix_arm64_$(TargetArchitecture).dll" /> | ||
|
||
<ItemsToSign Include="$(CoreCLRArtifactsPath)$(CoreCLRCrossTargetComponentDirName)/sharedFramework/*.dll" Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''" /> | ||
<ItemsToSign Include="$(CoreCLRArtifactsPath)$(CoreCLRCrossTargetComponentDirName)/sharedFramework/*.exe" Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''" /> | ||
|
||
<!-- Sign api-ms-win-core-xstate-l2-1-0 binary as it is only catalog signed in the current SDK. --> | ||
<ItemsToSign | ||
Condition="'$(Configuration)' == 'Release' and '$(TargetArchitecture)' == 'x86'" | ||
Include="$(CoreCLRArtifactsPath)Redist\ucrt\DLLs\$(TargetArchitecture)\api-ms-win-core-xstate-l2-1-0.dll" /> | ||
|
||
<!-- Sign libraries. --> | ||
<ItemsToSign Include="$(LibrariesNativeArtifactsPath)*.dll" /> | ||
<ItemsToSign Include="$(LibrariesSharedFrameworkRefArtifactsPath)*.dll" /> | ||
<!-- Most runtime artifacts will be crossgenned, so sign them post-crossgen. mscorlib isn't. --> | ||
<ItemsToSign Include="$(LibrariesSharedFrameworkBinArtifactsPath)mscorlib.dll" /> | ||
|
||
<!-- Sign the host. --> | ||
<ItemsToSign Include="$(BaseOutputRootPath)corehost/**/hostfxr.dll" /> | ||
<ItemsToSign Include="$(BaseOutputRootPath)corehost/**/hostpolicy.dll" /> | ||
<ItemsToSign Include="$(BaseOutputRootPath)corehost/**/dotnet.exe" /> | ||
<ItemsToSign Include="$(BaseOutputRootPath)corehost/**/ijwhost.dll" /> | ||
<ItemsToSign Include="$(BaseOutputRootPath)corehost/**/nethost.dll" /> | ||
|
||
<!-- Sign managed libraries in installer subset. --> | ||
<ItemsToSign Include="$(ArtifactsBinDir)Microsoft.NET.HostModel/**/*.dll" /> | ||
</ItemGroup> | ||
|
||
<!-- Sign ready-to-run binaries after crossgen is applied. --> | ||
<ItemGroup Condition="'$(SignR2RBinaries)' == 'true'"> | ||
<ItemsToSign Include="$(CrossGenRootPath)**/*.dll" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(SignMsiFiles)' == 'true'"> | ||
<ItemsToSign Include="$(ArtifactsPackagesDir)**/*.msi" /> | ||
<ItemsToSign Include="$(ArtifactsPackagesDir)**/*.cab" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(SignBurnEngineFiles)' == 'true'"> | ||
<ItemsToSign Include="@(BundleInstallerEngineArtifact)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(SignBurnBundleFiles)' == 'true'"> | ||
<!-- Sign the bundles, now that the engine is reattached. Avoid re-signing the engine. --> | ||
<ItemsToSign | ||
Include="@(BundleInstallerExeArtifact)" | ||
Exclude="@(BundleInstallerEngineArtifact)" /> | ||
<!-- Note: wixstdba is internal to the engine bundle and does not get signed. --> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(SignFinalPackages)' == 'true'"> | ||
<DownloadedSymbolPackages Include="$(DownloadDirectory)**\*.symbols.nupkg" /> | ||
<ItemsToSign Include="$(DownloadDirectory)**\*.nupkg" Exclude="@(DownloadedSymbolPackages)" /> | ||
|
||
<!-- The cross OS diagnostics symbol packages need to be signed as they are the only packages | ||
that have a specific version of assets that are only meant to be indexed in symbol servers. | ||
Since only *symbols.nupkg get indexed, and installer doesn't produce these, we need to glob them for signing. --> | ||
<ItemsToSign Include="$(DownloadDirectory)**\*CrossOsDiag*.symbols.nupkg" /> | ||
|
||
<ItemsToSign Include="$(DownloadDirectory)**\*.deb" /> | ||
<ItemsToSign Include="$(DownloadDirectory)**\*.rpm" /> | ||
</ItemGroup> | ||
</When> | ||
|
||
<!-- When doing post build signing, we sign all artifacts we would push. | ||
Symbol packages are included too. --> | ||
<When Condition="'$(PostBuildSign)' == 'true'"> | ||
<ItemGroup> | ||
<ItemsToSignWithPaths Include="$(DownloadDirectory)**/*.msi" Condition="'$(PrepareArtifacts)' == 'true'" /> | ||
<ItemsToSignWithPaths Include="$(DownloadDirectory)**/*.exe" Condition="'$(PrepareArtifacts)' == 'true'" /> | ||
<ItemsToSignWithPaths Include="$(DownloadDirectory)**/*.nupkg" Condition="'$(PrepareArtifacts)' == 'true'" /> | ||
<ItemsToSignWithPaths Include="$(DownloadDirectory)**/*.zip" Condition="'$(PrepareArtifacts)' == 'true'" /> | ||
|
||
<ItemsToSignWithoutPaths Include="@(ItemsToSignWithPaths->'%(Filename)%(Extension)')" /> | ||
<ItemsToSignPostBuild Include="@(ItemsToSignWithoutPaths->Distinct())" /> | ||
</ItemGroup> | ||
|
||
<!-- Even when doing post build signing, sign mscordaccore*.dll and mscordbi.dll --> | ||
<ItemGroup Condition="'$(SignBinaries)' == 'true'"> | ||
<ItemsToSign Include="$(CoreCLRSharedFrameworkDir)mscordaccore*.dll" /> | ||
<ItemsToSign Include="$(CoreCLRSharedFrameworkDir)mscordbi.dll" /> | ||
<ItemsToSign Include="$(CoreCLRArtifactsPath)$(CoreCLRCrossTargetComponentDirName)/sharedFramework/mscordaccore*.dll" Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''" /> | ||
<ItemsToSign Include="$(CoreCLRArtifactsPath)$(CoreCLRCrossTargetComponentDirName)/sharedFramework/mscordbi.dll" Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(SignFinalPackages)' == 'true'"> | ||
<!-- The cross OS diagnostics symbol packages need to be signed as they are the only packages | ||
that have a specific version of assets that are only meant to be indexed in symbol servers. | ||
Since only *symbols.nupkg get indexed, and installer doesn't produce these, we need to glob them for signing. --> | ||
<ItemsToSign Include="$(DownloadDirectory)**\*CrossOsDiag*.nupkg" /> | ||
</ItemGroup> | ||
</When> | ||
</Choose> | ||
<Target Name="SetupFilesToSign"> | ||
<!-- Ensure that we don't miss the DAC or DBI with the globbing below --> | ||
<PropertyGroup Condition="'$(SignDiagnostics)' == 'true'"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd say before getting this in we need to merge mmitche's changes and verify. His changes remove the target and a bunch of these operations won't play well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’ve already validated that these changes work and sign the files correctly. This can replace the SignBinaries group in mmitche’s PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this work outside a target though? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could if L55 would use the WithMetadataValue item function to check on filename but I doubt it's worth changing it now that Jeremy already did the validation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed during standup, since we're just using globs and not using the version variables that Arcade updates, we can use this inside of an InitialTargets target if need be to ensure that we correctly sign the short name DAC, long name DAC, and DBI. |
||
<AllowEmptySignList>false</AllowEmptySignList> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(SignDiagnostics)' == 'true'"> | ||
<ItemsToSign Include="$(DiagnosticsFilesRoot)/**/mscordaccore*.dll" /> | ||
<ItemsToSign Include="$(DiagnosticsFilesRoot)/**/mscordbi.dll" /> | ||
<!-- | ||
The DAC should be signed with the SHA2 cert (both long and short name). | ||
We already add the short-name DAC above, so add the long-name DAC here. | ||
--> | ||
<DacFileSignInfo Include="@(ItemsToSign->'%(FileName)%(Extension)')" | ||
Condition="$([System.String]::new('%(FileName)').StartsWith('mscordaccore'))" /> | ||
<FileSignInfo Include="@(DacFileSignInfo->ClearMetadata()->Distinct())" | ||
Exclude="mscordaccore.dll" | ||
CertificateName="MicrosoftSHA2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(SignFinalPackages)' == 'true'"> | ||
<!-- The cross OS diagnostics symbol packages need to be signed as they are the only packages | ||
that have a specific version of assets that are only meant to be indexed in symbol servers. | ||
Since only *symbols.nupkg get indexed, and installer doesn't produce these, we need to glob them for signing. --> | ||
<ItemsToSign Include="$(DownloadDirectory)**\*CrossOsDiag*.nupkg" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkoritzinsky This PR removed this line, which will break post build signing. Post build signing breaks signing into two categories:
ItemsToSign and ItemsToSignPostBuild. ItemsToSign corresponds to those items that should always be signed during the build (when PostBuildSign is true or false), and ItemsToSignPostBuild should contain items to sign in post build, only if PostBuildSign = true.
The use of target should be unnecessary.
/cc @ViktorHofer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that you will only need the setup for ItemGroupsWhen PostBuildSign=true. This does not need to be done in a target.
https://github.com/dotnet/runtime/pull/38457/files#diff-a923a7746e08ef5df4bfd49f340d9f93055d66ba792770a7e1c227b3eaf3d4efL146-L154
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shoot. I’ll put out a PR to add back this item group.