From 9e59acb298c20658788567e0c6f0793fe97d37f6 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 23 Oct 2024 08:18:37 -0700 Subject: [PATCH] Unify dotnet/runtime on using Arcade -publish (#108990) * Unify dotnet/runtime on using Arcade -publish Fixes https://github.com/dotnet/source-build/issues/4239 Replaces https://github.com/dotnet/runtime/pull/100004 Co-authored By: Viktor Hofer * Use DotNetBuildOrchestrator to avoid executing in a repo source-build context. * Actually, we want this logic to run only when we're running in a non-VMR-like context, even repo build. * Restore, but only restore the toolset in the publish job * Fix Exists check and do the "restore toolset only" check one degree away from the Arcade SDK. * Set the "publish using pipelines" global property when publishing * Don't produce the product version files on repo source build. --- Build.proj | 2 +- Directory.Build.targets | 26 -- eng/Publishing.props | 211 ++++++++++-- eng/Subsets.props | 5 - .../jobs/prepare-signed-artifacts.yml | 7 +- src/installer/Directory.Build.props | 7 - .../pkg/projects/Directory.Build.targets | 18 +- src/installer/prepare-artifacts.proj | 307 ------------------ src/installer/tests/Directory.Build.targets | 1 - src/mono/browser/browser.proj | 11 +- ...t.NET.Runtime.WebAssembly.Templates.csproj | 5 - src/native/corehost/corehost.proj | 2 +- .../installer.tasks/GenerateChecksums.cs | 66 ---- 13 files changed, 207 insertions(+), 461 deletions(-) delete mode 100644 src/installer/prepare-artifacts.proj delete mode 100644 src/tasks/installer.tasks/GenerateChecksums.cs diff --git a/Build.proj b/Build.proj index 0957ae6846e57..2f687610b4a93 100644 --- a/Build.proj +++ b/Build.proj @@ -1,6 +1,6 @@ - + diff --git a/Directory.Build.targets b/Directory.Build.targets index 4fcf4eae61b16..822b58cadf688 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -194,30 +194,4 @@ - - - - - true - true - true - - true - true - true - - -$(VersionSuffix) - $(MajorVersion).$(MinorVersion) - $(ProductBandVersion).$(PatchVersion) - $(ProductionVersion)$(ProductVersionSuffix) - - $(ProductVersion) - $(SharedFrameworkNugetVersion) - Runtime/$(SharedFrameworkNugetVersion)/ - - - diff --git a/eng/Publishing.props b/eng/Publishing.props index 1507fc850339d..562fc45c8c118 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -1,39 +1,206 @@ - + true + + false + + $(TargetArchitecture) - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + <_ShouldGenerateProductVersionFiles Condition="'$(DotNetBuildRepo)' == 'true' and '$(DotNetBuildOrchestrator)' == 'true'">true + <_ShouldGenerateProductVersionFiles Condition="'$(DotNetBuildRepo)' != 'true' and '$(DotNetBuildOrchestrator)' != 'true'">true + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/eng/Subsets.props b/eng/Subsets.props index d23e0690d6a90..393d13c0c5a77 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -206,7 +206,6 @@ - @@ -560,10 +559,6 @@ - - - - diff --git a/eng/pipelines/official/jobs/prepare-signed-artifacts.yml b/eng/pipelines/official/jobs/prepare-signed-artifacts.yml index eb25d311890a9..1440a7a1dfdc3 100644 --- a/eng/pipelines/official/jobs/prepare-signed-artifacts.yml +++ b/eng/pipelines/official/jobs/prepare-signed-artifacts.yml @@ -43,13 +43,14 @@ jobs: steps: - script: >- - build.cmd -ci - -subset publish - -configuration Release + build.cmd -restore -sign -publish -ci -configuration Release + /p:RestoreToolsetOnly=true /p:PublishRidAgnosticPackagesFromPlatform=${{ parameters.PublishRidAgnosticPackagesFromPlatform }} + /p:DownloadDirectory=$(Build.SourcesDirectory)\artifacts\PackageDownload\ /p:OfficialBuildId=$(Build.BuildNumber) /p:SignType=$(_SignType) /p:DotNetSignType=$(_SignType) + /p:DotNetPublishUsingPipelines=true /bl:$(Build.SourcesDirectory)\prepare-artifacts.binlog displayName: Prepare artifacts and upload to build diff --git a/src/installer/Directory.Build.props b/src/installer/Directory.Build.props index 45def02007831..917ac6f4a7e0a 100644 --- a/src/installer/Directory.Build.props +++ b/src/installer/Directory.Build.props @@ -14,11 +14,4 @@ want to ensure we use the correct packages. --> true - - - - $([System.IO.Path]::GetDirectoryName('$(ArcadeSdkBuildTasksAssembly)'))\..\ - $(ArcadeSdkMSBuildProjectDir)Sign.proj - - diff --git a/src/installer/pkg/projects/Directory.Build.targets b/src/installer/pkg/projects/Directory.Build.targets index 74420fa76bb1f..fcb2c60b44f65 100644 --- a/src/installer/pkg/projects/Directory.Build.targets +++ b/src/installer/pkg/projects/Directory.Build.targets @@ -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. --> - $(Version) + $(Version) - $(ProductVersion) - - - - false - true - - .sha512 - $(ArtifactsDir)PackageDownload/ - - - - - - - - - - - - - - - - true - - - - - $(SYSTEM_TEAMFOUNDATIONCOLLECTIONURI) - - - $(CollectionUri.Split('/')[3]) - - - $(CollectionUri.Split('.')[0].Split('/')[2]) - - - - - - - - - - - - - - - - - - DotNetReleaseShipping=true - - - - - - - - - - - Manifest.xml - $(ArtifactsLogDir)AssetManifest/$(AssetManifestFilename) - - $(ProductionVersion) - $(ProductVersion) - - - - - - - - - - - - - - - - - $(InstallersRelativePath)%(Filename)%(Extension) - true - - - - $(InstallersRelativePath)%(Filename)%(Extension) - Checksum - true - - - - $(InstallersRelativePath)productVersion.txt - true - - - - $(InstallersRelativePath)runtime-productVersion.txt - true - - - - $(InstallersRelativePath)workloads/%(Filename)%(Extension) - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/installer/tests/Directory.Build.targets b/src/installer/tests/Directory.Build.targets index 7c7c54b416a5a..23bb37cf3fa2a 100644 --- a/src/installer/tests/Directory.Build.targets +++ b/src/installer/tests/Directory.Build.targets @@ -11,7 +11,6 @@ diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index 669270cf332d0..444113b220978 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -558,12 +558,19 @@ <_RollupInputs Include="$(BrowserProjectRoot)runtime/*.js"/> - + + + + + <_MonoRollupEnvironmentVariable Include="Configuration:$(Configuration)" /> <_MonoRollupEnvironmentVariable Include="NativeBinDir:$(NativeBinDir)" /> <_MonoRollupEnvironmentVariable Include="WasmObjDir:$(WasmObjDir)" /> - <_MonoRollupEnvironmentVariable Include="ProductVersion:$(ProductVersion)" /> + <_MonoRollupEnvironmentVariable Include="ProductVersion:$(RuntimePackProductVersion)" /> <_MonoRollupEnvironmentVariable Include="WasmEnableThreads:$(WasmEnableThreads)" /> <_MonoRollupEnvironmentVariable Include="WASM_ENABLE_SIMD:1" Condition="'$(WasmEnableSIMD)' != 'false'" /> <_MonoRollupEnvironmentVariable Include="WASM_ENABLE_SIMD:0" Condition="'$(WasmEnableSIMD)' == 'false'" /> diff --git a/src/mono/wasm/templates/Microsoft.NET.Runtime.WebAssembly.Templates.csproj b/src/mono/wasm/templates/Microsoft.NET.Runtime.WebAssembly.Templates.csproj index b68f1e14ff22d..83b97fb30c6f2 100644 --- a/src/mono/wasm/templates/Microsoft.NET.Runtime.WebAssembly.Templates.csproj +++ b/src/mono/wasm/templates/Microsoft.NET.Runtime.WebAssembly.Templates.csproj @@ -27,10 +27,5 @@ - - - $(ProductVersion) - - diff --git a/src/native/corehost/corehost.proj b/src/native/corehost/corehost.proj index 99a1bb9f5c5bb..ed13d5113b869 100644 --- a/src/native/corehost/corehost.proj +++ b/src/native/corehost/corehost.proj @@ -8,7 +8,7 @@ true - GetProductVersions;GenerateRuntimeVersionFile + GenerateRuntimeVersionFile $(BuildCoreHostDependsOn);InitializeSourceControlInformationFromSourceControlManager $(ArtifactsObjDir)$(OutputRID).$(Configuration)\ diff --git a/src/tasks/installer.tasks/GenerateChecksums.cs b/src/tasks/installer.tasks/GenerateChecksums.cs deleted file mode 100644 index f9e06415523b5..0000000000000 --- a/src/tasks/installer.tasks/GenerateChecksums.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.Build.Framework; -using System; -using System.IO; -using System.Security.Cryptography; - -namespace Microsoft.DotNet.Build.Tasks -{ - public class GenerateChecksums : BuildTask - { - /// - /// An item collection of files for which to generate checksums. Each item must have metadata - /// 'DestinationPath' that specifies the path of the checksum file to create. - /// - [Required] - public ITaskItem[] Items { get; set; } - - public override bool Execute() - { - foreach (ITaskItem item in Items) - { - try - { - string destinationPath = item.GetMetadata("DestinationPath"); - if (string.IsNullOrEmpty(destinationPath)) - { - throw new Exception($"Metadata 'DestinationPath' is missing for item '{item.ItemSpec}'."); - } - - if (!File.Exists(item.ItemSpec)) - { - throw new Exception($"The file '{item.ItemSpec}' does not exist."); - } - - Log.LogMessage( - MessageImportance.High, - "Generating checksum for '{0}' into '{1}'...", - item.ItemSpec, - destinationPath); - - using (FileStream stream = File.OpenRead(item.ItemSpec)) - { - using(HashAlgorithm hashAlgorithm = SHA512.Create()) - { - byte[] hash = hashAlgorithm.ComputeHash(stream); - string checksum = BitConverter.ToString(hash).Replace("-", string.Empty); - File.WriteAllText(destinationPath, checksum); - } - } - } - catch (Exception e) - { - // We have 2 log calls because we want a nice error message but we also want to capture the - // callstack in the log. - Log.LogError("An exception occurred while trying to generate a checksum for '{0}'.", item.ItemSpec); - Log.LogMessage(MessageImportance.Low, e.ToString()); - return false; - } - } - - return true; - } - } -}