Skip to content

Commit 6247e1f

Browse files
committed
Add support for multiple rids
1 parent b30d97a commit 6247e1f

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Make sure you [build the repo](#build-the-repo) from command line at least once.
3535

3636
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.*`.
3737

38-
By default it builds the cli native project for the current Runtime Identifier. A specific RID can be specified too by setting `$(TargetRid)`.
38+
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`.
3939

4040
Native build can be disabled with `$(BuildNative) = false`. And to only the native bits use `$(BuildNativeOnly) = true`.
4141

eng/Build.props

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
<Project>
1+
<Project TreatAsLocalProperty="TargetRids">
22
<PropertyGroup>
33
<_AspireOnlyBuild Condition="'$(DotNetBuildFromSource)' != 'true' and '$(DotNetBuild)' != 'true'">true</_AspireOnlyBuild>
44

55
<BuildNative>true</BuildNative>
66

77
<BuildRid>$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</BuildRid>
8-
<TargetRid Condition="'$(TargetRid)' == ''">$(BuildRid)</TargetRid>
8+
9+
<!-- this property is meant only for CI use. Use a colon separate list of RIDs here, like osx-x64:osx-arm64 .
10+
It is helpful to allow building the non-aot cli builds on a single CI job -->
11+
<TargetRids Condition="'$(TargetRids)' == ''">$(BuildRid)</TargetRids>
912
</PropertyGroup>
1013

1114
<ItemGroup Condition="'$(_AspireOnlyBuild)' == 'true' and '$(BuildNativeOnly)' != 'true'">
1215
<ProjectToBuild Include="$(RepoRoot)src\**\*.csproj" Exclude="$(RepoRoot)src\Aspire.ProjectTemplates\templates\**\*.csproj" />
1316
<ProjectToBuild Include="$(RepoRoot)eng\dcppack\**\*.csproj" />
1417
<ProjectToBuild Include="$(RepoRoot)eng\dashboardpack\**\*.csproj" />
1518

16-
<ProjectToBuild Condition="'$(BuildNative)' == 'true'" Include="$(RepoRoot)eng\clipack\Aspire.Cli.$(TargetRid).csproj" />
19+
<_TargetRidItem Include="$(TargetRids.Split(':'))" />
20+
<ProjectToBuild Condition="'$(BuildNative)' == 'true'" Include="@(_TargetRidItem -> '$(RepoRoot)eng\clipack\Aspire.Cli.%(Identity).csproj')" />
1721

1822
<ProjectToBuild Include="$(RepoRoot)playground\**\*.csproj" />
1923

@@ -27,7 +31,8 @@
2731
<ItemGroup Condition="'$(_AspireOnlyBuild)' == 'true' and '$(BuildNativeOnly)' == 'true'">
2832
<ProjectToBuild Include="$(RepoRoot)src\Aspire.Cli\Aspire.Cli.csproj" />
2933

30-
<ProjectToBuild Include="$(RepoRoot)eng\clipack\Aspire.Cli.$(TargetRid).csproj" />
34+
<_TargetRidItem Include="$(TargetRids.Split(':'))" />
35+
<ProjectToBuild Include="@(_TargetRidItem -> '$(RepoRoot)eng\clipack\Aspire.Cli.%(Identity).csproj')" />
3136
</ItemGroup>
3237

3338
<!-- When building from source, we want to use the live repo contents as opposed to cloning the repo. -->

eng/pipelines/azure-pipelines.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ extends:
134134
agentOs: linux
135135
targetRidsForSameOS:
136136
- linux-x64
137-
- linux-arm64
138-
- linux-musl-x64
139137
# no need to sign ELF binaries on linux
140138
codeSign: false
141139
teamName: $(_TeamName)
@@ -207,7 +205,7 @@ extends:
207205
inputs:
208206
targetType: 'inline'
209207
script: |
210-
Get-ChildItem -Path "$(Build.SourcesDirectory)\artifacts\packages" -File -Recurse | Select-Object -ExpandProperty FullName
208+
Get-ChildItem -Path "$(Build.SourcesDirectory)\artifacts\packages" -File -Recurse | Select-Object FullName, @{Name="Size(MB)";Expression={[math]::Round($_.Length/1MB,2)}} | Format-Table -AutoSize
211209
212210
- template: /eng/pipelines/templates/BuildAndTest.yml
213211
parameters:
@@ -218,6 +216,14 @@ extends:
218216
repoLogPath: $(Build.Arcade.LogsPath)
219217
repoTestResultsPath: $(Build.Arcade.TestResultsPath)
220218
isWindows: true
219+
targetRids:
220+
# aot
221+
- win-x64
222+
- win-arm64
223+
# non-aot - single file builds
224+
- win-x86
225+
- linux-arm64
226+
- linux-musl-x64
221227

222228
- ${{ if and(notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
223229
- template: /eng/common/templates-official/job/onelocbuild.yml@self

eng/pipelines/templates/BuildAndTest.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ parameters:
1616
type: string
1717
- name: dotnetScript
1818
type: string
19+
- name: targetRids
20+
type: object
1921
- name: runHelixTests
2022
type: boolean
2123
default: false
@@ -38,6 +40,7 @@ steps:
3840
/bl:${{ parameters.repoLogPath }}/build.binlog
3941
$(_OfficialBuildIdArgs)
4042
$(_InternalBuildArgs)
43+
/p:TargetRids=${{ join(':', parameters.targetRids) }}
4144
/p:SkipTestProjects=true
4245
displayName: 🟣Build
4346

eng/pipelines/templates/build_sign_native.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
--build
6868
--restore
6969
/p:BuildNativeOnly=true
70-
/p:TargetRid=${{ targetRid }}
70+
/p:TargetRids=${{ targetRid }}
7171
$(_buildArgs)
7272
${{ parameters.extraBuildArgs }}
7373
/bl:$(Build.Arcade.LogsPath)Build.binlog

0 commit comments

Comments
 (0)