From 82c6823eb7924b5964e01f00262bb1ca4b18cbaf Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 7 Jul 2025 20:42:37 -0400 Subject: [PATCH 01/14] Add support for native build with new properties, and restricting that to the host os and arch --- eng/Build.props | 22 +++++++- eng/Publishing.props | 98 +++++++++++++++++++++++++++++++++++- eng/Signing.props | 6 +++ eng/clipack/Common.projitems | 19 +++++-- 4 files changed, 137 insertions(+), 8 deletions(-) diff --git a/eng/Build.props b/eng/Build.props index 4f78cedd9a6..0b07149b20f 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -1,9 +1,20 @@ - + + <_AspireOnlyBuild Condition="'$(DotNetBuildFromSource)' != 'true' and '$(DotNetBuild)' != 'true'">true + + true + + $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) + $(BuildRid) + + + - + + + + + + + + + true diff --git a/eng/Publishing.props b/eng/Publishing.props index bab22932604..a8b00f93d50 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -23,7 +23,6 @@ <_InstallersToPublish Include="$(ArtifactsDir)**\*.wixpack.zip" Condition="'$(PostBuildSign)' == 'true'" /> <_InstallerManifestFilesToPublish Include="$(ArtifactsDir)VSSetup\$(Configuration)\Insertion\**\*.zip" /> <_DashboardFilesToPublish Include="$(DashboardPublishedArtifactsOutputDir)\**\*.zip" /> - <_CliFilesToPublish Include="$(ArtifactsShippingPackagesDir)\aspire-cli-*" /> @@ -39,6 +38,27 @@ + + <_ArchiveFiles Include="$(ArtifactsPackagesDir)\**\aspire-cli-*.zip" /> + <_ArchiveFiles Include="$(ArtifactsPackagesDir)\**\aspire-cli-*.tar.gz" /> + + <_CliPackProjects Include="$(RepoRoot)eng\clipack\Aspire.Cli.*.csproj" /> + <_ExpectedRuntimeIdentifiers Include="@(_CliPackProjects->'%(Filename)'->Replace('Aspire.Cli.', ''))" /> + + + + + + + <_CliFileToPublish Include="@(_ArchiveFiles)" /> + + + + + + <_CliFileToPublish Include="@(GenerateChecksumItems->'%(DestinationPath)')" /> + + true @@ -55,11 +75,85 @@ true $(_UploadPathRoot)/$(_PackageVersion)/%(Filename)%(Extension) - + false true $(_UploadPathRoot)/$(_PackageVersion)/%(Filename)%(Extension) + + + + + + + + + + + + Path.GetFileName(filepath)).ToArray(); + + var missingRids = new List(); + var matchedFiles = new HashSet(); + + foreach (var rid in ExpectedRuntimeIdentifiers) + { + // filenames are like aspire-cli-linux-musl-x64-9.4.0-dev.tar.gz + var pattern = $"aspire-cli-{rid}-"; + var matchingArchives = archiveFileNames + .Where(filename => filename.StartsWith(pattern, StringComparison.OrdinalIgnoreCase)) + .ToArray(); + + if (matchingArchives.Length == 0) + { + missingRids.Add(rid); + Log.LogMessage(MessageImportance.Low, $"Missing CLI files for runtime identifier: {rid}"); + } + else + { + foreach (var archive in matchingArchives) + { + matchedFiles.Add(archive); + } + Log.LogMessage(MessageImportance.Low, $"Found CLI files for {rid}: {string.Join(", ", matchingArchives)}"); + } + } + + // Find unexpected files - CLI archives that don't match any expected runtime identifier + var unexpectedFiles = archiveFileNames + .Where(filename => !matchedFiles.Contains(filename)) + .ToArray(); + + // Emit errors and warnings + if (unexpectedFiles.Length > 0) + { + Log.LogWarning($"Found unexpected CLI files: {string.Join(", ", unexpectedFiles)}"); + } + + if (missingRids.Count > 0) + { + Log.LogError($"Missing CLI archive(s) for runtime identifier(s): {string.Join(", ", missingRids)}. Found {string.Join(", ", matchedFiles)} ."); + } + + Success = !Log.HasLoggedErrors; + ]]> + + + diff --git a/eng/Signing.props b/eng/Signing.props index 6ad92ed9be0..31dc37bc66b 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -34,6 +34,10 @@ + + + + @@ -45,6 +49,8 @@ + + diff --git a/eng/clipack/Common.projitems b/eng/clipack/Common.projitems index 4480dc2f9e8..ecf43bd84c2 100644 --- a/eng/clipack/Common.projitems +++ b/eng/clipack/Common.projitems @@ -3,10 +3,11 @@ $(DefaultTargetFramework) aspire-cli-$(CliRuntime) - tar.gz - zip + zip + tar.gz - + true true true @@ -48,8 +49,18 @@ Properties="@(AdditionalProperties)" RemoveProperties="OutputPath;TargetFramework" /> + + <_ShouldCodeSignOnMacOS Condition="$([System.OperatingSystem]::IsMacOS()) and '$(Sign)' == 'true' and '$(DotNetSignType)' == 'real' and '$(PublishNativeAot)' == 'true'" /> + <_OutputBinaryPath>$(OutputPath)/aspire + + + + + + + - + From b96b8d8214d27c7e98c293b2f2198f0f2956f979 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 7 Jul 2025 20:43:14 -0400 Subject: [PATCH 02/14] Add support for native build on separate jobs, and then combining in the main Windows job, and publish the archives --- eng/pipelines/azure-pipelines.yml | 83 +++++++++++-------- eng/pipelines/templates/BuildAndTest.yml | 6 +- eng/pipelines/templates/build_sign_native.yml | 81 ++++++++++++++++++ 3 files changed, 133 insertions(+), 37 deletions(-) create mode 100644 eng/pipelines/templates/build_sign_native.yml diff --git a/eng/pipelines/azure-pipelines.yml b/eng/pipelines/azure-pipelines.yml index 5736a072273..ae3d52243ea 100644 --- a/eng/pipelines/azure-pipelines.yml +++ b/eng/pipelines/azure-pipelines.yml @@ -112,11 +112,45 @@ extends: stages: + - stage: build_sign_native + displayName: Build+Sign native packages + + jobs: + - template: /eng/pipelines/templates/build_sign_native.yml@self + parameters: + agentOs: macos + targetRidsForSameOS: + - osx-arm64 + - osx-x64 + codeSign: true + teamName: $(_TeamName) + extraBuildArgs: >- + /p:Configuration=$(_BuildConfig) + $(_SignArgs) + $(_OfficialBuildIdArgs) + + - template: /eng/pipelines/templates/build_sign_native.yml@self + parameters: + agentOs: linux + targetRidsForSameOS: + - linux-x64 + - linux-arm64 + - linux-musl-x64 + # no need to sign ELF binaries on linux + codeSign: false + teamName: $(_TeamName) + extraBuildArgs: >- + /p:Configuration=$(_BuildConfig) + $(_SignArgs) + $(_OfficialBuildIdArgs) + # ---------------------------------------------------------------- # This stage performs build, test, packaging # ---------------------------------------------------------------- - stage: build displayName: Build + dependsOn: + - build_sign_native jobs: - template: /eng/common/templates-official/jobs/jobs.yml@self parameters: @@ -160,6 +194,21 @@ extends: clean: true steps: + - task: DownloadPipelineArtifact@2 + displayName: 🟣Download All Native Archives + inputs: + itemPattern: | + **/aspire-cli-*.zip + **/aspire-cli-*.tar.gz + targetPath: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)' + + - task: PowerShell@2 + displayName: 🟣List artifacts packages contents + inputs: + targetType: 'inline' + script: | + Get-ChildItem -Path "$(Build.SourcesDirectory)\artifacts\packages" -File -Recurse | Select-Object -ExpandProperty FullName + - template: /eng/pipelines/templates/BuildAndTest.yml parameters: dotnetScript: $(Build.SourcesDirectory)/dotnet.cmd @@ -170,40 +219,6 @@ extends: repoTestResultsPath: $(Build.Arcade.TestResultsPath) isWindows: true - - ${{ if eq(variables._RunAsPublic, True) }}: - - job: Linux - ${{ if or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/'), eq(variables['Build.Reason'], 'Manual')) }}: - # If the build is getting signed, then the timeout should be increased. - timeoutInMinutes: 120 - ${{ else }}: - # timeout accounts for wait times for helix agents up to 30mins - timeoutInMinutes: 90 - - pool: - name: NetCore1ESPool-Internal - image: 1es-mariner-2 - os: linux - - variables: - - name: _buildScript - value: $(Build.SourcesDirectory)/build.sh --ci - - preSteps: - - checkout: self - fetchDepth: 1 - clean: true - - steps: - - template: /eng/pipelines/templates/BuildAndTest.yml - parameters: - dotnetScript: $(Build.SourcesDirectory)/dotnet.sh - buildScript: $(_buildScript) - buildConfig: $(_BuildConfig) - repoArtifactsPath: $(Build.Arcade.ArtifactsPath) - repoLogPath: $(Build.Arcade.LogsPath) - repoTestResultsPath: $(Build.Arcade.TestResultsPath) - isWindows: false - - ${{ if and(notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}: - template: /eng/common/templates-official/job/onelocbuild.yml@self parameters: diff --git a/eng/pipelines/templates/BuildAndTest.yml b/eng/pipelines/templates/BuildAndTest.yml index 225c5af136f..45748aba0ce 100644 --- a/eng/pipelines/templates/BuildAndTest.yml +++ b/eng/pipelines/templates/BuildAndTest.yml @@ -39,13 +39,13 @@ steps: $(_OfficialBuildIdArgs) $(_InternalBuildArgs) /p:SkipTestProjects=true - displayName: Build + displayName: 🟣Build - script: ${{ parameters.dotnetScript }} build tests/workloads.proj /p:SkipPackageCheckForTemplatesTesting=true - displayName: Prepare sdks for templates testing + displayName: 🟣Prepare sdks for templates testing - script: ${{ parameters.buildScript }} -build @@ -63,7 +63,7 @@ steps: DEV_TEMP: $(Build.SourcesDirectory)\.. DOTNET_ROOT: $(Build.SourcesDirectory)\.dotnet TEST_LOG_PATH: $(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\Aspire.Templates.Tests - displayName: Run Template tests + displayName: 🟣Run Template tests # Public pipeline - helix tests - ${{ if eq(parameters.runAsPublic, 'true') }}: diff --git a/eng/pipelines/templates/build_sign_native.yml b/eng/pipelines/templates/build_sign_native.yml new file mode 100644 index 00000000000..eec9f600353 --- /dev/null +++ b/eng/pipelines/templates/build_sign_native.yml @@ -0,0 +1,81 @@ +parameters: + # values: windows/mac/linux + agentOs: 'windows' + targetRidsForSameOS: + - win_x64 + extraBuildArgs: '' + codeSign: false + teamName: '' + +jobs: + +- ${{ each targetRid in parameters.targetRidsForSameOS }}: + - template: /eng/common/templates-official/jobs/jobs.yml@self + parameters: + enableMicrobuild: ${{ eq(parameters.codeSign, true) }} + enableMicrobuildForMacAndLinux: ${{ and(eq(parameters.codeSign, true), ne(parameters.agentOs, 'windows')) }} + enableTelemetry: true + # Publish build logs + enablePublishBuildArtifacts: true + + jobs: + - job: BuildNative_${{ replace(targetRid, '-', '_') }} + displayName: ${{ replace(targetRid, '-', '_') }} + timeoutInMinutes: 40 + + variables: + - TeamName: ${{ parameters.teamName }} + - ${{ if eq(parameters.codeSign, true) }}: + - _buildArgs: '--sign' + - ${{ else }}: + - _buildArgs: '' + + - ${{ if eq(parameters.agentOs, 'windows') }}: + - scriptName: build.cmd + - ${{ else }}: + - scriptName: build.sh + + pool: + ${{ if eq(parameters.agentOs, 'windows') }}: + name: NetCore1ESPool-Internal + image: windows.vs2022preview.amd64 + os: windows + ${{ if eq(parameters.agentOs, 'linux') }}: + name: NetCore1ESPool-Internal + image: 1es-mariner-2 + os: linux + ${{ if eq(parameters.agentOs, 'macos') }}: + name: Azure Pipelines + vmImage: macOS-latest-internal + os: macOS + + preSteps: + - checkout: self + fetchDepth: 1 + clean: true + + # Installing Microbuild plugin fails due to https://github.com/dotnet/arcade/issues/15946 + # because of the preview sdk. To fix that `restore` from `global.json` so the above step + # does not have to install anything. + - script: $(Build.SourcesDirectory)/$(scriptName) -restore + displayName: 🟣Restore + + steps: + - script: >- + $(Build.SourcesDirectory)/$(scriptName) + --ci + --build + --restore + /p:BuildNativeOnly=true + /p:TargetRid=${{ targetRid }} + $(_buildArgs) + ${{ parameters.extraBuildArgs }} + /bl:$(Build.Arcade.LogsPath)Build.binlog + displayName: 🟣Build native packages + + - task: 1ES.PublishBuildArtifacts@1 + displayName: 🟣Publish Artifacts + condition: always() + inputs: + PathtoPublish: '$(Build.Arcade.ArtifactsPath)packages/' + ArtifactName: native_archives_${{ replace(targetRid, '-', '_') }} From b30d97a7c35dd848afb0b6f2b7c369b665b634f5 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 7 Jul 2025 20:43:29 -0400 Subject: [PATCH 03/14] add documentation --- docs/contributing.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/contributing.md b/docs/contributing.md index c845a9c9ab5..ec308bbb3a2 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -31,6 +31,14 @@ Or, if you are using Visual Studio: Make sure you [build the repo](#build-the-repo) from command line at least once. Then use `./start-code.sh` (macOS and Linux) or `.\start-code.cmd` to start VS Code. +## Native build + +The default build includes native builds for `Aspire.Cli` which produces Native AOT binaries for some platforms. These projects are in `eng/clipack/Aspire.Cli.*`. + +By default it builds the cli native project for the current Runtime Identifier. A specific RID can be specified too by setting `$(TargetRid)`. + +Native build can be disabled with `$(BuildNative) = false`. And to only the native bits use `$(BuildNativeOnly) = true`. + ## View Dashboard When you start the sample app in Visual Studio, it will automatically open your browser to show the dashboard. From 6247e1f335e38f094328dc1c2ee2becbd6f0d5b3 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Mon, 7 Jul 2025 21:40:25 -0400 Subject: [PATCH 04/14] Add support for multiple rids --- docs/contributing.md | 2 +- eng/Build.props | 13 +++++++++---- eng/pipelines/azure-pipelines.yml | 12 +++++++++--- eng/pipelines/templates/BuildAndTest.yml | 3 +++ eng/pipelines/templates/build_sign_native.yml | 2 +- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index ec308bbb3a2..de528f1e405 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -35,7 +35,7 @@ Make sure you [build the repo](#build-the-repo) from command line at least once. The default build includes native builds for `Aspire.Cli` which produces Native AOT binaries for some platforms. These projects are in `eng/clipack/Aspire.Cli.*`. -By default it builds the cli native project for the current Runtime Identifier. A specific RID can be specified too by setting `$(TargetRid)`. +By default it builds the cli native project for the current Runtime Identifier. A specific RIDs can be specified too by setting `$(TargetRids)` to a colon separated list like `$(TargetRids) = osx-x64:osx-arm64`. Native build can be disabled with `$(BuildNative) = false`. And to only the native bits use `$(BuildNativeOnly) = true`. diff --git a/eng/Build.props b/eng/Build.props index 0b07149b20f..1036266bcb7 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -1,11 +1,14 @@ - + <_AspireOnlyBuild Condition="'$(DotNetBuildFromSource)' != 'true' and '$(DotNetBuild)' != 'true'">true true $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) - $(BuildRid) + + + $(BuildRid) @@ -13,7 +16,8 @@ - + <_TargetRidItem Include="$(TargetRids.Split(':'))" /> + @@ -27,7 +31,8 @@ - + <_TargetRidItem Include="$(TargetRids.Split(':'))" /> + diff --git a/eng/pipelines/azure-pipelines.yml b/eng/pipelines/azure-pipelines.yml index ae3d52243ea..49b4710f057 100644 --- a/eng/pipelines/azure-pipelines.yml +++ b/eng/pipelines/azure-pipelines.yml @@ -134,8 +134,6 @@ extends: agentOs: linux targetRidsForSameOS: - linux-x64 - - linux-arm64 - - linux-musl-x64 # no need to sign ELF binaries on linux codeSign: false teamName: $(_TeamName) @@ -207,7 +205,7 @@ extends: inputs: targetType: 'inline' script: | - Get-ChildItem -Path "$(Build.SourcesDirectory)\artifacts\packages" -File -Recurse | Select-Object -ExpandProperty FullName + Get-ChildItem -Path "$(Build.SourcesDirectory)\artifacts\packages" -File -Recurse | Select-Object FullName, @{Name="Size(MB)";Expression={[math]::Round($_.Length/1MB,2)}} | Format-Table -AutoSize - template: /eng/pipelines/templates/BuildAndTest.yml parameters: @@ -218,6 +216,14 @@ extends: repoLogPath: $(Build.Arcade.LogsPath) repoTestResultsPath: $(Build.Arcade.TestResultsPath) isWindows: true + targetRids: + # aot + - win-x64 + - win-arm64 + # non-aot - single file builds + - win-x86 + - linux-arm64 + - linux-musl-x64 - ${{ if and(notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}: - template: /eng/common/templates-official/job/onelocbuild.yml@self diff --git a/eng/pipelines/templates/BuildAndTest.yml b/eng/pipelines/templates/BuildAndTest.yml index 45748aba0ce..0b412d44544 100644 --- a/eng/pipelines/templates/BuildAndTest.yml +++ b/eng/pipelines/templates/BuildAndTest.yml @@ -16,6 +16,8 @@ parameters: type: string - name: dotnetScript type: string + - name: targetRids + type: object - name: runHelixTests type: boolean default: false @@ -38,6 +40,7 @@ steps: /bl:${{ parameters.repoLogPath }}/build.binlog $(_OfficialBuildIdArgs) $(_InternalBuildArgs) + /p:TargetRids=${{ join(':', parameters.targetRids) }} /p:SkipTestProjects=true displayName: 🟣Build diff --git a/eng/pipelines/templates/build_sign_native.yml b/eng/pipelines/templates/build_sign_native.yml index eec9f600353..937eeb0a1f0 100644 --- a/eng/pipelines/templates/build_sign_native.yml +++ b/eng/pipelines/templates/build_sign_native.yml @@ -67,7 +67,7 @@ jobs: --build --restore /p:BuildNativeOnly=true - /p:TargetRid=${{ targetRid }} + /p:TargetRids=${{ targetRid }} $(_buildArgs) ${{ parameters.extraBuildArgs }} /bl:$(Build.Arcade.LogsPath)Build.binlog From 729e7f2e3fc97b2cbd0dd73d0b604f45d4779f33 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 8 Jul 2025 16:36:04 -0400 Subject: [PATCH 05/14] Address review feedback from @ eerhardt - drop the manual codesigning. Arcade signing with MacDeveloperHardenWithNotarization is enough --- eng/clipack/Common.projitems | 6 ------ 1 file changed, 6 deletions(-) diff --git a/eng/clipack/Common.projitems b/eng/clipack/Common.projitems index ecf43bd84c2..a9a1085952d 100644 --- a/eng/clipack/Common.projitems +++ b/eng/clipack/Common.projitems @@ -50,15 +50,9 @@ RemoveProperties="OutputPath;TargetFramework" /> - <_ShouldCodeSignOnMacOS Condition="$([System.OperatingSystem]::IsMacOS()) and '$(Sign)' == 'true' and '$(DotNetSignType)' == 'real' and '$(PublishNativeAot)' == 'true'" /> <_OutputBinaryPath>$(OutputPath)/aspire - - - - - From 6c635a5eca2a375ce563fd5fdcde4e35478ec982 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 8 Jul 2025 16:59:39 -0400 Subject: [PATCH 06/14] update comment --- eng/pipelines/templates/build_sign_native.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/build_sign_native.yml b/eng/pipelines/templates/build_sign_native.yml index 937eeb0a1f0..8e3c24d599d 100644 --- a/eng/pipelines/templates/build_sign_native.yml +++ b/eng/pipelines/templates/build_sign_native.yml @@ -54,7 +54,7 @@ jobs: fetchDepth: 1 clean: true - # Installing Microbuild plugin fails due to https://github.com/dotnet/arcade/issues/15946 + # Installing Microbuild plugin fails due to https://github.com/dotnet/arcade/issues/15946#issuecomment-3045780552 # because of the preview sdk. To fix that `restore` from `global.json` so the above step # does not have to install anything. - script: $(Build.SourcesDirectory)/$(scriptName) -restore From fe483344a1720312aeffa057f923fe81c8869bd0 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 8 Jul 2025 17:15:00 -0400 Subject: [PATCH 07/14] Fix public pipeline build --- eng/pipelines/templates/BuildAndTest.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/templates/BuildAndTest.yml b/eng/pipelines/templates/BuildAndTest.yml index 0b412d44544..2ba3dfaaa87 100644 --- a/eng/pipelines/templates/BuildAndTest.yml +++ b/eng/pipelines/templates/BuildAndTest.yml @@ -18,6 +18,7 @@ parameters: type: string - name: targetRids type: object + default: '' - name: runHelixTests type: boolean default: false From dc535d2701215c7e6b9fbe79f11dd99ab5b8d812 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 8 Jul 2025 20:13:22 -0400 Subject: [PATCH 08/14] Address review feedback from @ eerhardt --- eng/Build.props | 2 +- eng/pipelines/templates/build_sign_native.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Build.props b/eng/Build.props index 1036266bcb7..963c1d013aa 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -6,7 +6,7 @@ $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) - $(BuildRid) diff --git a/eng/pipelines/templates/build_sign_native.yml b/eng/pipelines/templates/build_sign_native.yml index 8e3c24d599d..802e87666f8 100644 --- a/eng/pipelines/templates/build_sign_native.yml +++ b/eng/pipelines/templates/build_sign_native.yml @@ -2,7 +2,7 @@ parameters: # values: windows/mac/linux agentOs: 'windows' targetRidsForSameOS: - - win_x64 + - linux-x64 extraBuildArgs: '' codeSign: false teamName: '' From ef3b8557139eb4f753bf54261d14a2ef99e50fe6 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 8 Jul 2025 20:14:21 -0400 Subject: [PATCH 09/14] Update eng/clipack/Common.projitems Co-authored-by: Eric Erhardt --- eng/clipack/Common.projitems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/clipack/Common.projitems b/eng/clipack/Common.projitems index a9a1085952d..00213ed3fc7 100644 --- a/eng/clipack/Common.projitems +++ b/eng/clipack/Common.projitems @@ -54,7 +54,7 @@ - + From 01d77203745b35c9f2ceed5cd0ae468096195a9f Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 8 Jul 2025 20:41:11 -0400 Subject: [PATCH 10/14] Address review feedback from @ joperezr --- docs/contributing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index de528f1e405..6e76f2dfc3a 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -35,9 +35,9 @@ Make sure you [build the repo](#build-the-repo) from command line at least once. The default build includes native builds for `Aspire.Cli` which produces Native AOT binaries for some platforms. These projects are in `eng/clipack/Aspire.Cli.*`. -By default it builds the cli native project for the current Runtime Identifier. A specific RIDs can be specified too by setting `$(TargetRids)` to a colon separated list like `$(TargetRids) = osx-x64:osx-arm64`. +By default it builds the cli native project for the current Runtime Identifier. A specific RIDs can be specified too by setting `$(TargetRids)` to a colon separated list like `/p:TargetRids=osx-x64:osx-arm64`. -Native build can be disabled with `$(BuildNative) = false`. And to only the native bits use `$(BuildNativeOnly) = true`. +Native build can be disabled with `/p:BuildNative=false`. And to only the native bits use `/p:BuildNativeOnly=true`. ## View Dashboard From bfbb8a3ae2e74dbc9d779ff3e6fb3ba4baf69eaf Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 8 Jul 2025 20:50:29 -0400 Subject: [PATCH 11/14] Address review feedback from @ joperezr - invert BuildNative property, and simplify --- docs/contributing.md | 2 +- eng/Build.props | 18 ++++++++---------- eng/pipelines/templates/build_sign_native.yml | 4 ++-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index 6e76f2dfc3a..c19be318a76 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -37,7 +37,7 @@ The default build includes native builds for `Aspire.Cli` which produces Native By default it builds the cli native project for the current Runtime Identifier. A specific RIDs can be specified too by setting `$(TargetRids)` to a colon separated list like `/p:TargetRids=osx-x64:osx-arm64`. -Native build can be disabled with `/p:BuildNative=false`. And to only the native bits use `/p:BuildNativeOnly=true`. +Native build can be disabled with `/p:SkipNativeBuild=true`. And to only the native bits use `/p:SkipManagedBuild=true`. ## View Dashboard diff --git a/eng/Build.props b/eng/Build.props index 963c1d013aa..54e7713b11d 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -1,24 +1,19 @@ - <_AspireOnlyBuild Condition="'$(DotNetBuildFromSource)' != 'true' and '$(DotNetBuild)' != 'true'">true - - true - $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) $(BuildRid) + false + false - + - <_TargetRidItem Include="$(TargetRids.Split(':'))" /> - - - - + + + <_TargetRidItem Include="$(TargetRids.Split(':'))" /> diff --git a/eng/pipelines/templates/build_sign_native.yml b/eng/pipelines/templates/build_sign_native.yml index 802e87666f8..e55bd6b4007 100644 --- a/eng/pipelines/templates/build_sign_native.yml +++ b/eng/pipelines/templates/build_sign_native.yml @@ -57,7 +57,7 @@ jobs: # Installing Microbuild plugin fails due to https://github.com/dotnet/arcade/issues/15946#issuecomment-3045780552 # because of the preview sdk. To fix that `restore` from `global.json` so the above step # does not have to install anything. - - script: $(Build.SourcesDirectory)/$(scriptName) -restore + - script: $(Build.SourcesDirectory)/$(scriptName) -restore /p:Configuration=$(_BuildConfig) displayName: 🟣Restore steps: @@ -66,7 +66,7 @@ jobs: --ci --build --restore - /p:BuildNativeOnly=true + /p:SkipManagedBuild=true /p:TargetRids=${{ targetRid }} $(_buildArgs) ${{ parameters.extraBuildArgs }} From 12bc1072c5ddb4a1fdd92edff5332395ffc765aa Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 10 Jul 2025 16:40:47 -0400 Subject: [PATCH 12/14] Address review feedback from @ joperezr --- eng/Build.props | 2 -- 1 file changed, 2 deletions(-) diff --git a/eng/Build.props b/eng/Build.props index 54e7713b11d..8ae75401ff1 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -5,8 +5,6 @@ $(BuildRid) - false - false From 271c0aa92a72dada67bd069e921484986b3cb811 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 10 Jul 2025 16:48:18 -0400 Subject: [PATCH 13/14] Address review feedback from @ joperezr --- eng/Build.props | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eng/Build.props b/eng/Build.props index 8ae75401ff1..dddc4194a9a 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -27,8 +27,11 @@ instead of a ProjectReference --> + <_TargetRidItem Include="$(TargetRids.Split(':'))" /> - + <_NativeProjectToBuild Include="@(_TargetRidItem -> '$(RepoRoot)eng\clipack\Aspire.Cli.%(Identity).csproj')" /> + From d6dab112bc2edc07e21cadc5d01f2c0293fc3fe7 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 10 Jul 2025 17:27:24 -0400 Subject: [PATCH 14/14] Address review feedback from @ joperezr and replace the inline task with msbuild logic to validate the list of packages --- eng/Publishing.props | 103 ++++++++----------------------------------- 1 file changed, 19 insertions(+), 84 deletions(-) diff --git a/eng/Publishing.props b/eng/Publishing.props index a8b00f93d50..4427480789f 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -26,6 +26,25 @@ + + + <_ArchiveFiles Include="$(ArtifactsPackagesDir)\**\aspire-cli-*.zip" /> + <_ArchiveFiles Include="$(ArtifactsPackagesDir)\**\aspire-cli-*.tar.gz" /> + + <_CliPackProjects Include="$(RepoRoot)eng\clipack\Aspire.Cli.*.csproj" /> + <_ExpectedRids Include="@(_CliPackProjects->'%(Filename)'->Replace('Aspire.Cli.', ''))" /> + + + <_FoundRidInCliArchiveFile Include="$([System.Text.RegularExpressions.Regex]::Match(%(_ArchiveFiles.FileName), 'aspire-cli-(.*)-\d+.*').Groups[1].Value)" /> + + <_MissingRids Include="@(_ExpectedRids)" Exclude="@(_FoundRidInCliArchiveFile)" /> + <_UnexpectedRids Include="@(_FoundRidInCliArchiveFile)" Exclude="@(_ExpectedRids)" /> + + + + + <_CliFileToPublish Include="@(_ArchiveFiles)" /> @@ -82,78 +91,4 @@ - - - - - - - - - - - - Path.GetFileName(filepath)).ToArray(); - - var missingRids = new List(); - var matchedFiles = new HashSet(); - - foreach (var rid in ExpectedRuntimeIdentifiers) - { - // filenames are like aspire-cli-linux-musl-x64-9.4.0-dev.tar.gz - var pattern = $"aspire-cli-{rid}-"; - var matchingArchives = archiveFileNames - .Where(filename => filename.StartsWith(pattern, StringComparison.OrdinalIgnoreCase)) - .ToArray(); - - if (matchingArchives.Length == 0) - { - missingRids.Add(rid); - Log.LogMessage(MessageImportance.Low, $"Missing CLI files for runtime identifier: {rid}"); - } - else - { - foreach (var archive in matchingArchives) - { - matchedFiles.Add(archive); - } - Log.LogMessage(MessageImportance.Low, $"Found CLI files for {rid}: {string.Join(", ", matchingArchives)}"); - } - } - - // Find unexpected files - CLI archives that don't match any expected runtime identifier - var unexpectedFiles = archiveFileNames - .Where(filename => !matchedFiles.Contains(filename)) - .ToArray(); - - // Emit errors and warnings - if (unexpectedFiles.Length > 0) - { - Log.LogWarning($"Found unexpected CLI files: {string.Join(", ", unexpectedFiles)}"); - } - - if (missingRids.Count > 0) - { - Log.LogError($"Missing CLI archive(s) for runtime identifier(s): {string.Join(", ", missingRids)}. Found {string.Join(", ", matchedFiles)} ."); - } - - Success = !Log.HasLoggedErrors; - ]]> - - -