Skip to content

Commit

Permalink
Update Publishing.props
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorHofer committed Mar 25, 2024
1 parent be3b37b commit d769d5e
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 90 deletions.
23 changes: 0 additions & 23 deletions eng/AfterSigning.targets

This file was deleted.

76 changes: 31 additions & 45 deletions eng/Publishing.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,73 +4,59 @@
<ProducesDotNetReleaseShippingAssets>true</ProducesDotNetReleaseShippingAssets>
<!-- This avoids creating VS.*.symbols.nupkg packages that are identical to the original package. -->
<AutoGenerateSymbolPackages>false</AutoGenerateSymbolPackages>
<!-- TODO: Change condition when runtime's official publishing starts using Publishing.props:
https://github.com/dotnet/source-build/issues/4239 -->
<EnableDefaultPublishItems Condition="'$(DotNetBuildRepo)' == 'true'">true</EnableDefaultPublishItems>
<!-- Set PlatformName to TargetArchitecture to create unique build manifest files. -->
<PlatformName Condition="'$(TargetArchitecture)' != ''">$(TargetArchitecture)</PlatformName>
</PropertyGroup>

<!-- Retrieve the runtime pack product version.
Don't stabilize the package version in order to retrieve the VersionSuffix. -->
<Target Name="GetProductVersion">
<Target Name="GetNonStableProductVersion">
<!-- Retrieve the non-stable runtime pack product version.
Don't stabilize the package version in order to retrieve the VersionSuffix. -->
<MSBuild Projects="$(RepoRoot)src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj"
Targets="ReturnProductVersion"
Properties="IsShipping=false;
Crossgen2SdkOverridePropsPath=;
Crossgen2SdkOverrideTargetsPath=">
<Output TaskParameter="TargetOutputs" PropertyName="RuntimePackProductVersion" />
<Output TaskParameter="TargetOutputs" PropertyName="NonStableProductVersion" />
</MSBuild>
</Target>

<!-- Include installer archives and packages which aren't globbed by default.
Don't include Symbols archive as it is already included in Arcade's Publish.proj, with correct blob path. -->
<Target Name="PublishInstallers"
DependsOnTargets="GetProductVersion"
<!-- This target only runs when EnableDefaultArtifacts=true which is a single build leg in CI. -->
<Target Name="GenerateProductVersionFiles"
DependsOnTargets="GetNonStableProductVersion"
BeforeTargets="PublishToAzureDevOpsArtifacts"
Condition="'$(DotNetBuildRepo)' == 'true'">

<ItemGroup>
<InstallerToPublish Include="$(ArtifactsPackagesDir)**\*.tar.gz;
$(ArtifactsPackagesDir)**\*.zip;
$(ArtifactsPackagesDir)**\*.deb;
$(ArtifactsPackagesDir)**\*.rpm;
$(ArtifactsPackagesDir)**\*.pkg;
$(ArtifactsPackagesDir)**\*.exe;
$(ArtifactsPackagesDir)**\*.msi"
Exclude="$(ArtifactsPackagesDir)**\Symbols.runtime.tar.gz" />
<ItemsToPushToBlobFeed Include="@(InstallerToPublish)"
IsShipping="$([System.String]::Copy('%(RecursiveDir)').StartsWith('Shipping'))"
PublishFlatContainer="true"
RelativeBlobPath="Runtime/$(RuntimePackProductVersion)/%(Filename)%(Extension)" />

<!-- Include checksums -->
<ChecksumToPublish Include="$(ArtifactsPackagesDir)**\*.sha512" />
<ItemsToPushToBlobFeed Include="@(ChecksumToPublish)"
IsShipping="false"
PublishFlatContainer="true"
RelativeBlobPath="Runtime/$(RuntimePackProductVersion)/%(Filename)%(Extension)" />
</ItemGroup>
</Target>
Condition="'$(EnableDefaultArtifacts)' == 'true'">
<!-- Retrieve the runtime pack product version. -->
<MSBuild Projects="$(RepoRoot)src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj"
Targets="ReturnProductVersion"
Properties="Crossgen2SdkOverridePropsPath=;
Crossgen2SdkOverrideTargetsPath=">
<Output TaskParameter="TargetOutputs" PropertyName="ProductVersion" />
</MSBuild>

<Target Name="GenerateAndPublishProductVersionFiles"
DependsOnTargets="GetProductVersion"
Condition="'$(EnableDefaultPublishItems)' == 'true'"
BeforeTargets="PublishToAzureDevOpsArtifacts">
<ItemGroup>
<ProductVersionFile Include="$(ArtifactsShippingPackagesDir)productVersion.txt" />
<ProductVersionFile Include="$(ArtifactsShippingPackagesDir)runtime-productVersion.txt" />
</ItemGroup>

<!-- Generate productVersion.txt file containing the product version. -->
<WriteLinesToFile File="%(ProductVersionFile.Identity)"
Lines="$(RuntimePackProductVersion)"
Lines="$(ProductVersion)"
Overwrite="true"
Encoding="ASCII" />


<ItemGroup>
<Artifact Include="@(ProductVersionFile)"
RelativeBlobPath="Runtime/$(NonStableProductVersion)/%(Filename)%(Extension)" />
</ItemGroup>
</Target>

<Target Name="AddRelativeBlobPathToInstallerArtifacts"
DependsOnTargets="GetNonStableProductVersion"
BeforeTargets="PublishToAzureDevOpsArtifacts"
AfterTargets="GenerateChecksumsFromArtifacts">
<ItemGroup>
<ItemsToPushToBlobFeed Include="@(ProductVersionFile)"
IsShipping="false"
PublishFlatContainer="true"
RelativeBlobPath="Runtime/$(RuntimePackProductVersion)/%(Filename)%(Extension)" />
<Artifact Condition="'%(Artifact.PublishFlatContainer)' == 'true' and '%(Artifact.RelativeBlobPath)' == ''"
RelativeBlobPath="Runtime/$(NonStableProductVersion)/%(Filename)%(Extension)" />
</ItemGroup>
</Target>

Expand Down
42 changes: 28 additions & 14 deletions eng/Signing.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
During post build signing, there are no packages to sign during SignFinalPackages.
-->
<AllowEmptySignList>true</AllowEmptySignList>
<AllowEmptySignList Condition="'$(DotNetBuildOrchestrator)' != 'true'">true</AllowEmptySignList>
<!-- TODO: Change condition when runtime's official publishing starts using Publishing.proj:
https://github.com/dotnet/source-build/issues/4239 -->
<EnableDefaultArtifacts Condition="'$(DotNetBuildOrchestrator)' != 'true'">false</EnableDefaultArtifacts>
</PropertyGroup>

<ItemGroup>
<!--
Replace the default items to sign with the specific set we want. This allows the build to call
Arcade's Sign.proj multiple times for different sets of files as the build progresses.
-->
<ItemsToSign Remove="@(ItemsToSign)" />

<!-- apphost and comhost template files are not signed, by design. -->
<FileSignInfo Include="apphost.exe;singlefilehost.exe;comhost.dll" CertificateName="None" />

Expand All @@ -37,12 +34,6 @@
<FileSignInfo Include="Mono.Cecil.Pdb.dll" CertificateName="3PartySHA2" />
<FileSignInfo Include="Mono.Cecil.Rocks.dll" CertificateName="3PartySHA2" />

<!-- Exclude symbol packages from have a NuGet signature. These are never pushed to NuGet.org or
other feeds (in fact, that have identical identity to their non-symbol variant) -->
<DownloadedSymbolPackages Include="$(DownloadDirectory)**\*.symbols.nupkg" />
<DownloadedSymbolPackagesWithoutPaths Include="@(DownloadedSymbolPackages->'%(Filename)%(Extension)')" />
<FileSignInfo Include="@(DownloadedSymbolPackagesWithoutPaths->Distinct())" CertificateName="None" />

<FileExtensionSignInfo Include=".msi" CertificateName="MicrosoftDotNet500" />
<FileExtensionSignInfo Include=".pkg" CertificateName="8003" />
<FileExtensionSignInfo Include=".deb;.rpm" CertificateName="LinuxSign" />
Expand All @@ -55,7 +46,13 @@
<FileSignInfo Update="@(FileSignInfo->WithMetadataValue('CertificateName','Microsoft400'))" CertificateName="MicrosoftDotNet500" />
</ItemGroup>

<ItemGroup Condition="'$(PrepareArtifacts)' == 'true'">
<ItemGroup Condition="'$(EnableDefaultArtifacts)' != 'true'">
<!-- Exclude symbol packages from have a NuGet signature. These are never pushed to NuGet.org or
other feeds (in fact, that have identical identity to their non-symbol variant) -->
<DownloadedSymbolPackages Include="$(DownloadDirectory)**\*.symbols.nupkg" />
<DownloadedSymbolPackagesWithoutPaths Include="@(DownloadedSymbolPackages->'%(Filename)%(Extension)')" />
<FileSignInfo Include="@(DownloadedSymbolPackagesWithoutPaths->Distinct())" CertificateName="None" />

<ItemsToSignWithPaths Include="$(DownloadDirectory)**\*.msi" />
<ItemsToSignWithPaths Include="$(DownloadDirectory)**\*.exe" />
<ItemsToSignWithPaths Include="$(DownloadDirectory)**\*.nupkg" />
Expand All @@ -65,4 +62,21 @@
<ItemsToSignPostBuild Include="@(ItemsToSignWithoutPaths->Distinct())" Condition="'$(PostBuildSign)' == 'true'" />
<ItemsToSign Include="@(ItemsToSignWithPaths->Distinct())" Condition="'$(PostBuildSign)' != 'true'" />
</ItemGroup>

<!-- Include installers -->
<ItemGroup Condition="'$(EnableDefaultArtifacts)' == 'true'">
<Artifact Include="$(ArtifactsPackagesDir)**\*.tar.gz;
$(ArtifactsPackagesDir)**\*.zip;
$(ArtifactsPackagesDir)**\*.deb;
$(ArtifactsPackagesDir)**\*.rpm;
$(ArtifactsPackagesDir)**\*.pkg;
$(ArtifactsPackagesDir)**\*.exe;
$(ArtifactsPackagesDir)**\*.msi"
Exclude="$(ArtifactsPackagesDir)**\Symbols.runtime.tar.gz"
IsShipping="$([System.String]::Copy('%(RecursiveDir)').StartsWith('Shipping'))">
<!-- Exclude wixpack.zip files from checksum generation -->
<ChecksumPath Condition="$([System.String]::Copy('%(Filename)%(Extension)').EndsWith('.wixpack.zip')) != 'true'">%(FullPath).sha512</ChecksumPath>
</Artifact>
</ItemGroup>

</Project>
10 changes: 2 additions & 8 deletions src/installer/prepare-artifacts.proj
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@

<!-- When doing post build sign, pull in the arcade sign.props file, which will
create some initial sign groups and then pulls in the repo's custom Signing.props overrides.
Before importing the signing props. Set PrepareArtifactst=true. Depending on context (SDK project vs. not),
the initial imports of livebuilds.targets and Configuration.props are already imported and thus cannot
be imported again. Without those imports, the globbing of files to sign will not work properly. -->
<PropertyGroup>
<PrepareArtifacts>true</PrepareArtifacts>
</PropertyGroup>
Before importing the Signing props. -->
<Import Project="../tools/Sign.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />

<Import Project="$(RepositoryEngineeringDir)Publishing.props" Condition="Exists('$(RepositoryEngineeringDir)Publishing.props')" />
Expand Down Expand Up @@ -78,8 +73,7 @@
Projects="$(ArcadeSdkSignProject)"
Targets="Sign"
Properties="
DownloadDirectory=$(DownloadDirectory);
PrepareArtifacts=$(PrepareArtifacts)" />
DownloadDirectory=$(DownloadDirectory)" />
</Target>

<!--
Expand Down

0 comments on commit d769d5e

Please sign in to comment.