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

Try to untangle the rid calculation. #82832

Merged
merged 38 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9d890f4
Try to untangle the rid calculation.
tmds Mar 1, 2023
c320ff9
Ignore __portableOS.
tmds Mar 1, 2023
494afb7
Add back musl detection.
tmds Mar 1, 2023
034d1d5
Try fix AnyOS tests.
tmds Mar 1, 2023
92ffb2f
Try fix coreclr linux_musl_arm64 job.
tmds Mar 2, 2023
ae67592
src/tests/build.proj: use PackageRID for restore.
tmds Mar 2, 2023
8c91698
Use RuntimeOS as an override for _packageOS.
tmds Mar 2, 2023
4ce7c57
Remove (probably) out-dated override for non-portable ToolsRID.
tmds Mar 2, 2023
e5ec2a5
CI cross-builds for linux-musl use linux.
tmds Mar 2, 2023
6d84cb4
Add missing arch to rid.
tmds Mar 2, 2023
802bd95
Try simplified ToolsRID.
tmds Mar 3, 2023
959f5be
Update comments.
tmds Mar 3, 2023
44dcd0d
Rename OutputRid to OutputRID.
tmds Mar 3, 2023
9c2a977
Tweak comment.
tmds Mar 3, 2023
b16dc2d
Move TargetsLinux{Bionic,Musl} with the other Targets properties.
tmds Mar 4, 2023
220c624
Don't use RuntimeOS for PackageRID for CrossBuilds.
tmds Mar 5, 2023
b422a2f
Move RuntimeOS condition to ToolsRID assignment.
tmds Mar 5, 2023
edeb0f2
Clean up a few things.
tmds Mar 5, 2023
76b3e61
Fix broken Condition.
tmds Mar 5, 2023
9c31e98
Try fix the linux-bionic build.
tmds Mar 6, 2023
0d194d5
Try fix the linux-bionic build, part II.
tmds Mar 6, 2023
06bb0ea
Try fix the linux-bionic build, part III.
tmds Mar 6, 2023
6973d62
Fix PackageRID.
tmds Mar 6, 2023
83baf6c
Use RuntimeOS as _packageOS override.
tmds Mar 6, 2023
1eeef02
Remove RuntimeOS.
tmds Mar 7, 2023
a361268
Fix '-os linux-musl' mapping.
tmds Mar 7, 2023
89a70f6
Clean up .
tmds Mar 7, 2023
78bcd23
Rename __PortableOS to __PortableTargetOS.
tmds Mar 7, 2023
d672f14
Extend comments.
tmds Mar 8, 2023
bd52080
Extend OutputRID comment too.
tmds Mar 8, 2023
3e5800c
build.sh: include linux-bionic, linux-musl in usage.
tmds Mar 14, 2023
a29df93
Merge branch 'main' into rid_cleanup
tmds Mar 28, 2023
0814de1
SourceBuild.props: no need to pass RuntimeOS. Only set ToolsOS, Packa…
tmds Apr 4, 2023
01bae0d
Fix comment.
tmds Apr 18, 2023
8a0f558
linux-bionic doesn't get built on linux-bionic.
tmds Apr 20, 2023
acb8cf5
Merge remote-tracking branch 'origin/main' into rid_cleanup
tmds Apr 20, 2023
81402ef
Unconditionally assign TargetsLinuxBionic/TargetsLinuxMusl.
tmds Apr 20, 2023
8219051
Remove SkipInferTargetOSName.
tmds Apr 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 44 additions & 68 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -171,89 +171,65 @@
<WasmtimeDir>$([MSBuild]::NormalizeDirectory($(ArtifactsObjDir), 'wasmtime'))</WasmtimeDir>
</PropertyGroup>

<PropertyGroup Label="CalculateOS">
<!-- Default to portable build if not explicitly set -->
<PropertyGroup Label="CalculatePortableBuild">
<PortableBuild Condition="'$(PortableBuild)' == '' and '$(DotNetBuildFromSource)' == 'true'">false</PortableBuild>
<PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>
</PropertyGroup>

<_hostRid Condition="'$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</_hostRid>
<_hostRid Condition="'$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</_hostRid>

<_parseDistroRid>$(__DistroRid)</_parseDistroRid>
<_parseDistroRid Condition="'$(_parseDistroRid)' == ''">$(_hostRid)</_parseDistroRid>
<_distroRidIndex>$(_parseDistroRid.LastIndexOf('-'))</_distroRidIndex>

<_runtimeOS>$(RuntimeOS)</_runtimeOS>
<_runtimeOS Condition="'$(_runtimeOS)' == ''">$(_parseDistroRid.SubString(0, $(_distroRidIndex)))</_runtimeOS>

<!-- _runtimeOS is calculated based on the build system OS, however if building for Browser/iOS/Android we need to let
the build system to use browser/ios/android as the _runtimeOS for produced package RIDs. -->
<_runtimeOS Condition="'$(TargetsMobile)' == 'true'">$(TargetOS.ToLowerInvariant())</_runtimeOS>

<_portableOS>linux</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'linux-musl' or $(_runtimeOS.StartsWith('alpine'))">linux-musl</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'linux-bionic'">linux-bionic</_portableOS>
<_portableOS Condition="'$(_hostOS)' == 'osx'">osx</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'win' or '$(TargetOS)' == 'windows'">win</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'freebsd' or '$(TargetOS)' == 'freebsd'">freebsd</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'illumos' or '$(TargetOS)' == 'illumos'">illumos</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'solaris' or '$(TargetOS)' == 'solaris'">solaris</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'browser'">browser</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'wasi'">wasi</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'maccatalyst'">maccatalyst</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'ios'">ios</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'iossimulator'">iossimulator</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'tvos'">tvos</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'tvossimulator'">tvossimulator</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'android'">android</_portableOS>

<_runtimeOS Condition="$(_runtimeOS.StartsWith('tizen'))">linux</_runtimeOS>
<_runtimeOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_runtimeOS>
<_runtimeOS Condition="'$(RuntimeOS)' == '' and '$(DotNetBuildFromSource)' == 'true'">$(_portableOS)</_runtimeOS>

<_packageLibc Condition="$(_runtimeOS.Contains('musl'))">-musl</_packageLibc>
<_packageOS Condition="'$(CrossBuild)' == 'true'">$(_hostOS)$(_packageLibc)</_packageOS>
<_packageOS Condition="'$(_packageOS)' == '' and '$(PortableBuild)' == 'true'">$(_portableOS)</_packageOS>
<_packageOS Condition="'$(_packageOS)' == ''">$(_runtimeOS)</_packageOS>
<!-- _portableOS is the portable OS corresponding to the target platform. -->
tmds marked this conversation as resolved.
Show resolved Hide resolved
<PropertyGroup Label="CalculatePortableOS">
<_portableOS>$(TargetOS.ToLowerInvariant())</_portableOS>
<_portableOS Condition="'$(_portableOS)' == 'anyos'">$(__PortableOS)</_portableOS>
<_portableOS Condition="'$(_portableOS)' == 'windows'">win</_portableOS>
<_portableOS Condition="'$(_portableOS)' == 'linux' and '$(__PortableOS)' == 'linux-musl'">linux-musl</_portableOS>
<_portableOS Condition="'$(_portableOS)' == 'linux' and '$(__PortableOS)' == 'linux-bionic'">linux-bionic</_portableOS>
tmds marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<PropertyGroup Label="CalculateRID">
<_toolsRID Condition="'$(CrossBuild)' == 'true'">$(_hostOS)-$(_hostArch)</_toolsRID>
<_toolsRID Condition="'$(BuildingInsideVisualStudio)' == 'true'">$(_runtimeOS)-x64</_toolsRID>
<_toolsRID Condition="'$(_toolsRID)' == ''">$(_runtimeOS)-$(_hostArch)</_toolsRID>
<!-- PackageRID is used for packages needed for the target. -->
<PropertyGroup Label="CalculatePackageRID">
<_packageOS>$(_portableOS)</_packageOS>
<_packageOS Condition="'$(CrossBuild)' == 'true' and '$(_portableOS)' != 'linux-musl' and '$(_portableOS)' != 'linux-bionic'">$(_hostOS)</_packageOS>

<!-- There are no WebAssembly tools, so use the default ones -->
<_toolsRID Condition="'$(_runtimeOS)' == 'browser' or '$(_runtimeOS)' == 'wasi'">linux-x64</_toolsRID>
<_toolsRID Condition="('$(_runtimeOS)' == 'browser' or '$(_runtimeOS)' == 'wasi') and '$(HostOS)' == 'windows'">win-x64</_toolsRID>
<_toolsRID Condition="('$(_runtimeOS)' == 'browser' or '$(_runtimeOS)' == 'wasi') and '$(HostOS)' == 'osx'">osx-x64</_toolsRID>
<PackageRID Condition="'$(PackageOS)' != ''">$(PackageOS)-$(TargetArchitecture)</PackageRID>
<PackageRID>$(_packageOS)-$(TargetArchitecture)</PackageRID>
</PropertyGroup>

<!-- There are no Android tools, so use the default ones -->
<_toolsRID Condition="'$(_runtimeOS)' == 'android' or '$(_runtimeOS)' == 'linux-bionic'">linux-x64</_toolsRID>
<_toolsRID Condition="('$(_runtimeOS)' == 'android' or '$(_runtimeOS)' == 'linux-bionic') and '$(HostOS)' == 'windows'">win-x64</_toolsRID>
<_toolsRID Condition="('$(_runtimeOS)' == 'android' or '$(_runtimeOS)' == 'linux-bionic') and '$(HostOS)' == 'osx'">osx-x64</_toolsRID>
<!-- ToolsRID is used for packages needed on the build host. -->
<PropertyGroup Label="CalculateToolsRID">
<!-- _portableHostOS is the portable OS corresponding to the build host platform.
note: for CrossBuilds, we're unable to determine if the host is linux-musl or linux-bionic. -->
<_portableHostOS>$(_hostOS)</_portableHostOS>
<_portableHostOS Condition="'$(_portableHostOS)' == 'windows'">win</_portableHostOS>
<_portableHostOS Condition="'$(CrossBuild)' != 'true' and '$(_portableOS)' == 'linux-musl'">linux-musl</_portableHostOS>
<_portableHostOS Condition="'$(CrossBuild)' != 'true' and '$(_portableOS)' == 'linux-bionic'">linux-bionic</_portableHostOS>

<ToolsRID Condition="'$(ToolsOS)' != ''">$(ToolsOS)-$(_hostArch)</ToolsRID>
<ToolsRID Condition="'$(ToolsRID)' == ''">$(_portableHostOS)-$(_hostArch)</ToolsRID>
<MicrosoftNetCoreIlasmPackageRuntimeId>$(ToolsRID)</MicrosoftNetCoreIlasmPackageRuntimeId>
</PropertyGroup>

<!-- There are no Mac Catalyst, iOS or tvOS tools and it can be built on OSX only, so use that -->
<_toolsRID Condition="'$(_runtimeOS)' == 'maccatalyst' or '$(_runtimeOS)' == 'ios' or '$(_runtimeOS)' == 'iossimulator' or '$(_runtimeOS)' == 'tvos' or '$(_runtimeOS)' == 'tvossimulator'">osx-x64</_toolsRID>
<!-- OutputRID is used to name the target platform. -->
<PropertyGroup Label="CalculateOutputRID">
<_hostRid Condition="'$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</_hostRid>
<_hostRid Condition="'$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</_hostRid>

<!-- There are no non-portable builds for Ilasm, Ildasm, ILC etc. -->
<ToolsRID Condition="'$(PortableBuild)' != 'true' and '$(_portableOS)' == 'linux'">linux-$(_hostArch)</ToolsRID>
<ToolsRID Condition="'$(ToolsRID)' == ''">$(_toolsRID)</ToolsRID>
<MicrosoftNetCoreIlasmPackageRuntimeId>$(ToolsRID)</MicrosoftNetCoreIlasmPackageRuntimeId>
<_parseDistroRid>$(__DistroRid)</_parseDistroRid>
<_parseDistroRid Condition="'$(_parseDistroRid)' == ''">$(_hostRid)</_parseDistroRid>
<_distroRidIndex>$(_parseDistroRid.LastIndexOf('-'))</_distroRidIndex>

<PackageRID>$(_packageOS)-$(TargetArchitecture)</PackageRID>
<_outputOS>$(_parseDistroRid.SubString(0, $(_distroRidIndex)))</_outputOS>
<_outputOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_outputOS>

<OutputRid Condition="'$(OutputRid)' == '' and '$(DotNetBuildFromSource)' == 'true'">$(_hostRid)</OutputRid>
<OutputRid Condition="'$(OutputRid)' == ''">$(PackageRID)</OutputRid>
<OutputRid Condition="'$(PortableBuild)' == 'true'">$(_portableOS)-$(TargetArchitecture)</OutputRid>
<TargetsLinuxBionic Condition="$(OutputRid.StartsWith('linux-bionic'))">true</TargetsLinuxBionic>
<TargetsLinuxMusl Condition="'$(_portableOS)' == 'linux-musl'">true</TargetsLinuxMusl>
<OutputRID Condition="'$(OutputRID)' == ''">$(_outputOS)-$(TargetArchitecture)</OutputRID>
</PropertyGroup>

<PropertyGroup Label="CalculateTargetOSName" Condition="'$(SkipInferTargetOSName)' != 'true'">
<TargetsFreeBSD Condition="'$(TargetOS)' == 'freebsd'">true</TargetsFreeBSD>
<Targetsillumos Condition="'$(TargetOS)' == 'illumos'">true</Targetsillumos>
<TargetsSolaris Condition="'$(TargetOS)' == 'solaris'">true</TargetsSolaris>
<TargetsLinux Condition="'$(TargetOS)' == 'linux' or '$(TargetOS)' == 'android'">true</TargetsLinux>
<TargetsLinuxBionic Condition="'$(_portableOS)' == 'linux-bionic'">true</TargetsLinuxBionic>
<TargetsLinuxMusl Condition="'$(_portableOS)' == 'linux-musl'">true</TargetsLinuxMusl>
<TargetsNetBSD Condition="'$(TargetOS)' == 'netbsd'">true</TargetsNetBSD>
<TargetsOSX Condition="'$(TargetOS)' == 'osx'">true</TargetsOSX>
<TargetsMacCatalyst Condition="'$(TargetOS)' == 'maccatalyst'">true</TargetsMacCatalyst>
Expand All @@ -273,14 +249,14 @@
<MicrosoftNetCoreAppRefPackRefDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'ref', '$(NetCoreAppCurrent)'))</MicrosoftNetCoreAppRefPackRefDir>
<MicrosoftNetCoreAppRefPackDataDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'data'))</MicrosoftNetCoreAppRefPackDataDir>

<MicrosoftNetCoreAppRuntimePackDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.runtime.$(OutputRid)', '$(LibrariesConfiguration)'))</MicrosoftNetCoreAppRuntimePackDir>
<MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackDir)', 'runtimes', '$(OutputRid)'))</MicrosoftNetCoreAppRuntimePackRidDir>
<MicrosoftNetCoreAppRuntimePackDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.runtime.$(OutputRID)', '$(LibrariesConfiguration)'))</MicrosoftNetCoreAppRuntimePackDir>
<MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackDir)', 'runtimes', '$(OutputRID)'))</MicrosoftNetCoreAppRuntimePackRidDir>
<MicrosoftNetCoreAppRuntimePackRidLibTfmDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'lib', '$(NetCoreAppCurrent)'))</MicrosoftNetCoreAppRuntimePackRidLibTfmDir>
<MicrosoftNetCoreAppRuntimePackNativeDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'native'))</MicrosoftNetCoreAppRuntimePackNativeDir>
</PropertyGroup>

<PropertyGroup>
<DotNetHostBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(OutputRid).$(HostConfiguration)', 'corehost'))</DotNetHostBinDir>
<DotNetHostBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(OutputRID).$(HostConfiguration)', 'corehost'))</DotNetHostBinDir>
</PropertyGroup>

<!--Feature switches -->
Expand Down
3 changes: 0 additions & 3 deletions docs/coding-guidelines/project-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ The following are the properties associated with each build pivot
- `$(TargetOS) -> windows | linux | osx | freebsd | ... | [defaults to running OS when empty]`
- `$(Configuration) -> Debug | Release | [defaults to Debug when empty]`
- `$(TargetArchitecture) - x86 | x64 | arm | arm64 | [defaults to x64 when empty]`
- `$(RuntimeOS) - win7 | osx10.10 | ubuntu.14.04 | [any other RID OS+version] | [defaults to running OS when empty]` See [RIDs](https://github.com/dotnet/runtime/tree/main/src/libraries/Microsoft.NETCore.Platforms) for more info.

## Aggregate build properties
Each project will define a set of supported TargetFrameworks
Expand Down Expand Up @@ -63,8 +62,6 @@ A full or individual project build is centered around BuildTargetFramework, Targ
2. If nothing is passed to the build then we will default value of these properties from the environment. Example: `net8.0-[TargetOS Running On]-Debug-x64`.
3. When building an individual project (either from the CLI or an IDE), all target frameworks are built.

We also have `RuntimeOS` which can be passed to customize the specific OS and version needed for native package builds as well as package restoration. If not passed it will default based on the OS you are running on.

Any of the mentioned properties can be set via `/p:<Property>=<Value>` at the command line. When building using any of the wrapper scripts around it (i.e. build.cmd) a number of these properties have aliases which make them easier to pass (run build.cmd/sh -? for the aliases).

## Selecting the correct BuildSettings
Expand Down
2 changes: 1 addition & 1 deletion eng/SourceBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<InnerBuildArgs>$(InnerBuildArgs) --nodereuse false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --warnAsError false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --outputrid $(TargetRid)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:PackageOS=$(RuntimeOS) /p:ToolsOS=$(RuntimeOS)</InnerBuildArgs>
tmds marked this conversation as resolved.
Show resolved Hide resolved
tmds marked this conversation as resolved.
Show resolved Hide resolved
<InnerBuildArgs Condition="'$(OfficialBuildId)' != ''">$(InnerBuildArgs) /p:OfficialBuildId=$(OfficialBuildId)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(ContinuousIntegrationBuild)' != ''">$(InnerBuildArgs) /p:ContinuousIntegrationBuild=$(ContinuousIntegrationBuild)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS)</InnerBuildArgs>
Expand Down
7 changes: 0 additions & 7 deletions eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,6 @@ foreach ($config in $configuration) {
$argumentsWithConfig = $arguments + " -configuration $((Get-Culture).TextInfo.ToTitleCase($config))";
foreach ($singleArch in $arch) {
$argumentsWithArch = "/p:TargetArchitecture=$singleArch " + $argumentsWithConfig
if ($os -eq "browser") {
$env:__DistroRid="browser-$singleArch"
} elseif ($os -eq "wasi") {
$env:__DistroRid="wasi-$singleArch"
} else {
$env:__DistroRid="win-$singleArch"
}
Invoke-Expression "& `"$PSScriptRoot/common/build.ps1`" $argumentsWithArch"
if ($lastExitCode -ne 0) {
$failedBuilds += "Configuration: $config, Architecture: $singleArch"
Expand Down
16 changes: 12 additions & 4 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ initDistroRid()

local passedRootfsDir=""
local targetOs="$1"
local buildArch="$2"
local targetArch="$2"
local isCrossBuild="$3"
local isPortableBuild="$4"

# Only pass ROOTFS_DIR if __DoCrossArchBuild is specified and the current platform is not OSX that doesn't use rootfs
if [[ $isCrossBuild == 1 && "$targetOs" != "osx" ]]; then
passedRootfsDir=${ROOTFS_DIR}
fi
initDistroRidGlobal ${targetOs} ${buildArch} ${isPortableBuild} ${passedRootfsDir}
initDistroRidGlobal "${targetOs}" "${targetArch}" "${isPortableBuild}" "${passedRootfsDir}"
}

showSubsetHelp()
Expand Down Expand Up @@ -286,6 +286,14 @@ while [[ $# > 0 ]]; do
os="illumos" ;;
solaris)
os="solaris" ;;
linux-bionic)
os="linux"
tmds marked this conversation as resolved.
Show resolved Hide resolved
__PortableOS=linux-bionic
;;
linux-musl)
os="linux-musl"
__PortableOS=linux-musl
;;
*)
echo "Unsupported target OS '$2'."
echo "The allowed values are windows, linux, freebsd, osx, maccatalyst, tvos, tvossimulator, ios, iossimulator, android, browser, wasi, illumos and solaris."
Expand Down Expand Up @@ -438,7 +446,7 @@ while [[ $# > 0 ]]; do
echo "No value for outputrid is supplied. See help (--help) for supported values." 1>&2
exit 1
fi
arguments="$arguments /p:OutputRid=$(echo "$2" | tr "[:upper:]" "[:lower:]")"
arguments="$arguments /p:OutputRID=$(echo "$2" | tr "[:upper:]" "[:lower:]")"
shift 2
;;

Expand Down Expand Up @@ -516,7 +524,7 @@ if [[ "${TreatWarningsAsErrors:-}" == "false" ]]; then
arguments="$arguments -warnAsError 0"
fi

initDistroRid $os $arch $crossBuild $portableBuild
initDistroRid "$os" "$arch" "$crossBuild" "$portableBuild"

# Disable targeting pack caching as we reference a partially constructed targeting pack and update it later.
# The later changes are ignored when using the cache.
Expand Down
5 changes: 0 additions & 5 deletions eng/common/templates/steps/source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ steps:
targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}'
fi

runtimeOsArgs=
if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then
runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}'
fi
tmds marked this conversation as resolved.
Show resolved Hide resolved

publishArgs=
if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then
publishArgs='--publish'
Expand Down
12 changes: 8 additions & 4 deletions eng/native/build-commons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ source "$__RepoRootDir/eng/native/init-os-and-arch.sh"
__TargetArch=$arch
__TargetOS=$os
__HostOS=$os
__BuildOS=$os
__OutputRid=''

# Get the number of processors available to the scheduler
Expand Down Expand Up @@ -536,12 +535,17 @@ if [[ "$__CrossBuild" == 1 ]]; then
fi
fi

# init the target distro name
# init the target distro name (__DistroRid) and target portable os (__PortableOS).
initTargetDistroRid

if [ -z "$__OutputRid" ]; then
__OutputRid="$(echo $__DistroRid | tr '[:upper:]' '[:lower:]')"
if [[ "$__PortableBuild" == 0 ]]; then
__OutputRid="$__DistroRid"
else
__OutputRid="$__PortableOS-$__TargetArch"
fi
fi
export __OutputRid
echo "__OutputRid: ${__OutputRid}"

# When the host runs on an unknown rid, it falls back to the output rid
__HostFallbackOS="${__OutputRid%-*}" # Strip architecture
Loading