Stop using OverrideTargetRid, use TargetOS/TargetArchitecture instead (#18476)

This commit is contained in:
Jo Shields 2024-02-02 01:13:03 -05:00 committed by GitHub
parent 238c141487
commit cca2b7bede
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 68 additions and 94 deletions

View file

@ -65,7 +65,15 @@ parameters:
type: string
default: ''
- name: targetRid
- name: runTests
type: boolean
default: false
- name: targetOS
type: string
default: ''
- name: targetArchitecture
type: string
default: ''
@ -247,20 +255,20 @@ jobs:
useDocker=true
fi
if [[ ! -z '${{ parameters.targetRid }}' ]]; then
extraBuildProperties="--"
if [[ '${{ parameters.useMonoRuntime }}' == 'True' ]]; then
customEnvVars="$customEnvVars CROSSCOMPILE=1"
fi
extraBuildProperties="$extraBuildProperties /p:PortableBuild=true /p:DotNetBuildVertical=true /p:CrossBuild=true"
if [[ '${{ parameters.useMonoRuntime }}' == 'True' ]]; then
customEnvVars="$customEnvVars CROSSCOMPILE=1"
fi
if [[ ! -z '${{ parameters.crossRootFs }}' ]]; then
customEnvVars="$customEnvVars ROOTFS_DIR=${{ parameters.crossRootFs}}"
fi
if [[ ! -z '${{ parameters.targetRid }}' ]]; then
extraBuildProperties="$extraBuildProperties /p:OverrideTargetRid=${{ parameters.targetRid }}"
if [[ ! -z '${{ parameters.targetOS }}' ]]; then
extraBuildProperties="$extraBuildProperties /p:TargetOS=${{ parameters.targetOS }}"
fi
if [[ ! -z '${{ parameters.targetArchitecture }}' ]]; then
extraBuildProperties="$extraBuildProperties /p:TargetArchitecture=${{ parameters.targetArchitecture }}"
fi
# Only use Docker stuff on Linux
@ -286,7 +294,7 @@ jobs:
displayName: Build
# Don't run tests if overriding RID, we don't support that for now
- ${{ if eq(parameters.targetRid, '') }}:
- ${{ if eq(parameters.runTests, 'True') }}:
- script: |
set -x

View file

@ -85,6 +85,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: true # ✅
runOnline: true # ✅
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: false # 🚫
@ -105,6 +106,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: true # ✅
runOnline: true # ✅
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: false # 🚫
reuseBuildArtifactsFrom: CentOSStream8_Online_MsftSdk
@ -125,6 +127,7 @@ stages:
enablePoison: true # ✅
excludeOmniSharpTests: true # ✅
runOnline: false # 🚫
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: true # ✅
@ -145,6 +148,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: true # ✅
runOnline: true # ✅
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: false # 🚫
@ -163,6 +167,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: true # ✅
runOnline: false # 🚫
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: false # 🚫
@ -182,6 +187,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: true # ✅
runOnline: true # ✅
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: true # ✅
@ -201,6 +207,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: true # ✅
runOnline: false # 🚫
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: true # ✅
@ -219,6 +226,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: true # ✅
runOnline: false # 🚫
runTests: true # ✅
useMonoRuntime: true # ✅
withPreviousSDK: false # 🚫
@ -237,6 +245,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: false # 🚫
runOnline: false # 🚫
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: false # 🚫
@ -255,6 +264,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: false # 🚫
runOnline: false # 🚫
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: false # 🚫
@ -273,6 +283,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: false # 🚫
runOnline: false # 🚫
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: false # 🚫
@ -289,6 +300,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: false # 🚫
runOnline: false # 🚫
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: false # 🚫
@ -307,6 +319,7 @@ stages:
enablePoison: false # 🚫
excludeOmniSharpTests: false # 🚫
runOnline: false # 🚫
runTests: true # ✅
useMonoRuntime: false # 🚫
withPreviousSDK: false # 🚫
reuseBuildArtifactsFrom: Fedora39_Offline_MsftSdk

View file

@ -88,7 +88,9 @@ stages:
useMonoRuntime: true # ✅
withPreviousSDK: false # 🚫
crossRootFs: '/crossrootfs/x64' # 📝
targetRid: 'linux-x64' # 📝
runTests: false # 🚫
targetOS: 'linux' # 📝
targetArchitecture: 'x64' # 📝
- template: ../jobs/vmr-build.yml
parameters:
@ -108,7 +110,9 @@ stages:
useMonoRuntime: true # ✅
withPreviousSDK: false # 🚫
crossRootFs: '/crossrootfs/arm64' # 📝
targetRid: 'linux-arm64' # 📝
runTests: false # 🚫
targetOS: 'linux' # 📝
targetArchitecture: 'arm64' # 📝
- template: ../jobs/vmr-build.yml
parameters:
@ -126,7 +130,9 @@ stages:
runOnline: true # ✅
useMonoRuntime: true # ✅
withPreviousSDK: false # 🚫
targetRid: 'osx-x64' # 📝
runTests: false # 🚫
targetOS: 'osx' # 📝
targetArchitecture: 'x64' # 📝
- template: ../jobs/vmr-build.yml
parameters:
@ -144,7 +150,9 @@ stages:
runOnline: true # ✅
useMonoRuntime: true # ✅
withPreviousSDK: false # 🚫
targetRid: 'osx-arm64' # 📝
runTests: false # 🚫
targetOS: 'osx' # 📝
targetArchitecture: 'arm64' # 📝
- template: ../jobs/vmr-build.yml
parameters:
@ -164,4 +172,6 @@ stages:
useMonoRuntime: false # 🚫
withPreviousSDK: false # 🚫
crossRootFs: '/crossrootfs/arm64' # 📝
targetRid: 'linux-arm64' # 📝
runTests: false # 🚫
targetOS: 'linux' # 📝
targetArchitecture: 'arm64' # 📝

View file

@ -24,17 +24,7 @@
<HostArchitecture Condition="'$(HostArchitecture)' == ''">$(BuildArchitecture)</HostArchitecture>
<!-- When building on non-x64 architectures, there may be no cross-compilation available, select a target architecture that is the same as the build. -->
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(BuildArchitecture)' == 'arm'">arm</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(BuildArchitecture)' == 'armv6'">armv6</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(BuildArchitecture)' == 'armel'">armel</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(BuildArchitecture)' == 'arm64'">arm64</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(BuildArchitecture)' == 'riscv64'">riscv64</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(BuildArchitecture)' == 'loongarch64'">loongarch64</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(BuildArchitecture)' == 's390x'">s390x</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(BuildArchitecture)' == 'ppc64le'">ppc64le</TargetArchitecture>
<TargetArchitecture Condition="'$(OverrideTargetRid)' != ''">$(OverrideTargetRid.Substring($(OverrideTargetRid.LastIndexOf('-'))).TrimStart('-'))</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">$(BuildArchitecture)</TargetArchitecture>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
</PropertyGroup>
@ -49,6 +39,7 @@
<!-- Source-only builds are non portable. -->
<PortableBuild Condition="'$(PortableBuild)' == '' and '$(DotNetBuildSourceOnly)' != 'true'">true</PortableBuild>
<PortableBuild Condition="'$(PortableBuild)' == ''">false</PortableBuild>
<PortableRid Condition="'$(__PortableTargetOS)' != ''">$(__PortableTargetOS)-$(TargetArchitecture)</PortableRid>
<PortableRid Condition="'$(PortableRid)' == '' and '$(TargetOS)' == 'freebsd'">freebsd-$(TargetArchitecture)</PortableRid>

View file

@ -82,12 +82,6 @@
<AspNetRazorBuildServerLogFile>$(AspNetRazorBuildServerLogDir)razor-build-server.log</AspNetRazorBuildServerLogFile>
</PropertyGroup>
<!-- Cross-build property setting from OverrideTargetRid -->
<PropertyGroup Condition="'$(OverrideTargetRid)' != ''">
<OverrideTargetOS>$(OverrideTargetRid.Substring(0, $(OverrideTargetRid.LastIndexOf('-'))))</OverrideTargetOS>
<OverrideTargetArch>$(OverrideTargetRid.Substring($(OverrideTargetRid.LastIndexOf('-'))).TrimStart('-'))</OverrideTargetArch>
</PropertyGroup>
<ItemGroup>
<!-- Arcade tools.sh picks up DotNetCoreSdkDir, but we can pass DOTNET_INSTALL_DIR directly. -->
<EnvironmentVariables Include="DOTNET_INSTALL_DIR=$(DotNetRoot)" />

View file

@ -9,8 +9,7 @@
<!-- On Windows, build all for the VB PoC -->
<BuildActions Condition="'$(DotNetBuildSourceOnly)' != 'true' and '$(BuildOS)' == 'windows'">$(FlagParameterPrefix)restore $(FlagParameterPrefix)all $(FlagParameterPrefix)pack</BuildActions>
<BuildArgs Condition="'$(OverrideTargetArch)' == ''">$(BuildArgs) $(FlagParameterPrefix)arch $(TargetArchitecture)</BuildArgs>
<BuildArgs Condition="'$(OverrideTargetArch)' != ''">$(BuildArgs) $(FlagParameterPrefix)arch $(OverrideTargetArch)</BuildArgs>
<BuildArgs>$(BuildArgs) $(FlagParameterPrefix)arch $(TargetArchitecture)</BuildArgs>
<BuildArgs Condition="'$(DotNetBuildSourceOnly)' == 'true' or '$(BuildOS)' != 'windows'">$(BuildArgs) $(FlagParameterPrefix)no-build-repo-tasks</BuildArgs>
<BuildArgs Condition="'$(DotNetBuildSourceOnly)' == 'true' or '$(BuildOS)' != 'windows'">$(BuildArgs) $(FlagParameterPrefix)no-build-nodejs</BuildArgs>
@ -18,15 +17,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'osx'">osx-$(TargetArchitecture)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'freebsd'">freebsd-$(TargetArchitecture)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'windows'">win-$(TargetArchitecture)</OverrideTargetRid>
<_portableRidOverridden Condition="'$(TargetRid)' != '$(OverrideTargetRid)'">true</_portableRidOverridden>
<_portableRidOverridden Condition="'$(TargetRid)' == '$(OverrideTargetRid)'">false</_portableRidOverridden>
<BuildArgs>$(BuildArgs) /p:PortableBuild=$(_portableRidOverridden)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:TargetRuntimeIdentifier=$(OverrideTargetRid)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:PortableBuild=$(PortableBuild)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:TargetRuntimeIdentifier=$(TargetRid)</BuildArgs>
</PropertyGroup>
<ItemGroup>

View file

@ -1,19 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'osx'">osx-$(TargetArchitecture)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'freebsd'">freebsd-$(TargetArchitecture)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'windows'">win-$(TargetArchitecture)</OverrideTargetRid>
<_platformIndex>$(OverrideTargetRid.LastIndexOf('-'))</_platformIndex>
<TargetOS>$(OverrideTargetRid.Substring(0, $(_platformIndex)))</TargetOS>
<TargetArch>$(OverrideTargetRid.Substring($(_platformIndex)))</TargetArch>
<!-- Use the repo root build script -->
<BuildScript>$(ProjectDirectory)build$(ShellExtension)</BuildScript>
<BuildArgs>$(BuildArgs) /p:PackageRid=$(OverrideTargetRid)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:PackageRid=$(TargetRid)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:AssetManifestOS=$(TargetOS)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:PlatformName=$(TargetArch)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:ForceBuildManifestOnly=true</BuildArgs>

View file

@ -1,15 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'osx'">osx-$(TargetArchitecture)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'freebsd'">freebsd-$(TargetArchitecture)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'windows'">win-$(TargetArchitecture)</OverrideTargetRid>
<OSNameOverride>$(OverrideTargetRid.Substring(0, $(OverrideTargetRid.IndexOf("-"))))</OSNameOverride>
<!-- Determine target portable rid based on bootstrap SDK's portable rid -->
<_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
<PortableOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))</PortableOS>
<!-- We need to extract the non-portable OS name from the non-portable RID and pass that to installer build script -->
<OSNameOverride>$(TargetOS)</OSNameOverride>
<OSNameOverride Condition="'$(PortableBuild)' != 'true'">$(TargetRid.Substring(0, $(TargetRid.IndexOf("-"))))</OSNameOverride>
<!-- Use the repo root build script -->
<BuildScript>$(ProjectDirectory)build$(ShellExtension)</BuildScript>
@ -17,7 +11,7 @@
<!-- Restore and Build actions are already passed in by the root script. -->
<BuildActions>$(FlagParameterPrefix)pack $(FlagParameterPrefix)publish</BuildActions>
<BuildArgs>$(BuildArgs) $(FlagParameterPrefix)runtime-id $(OverrideTargetRid)</BuildArgs>
<BuildArgs>$(BuildArgs) $(FlagParameterPrefix)runtime-id $(TargetRid)</BuildArgs>
<!--
Setting NETCoreAppMaximumVersion to a high version so that the sdk doesn't complain if we're restoring/publishing for a higher version than the sdk.
@ -25,14 +19,14 @@
-->
<BuildArgs>$(BuildArgs) /p:NETCoreAppMaximumVersion=99.9</BuildArgs>
<BuildArgs>$(BuildArgs) /p:OSName=$(OSNameOverride)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:PortableOSName=$(PortableOS)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:Rid=$(OverrideTargetRid)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:PortableOSName=$(__PortableTargetOS)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:Rid=$(TargetRid)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:DOTNET_INSTALL_DIR=$(DotNetRoot)</BuildArgs>
<BuildArgs Condition="'$(TargetOS)' != 'windows'">$(BuildArgs) /p:AspNetCoreInstallerRid=$(OverrideTargetRid)</BuildArgs>
<BuildArgs Condition="'$(TargetOS)' != 'windows'">$(BuildArgs) /p:AspNetCoreInstallerRid=$(TargetRid)</BuildArgs>
<!-- installer always wants to build portable on FreeBSD -->
<BuildArgs Condition="'$(TargetOS)' == 'freebsd' and '$(DotNetBuildSourceOnly)' == 'true'">$(BuildArgs) /p:PortableBuild=true</BuildArgs>
<BuildArgs Condition="'$(TargetOS)' != 'windows'">$(BuildArgs) /p:CoreSetupRid=$(OverrideTargetRid)</BuildArgs>
<BuildArgs Condition="'$(TargetOS)' != 'windows'">$(BuildArgs) /p:CoreSetupRid=$(TargetRid)</BuildArgs>
<!-- Consume the source-built Core-Setup and toolset. This line must be removed to source-build CLI without source-building Core-Setup first. -->
<BuildArgs>$(BuildArgs) /p:PublicBaseURL=file:%2F%2F$(SourceBuiltAssetsDir)</BuildArgs>

View file

@ -3,29 +3,17 @@
<PropertyGroup>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'osx'">osx-$(TargetArchitecture)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'freebsd'">freebsd-$(TargetArchitecture)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'windows'">win-$(TargetArchitecture)</OverrideTargetRid>
<_platformIndex>$(NETCoreSdkRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
<RuntimeOS>$(NETCoreSdkRuntimeIdentifier.Substring(0, $(_platformIndex)))</RuntimeOS>
<_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
<BaseOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))-$(TargetArchitecture)</BaseOS>
<!-- Use the repo root build script -->
<BuildScript>$(ProjectDirectory)build$(ShellExtension)</BuildScript>
<BuildArgs Condition="'$(OverrideTargetArch)' != ''">$(BuildArgs) $(FlagParameterPrefix)arch $(OverrideTargetArch)</BuildArgs>
<BuildArgs Condition="'$(OverrideTargetOS)' != ''">$(BuildArgs) $(FlagParameterPrefix)os $(OverrideTargetOS)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:TargetRid=$(OverrideTargetRid)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:RuntimeOS=$(RuntimeOS)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:BaseOS=$(BaseOS)</BuildArgs>
<BuildArgs>$(BuildArgs) $(FlagParameterPrefix)arch $(TargetArchitecture)</BuildArgs>
<BuildArgs>$(BuildArgs) $(FlagParameterPrefix)os $(TargetOS)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:TargetRid=$(TargetRid)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:RuntimeOS=$(TargetOS)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:BaseOS=$(PortableRid)</BuildArgs>
</PropertyGroup>
<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<PortableBuild Condition="'$(PortableBuild)' == ''">false</PortableBuild>
<BuildNonPortable>true</BuildNonPortable>
<BuildNonPortable Condition="'$(PortableBuild)' == 'true'">false</BuildNonPortable>

View file

@ -3,21 +3,14 @@
<PropertyGroup>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'osx'">osx-$(TargetArchitecture)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'freebsd'">freebsd-$(TargetArchitecture)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'windows'">win-$(TargetArchitecture)</OverrideTargetRid>
<!-- Propagate RID set in source-build to sdk repo -->
<_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
<_baseOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))</_baseOS>
<_baseOS Condition="'$(OverrideTargetOS)' != ''">$(OverrideTargetOS)</_baseOS>
<_targetPortableArch>$(TargetArchitecture)</_targetPortableArch>
<_targetPortableArch Condition="'$(OverrideTargetArch)' != ''">$(OverrideTargetArch)</_targetPortableArch>
<_baseOS Condition="'$(PortableBuild)' == 'true'">$(TargetOS)</_baseOS>
<BuildArgs>$(BuildArgs) /p:PackageProjectUrl=https://github.com/dotnet/sdk</BuildArgs>
<BuildArgs>$(BuildArgs) /p:PortableRid=$(_baseOS)-$(_targetPortableArch)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:TargetRid=$(OverrideTargetRid)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:PortableRid=$(PortableRid)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:TargetRid=$(TargetRid)</BuildArgs>
<!-- Just like mono, arm does not support NativeAot -->
<BuildArgs Condition="'$(BuildArchitecture)' == 'arm'">$(BuildArgs) /p:NativeAotSupported=false</BuildArgs>