Skip to content
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

Include versions and checksums in VMR publishing and remove prepare-artifacts.proj #100004

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
25 changes: 0 additions & 25 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -201,29 +201,4 @@
</ItemGroup>
</Target>

<!--
Arcade SDK versioning is defined by static properties in a targets file: work around this by
moving properties based on versioning into a target.
-->
<Target Name="GetProductVersions">
<PropertyGroup>
<IncludePreReleaseLabelInPackageVersion Condition="'$(DotNetFinalVersionKind)' != 'release'">true</IncludePreReleaseLabelInPackageVersion>
<IncludePreReleaseLabelInPackageVersion Condition="'$(SuppressFinalPackageVersion)' == 'true'">true</IncludePreReleaseLabelInPackageVersion>
<IncludePreReleaseLabelInPackageVersion Condition="'$(IsShipping)' != 'true'">true</IncludePreReleaseLabelInPackageVersion>

<IncludeBuildNumberInPackageVersion Condition="'$(StabilizePackageVersion)' != 'true'">true</IncludeBuildNumberInPackageVersion>
<IncludeBuildNumberInPackageVersion Condition="'$(SuppressFinalPackageVersion)' == 'true'">true</IncludeBuildNumberInPackageVersion>
<IncludeBuildNumberInPackageVersion Condition="'$(IsShipping)' != 'true'">true</IncludeBuildNumberInPackageVersion>

<ProductVersionSuffix Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true'">-$(VersionSuffix)</ProductVersionSuffix>
<ProductBandVersion Condition="'$(ProductBandVersion)' == ''">$(MajorVersion).$(MinorVersion)</ProductBandVersion>
<ProductionVersion Condition="'$(ProductionVersion)' == ''">$(ProductBandVersion).$(PatchVersion)</ProductionVersion>
<ProductVersion>$(ProductionVersion)$(ProductVersionSuffix)</ProductVersion>

<SharedFrameworkNugetVersion>$(ProductVersion)</SharedFrameworkNugetVersion>
<NuGetVersion>$(SharedFrameworkNugetVersion)</NuGetVersion>
<InstallersRelativePath>Runtime/$(SharedFrameworkNugetVersion)/</InstallersRelativePath>
</PropertyGroup>
</Target>

</Project>
63 changes: 43 additions & 20 deletions eng/Publishing.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,60 @@

<PropertyGroup>
<ProducesDotNetReleaseShippingAssets>true</ProducesDotNetReleaseShippingAssets>
<!-- This avoids creating VS.*.symbols.nupkg packages that are identical to the original package. -->
<AutoGenerateSymbolPackages>false</AutoGenerateSymbolPackages>
<!-- Set PlatformName to TargetArchitecture to create unique build manifest files. -->
<PlatformName Condition="'$(TargetArchitecture)' != ''">$(TargetArchitecture)</PlatformName>
</PropertyGroup>

<!-- 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="PublishRuntimeInstallers"
BeforeTargets="BeforePublish"
Condition="'$(DotNetBuildRepo)' == 'true'">
<!-- Retrieve runtime's runtime pack product version.
<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="RuntimeRuntimePackProductVersion" />
<Output TaskParameter="TargetOutputs" PropertyName="NonStableProductVersion" />
</MSBuild>
</Target>

<!-- This target only runs when EnableDefaultArtifacts=true which is a single build leg in CI. -->
<Target Name="GenerateProductVersionFiles"
DependsOnTargets="GetNonStableProductVersion"
BeforeTargets="PublishToAzureDevOpsArtifacts">
<!-- 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="ProductVersionForVersionsFile" />
</MSBuild>

<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="$(ProductVersionForVersionsFile)"
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>
<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/$(RuntimeRuntimePackProductVersion)/%(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'))">
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
<!-- Exclude wixpack.zip files from checksum generation -->
<ChecksumPath Condition="$([System.String]::Copy('%(Filename)%(Extension)').EndsWith('.wixpack.zip')) != 'true'">%(FullPath).sha512</ChecksumPath>
</Artifact>
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions eng/pipelines/official/jobs/prepare-signed-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
-subset publish
-configuration Release
/p:PublishRidAgnosticPackagesFromPlatform=${{ parameters.PublishRidAgnosticPackagesFromPlatform }}
/p:DownloadDirectory=$(Build.SourcesDirectory)\artifacts\PackageDownload\
/p:OfficialBuildId=$(Build.BuildNumber)
/p:SignType=$(SignType)
/p:DotNetSignType=$(SignType)
Expand Down
18 changes: 3 additions & 15 deletions src/installer/pkg/projects/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
If we are stabilizing set the StableVersion property for the packages.
Needs to happen in Directory.Build.targets to allow all the pkgproj's to set Version property first.
-->
<StableVersion Condition="'$(IncludePreReleaseLabelInPackageVersion)' != 'true'">$(Version)</StableVersion>
<StableVersion Condition="'$(DotNetFinalVersionKind)' == 'release' and
'$(SuppressFinalPackageVersion)' != 'true' and
'$(IsShipping)' == 'true'">$(Version)</StableVersion>

<!--
Explicitly re-set the symbol package output path. The pkgproj files here end up importing the targets from
Expand All @@ -16,20 +18,6 @@
<SymbolPackageOutputPath>$(PackageOutputPath)</SymbolPackageOutputPath>
</PropertyGroup>

<Target Name="SetTargetBasedPackageVersion"
BeforeTargets="GenerateNuSpec"
DependsOnTargets="GetProductVersions">
<PropertyGroup>
<Version>$(ProductVersion)</Version>
<!--
PackageVersion is normally calculated using Version during static property evaluation, but
we need some info from GetProductVersions, so it's too late to rely on that. We need to set
both in target evaluation, here.
-->
<PackageVersion>$(ProductVersion)</PackageVersion>
</PropertyGroup>
</Target>

Comment on lines -19 to -32
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might have been necessary in the past but AFAIK, NuGet calculates PackageVersion correctly, even for pkgprojs.

<!--
Remove duplicate files returned by restore. The resolve task performs extra detection to pick up
a PDB file for any file listed in the assets file. This causes duplicates if the assets file
Expand Down
Loading