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 all 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
129 changes: 63 additions & 66 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -177,89 +177,86 @@
<InstallWasmtimeForTests Condition="'$(InstallWasmtimeForTests)' == '' and !Exists($(WasmtimeDir))">true</InstallWasmtimeForTests>
</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>
<!-- _portableOS is the portable rid-OS corresponding to the target platform. -->
<PropertyGroup Label="CalculatePortableOS">
<!-- To determine _portableOS we use TargetOS.
TargetOS is not a rid-OS. For example: for Windows it is 'windows' instead of 'win'.
And, for flavors of Linux, like 'linux-musl' and 'linux-bionic', TargetOS is 'linux'. -->

<_parseDistroRid>$(__DistroRid)</_parseDistroRid>
<_parseDistroRid Condition="'$(_parseDistroRid)' == ''">$(_hostRid)</_parseDistroRid>
<_distroRidIndex>$(_parseDistroRid.LastIndexOf('-'))</_distroRidIndex>
<_portableOS>$(TargetOS.ToLowerInvariant())</_portableOS>
<_portableOS Condition="'$(_portableOS)' == 'windows'">win</_portableOS>

<_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>
<!-- TargetOS=AnyOS is a sentinel value used by tests, ignore it. -->
<_portableOS Condition="'$(_portableOS)' == 'anyos'">$(__PortableTargetOS)</_portableOS>

<!-- Detect linux flavors using __PortableTargetOS from the native script. -->
<_portableOS Condition="'$(_portableOS)' == 'linux' and '$(__PortableTargetOS)' == 'linux-musl'">linux-musl</_portableOS>
<_portableOS Condition="'$(_portableOS)' == 'linux' and '$(__PortableTargetOS)' == 'linux-bionic'">linux-bionic</_portableOS>
</PropertyGroup>

<!-- 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>

<!-- source-build sets PackageOS to build with non-portable rid packages that were source-built previously. -->
<PackageRID Condition="'$(PackageOS)' != ''">$(PackageOS)-$(TargetArchitecture)</PackageRID>
<PackageRID>$(_packageOS)-$(TargetArchitecture)</PackageRID>
</PropertyGroup>

<PropertyGroup Label="CalculateRID">
<_toolsRID Condition="'$(CrossBuild)' == 'true'">$(_hostOS)-$(_hostArch)</_toolsRID>
<_toolsRID Condition="'$(BuildingInsideVisualStudio)' == 'true'">$(_runtimeOS)-x64</_toolsRID>
<_toolsRID Condition="'$(_toolsRID)' == ''">$(_runtimeOS)-$(_hostArch)</_toolsRID>
<!-- ToolsRID is used for packages needed on the build host. -->
<PropertyGroup Label="CalculateToolsRID">
<!-- _portableHostOS is the portable rid-OS corresponding to the build host platform.

<!-- 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>
To determine _portableHostOS we use _hostOS, similar to how _portableOS is calculated from TargetOS.

<!-- 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>
When we're not cross-building we can detect linux flavors by looking at _portableOS
because the target platform and the build host platform are the same.
For cross-builds, we're currently unable to detect the flavors. -->
<_portableHostOS>$(_hostOS)</_portableHostOS>
<_portableHostOS Condition="'$(_portableHostOS)' == 'windows'">win</_portableHostOS>
<_portableHostOS Condition="'$(CrossBuild)' != 'true' and '$(_portableOS)' == 'linux-musl'">linux-musl</_portableHostOS>

<!-- 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>
<!-- source-build sets ToolsOS to build with non-portable rid packages that were source-built previously. -->
<ToolsRID Condition="'$(ToolsOS)' != ''">$(ToolsOS)-$(_hostArch)</ToolsRID>
<ToolsRID Condition="'$(ToolsRID)' == ''">$(_portableHostOS)-$(_hostArch)</ToolsRID>

<!-- 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>
<!-- Microsoft.NET.Sdk.IL SDK defaults to the portable host rid. Match it to ToolsRID (for source-build). -->
<MicrosoftNetCoreIlasmPackageRuntimeId>$(ToolsRID)</MicrosoftNetCoreIlasmPackageRuntimeId>
</PropertyGroup>

<PackageRID>$(_packageOS)-$(TargetArchitecture)</PackageRID>
<!-- OutputRID is used to name the target platform.
For portable builds, OutputRID matches _portableOS.
For non-portable builds, it uses __DistroRid (from the native build script), or falls back to RuntimeInformation.RuntimeIdentifier.
Source-build sets OutputRID directly. -->
<PropertyGroup Label="CalculateOutputRID">

<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>
<_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>

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

<OutputRID Condition="'$(OutputRID)' == ''">$(_outputOS)-$(TargetArchitecture)</OutputRID>
</PropertyGroup>

<PropertyGroup Label="CalculateTargetOSName" Condition="'$(SkipInferTargetOSName)' != 'true'">
<PropertyGroup Label="CalculateTargetOSName">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Would be good to move this up in a follow-up and add TargetsMobile into the group as well.

<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 @@ -279,14 +276,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
7 changes: 4 additions & 3 deletions eng/SourceBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
<InnerBuildArgs>$(InnerBuildArgs) --nodereuse false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --warnAsError false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --outputrid $(TargetRid)</InnerBuildArgs>
<!-- RuntimeOS is the build host rid OS. -->
<InnerBuildArgs>$(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS)</InnerBuildArgs>
<!-- PackageOS and ToolsOS control the rids of prebuilts consumed by the build.
They are set to RuntimeOS so they match with the build SDK rid. -->
<InnerBuildArgs Condition="'$(RuntimeOS)' != ''">$(InnerBuildArgs) /p:PackageOS=$(RuntimeOS) /p:ToolsOS=$(RuntimeOS)</InnerBuildArgs>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who provides RuntimeOS in source build?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that still the right property to set or do we want to change that?

<!-- BaseOS is an expected known rid in the graph that TargetRid is compatible with.
It's used to add TargetRid in the graph if the parent can't be detected. -->
It's used to add TargetRid in the graph if the parent can't be detected. -->
<InnerBuildArgs>$(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(OfficialBuildId)' != ''">$(InnerBuildArgs) /p:OfficialBuildId=$(OfficialBuildId)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(ContinuousIntegrationBuild)' != ''">$(InnerBuildArgs) /p:ContinuousIntegrationBuild=$(ContinuousIntegrationBuild)</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
19 changes: 14 additions & 5 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ usage()
echo " --librariesConfiguration (-lc) Libraries build configuration: Debug or Release."
echo " [Default: Debug]"
echo " --os Target operating system: windows, linux, freebsd, osx, maccatalyst, tvos,"
echo " tvossimulator, ios, iossimulator, android, browser, wasi, netbsd, illumos or solaris."
echo " tvossimulator, ios, iossimulator, android, browser, wasi, netbsd, illumos, solaris"
echo " linux-musl or linux-bionic."
echo " [Default: Your machine's OS.]"
echo " --outputrid <rid> Optional argument that overrides the target rid name."
echo " --projects <value> Project or solution file(s) to build."
Expand Down Expand Up @@ -134,15 +135,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 +287,14 @@ while [[ $# > 0 ]]; do
os="illumos" ;;
solaris)
os="solaris" ;;
linux-bionic)
os="linux"
tmds marked this conversation as resolved.
Show resolved Hide resolved
__PortableTargetOS=linux-bionic
;;
linux-musl)
os="linux"
__PortableTargetOS=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 +447,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 +525,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
6 changes: 0 additions & 6 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 All @@ -85,7 +80,6 @@ steps:
$internalRuntimeDownloadArgs \
$internalRestoreArgs \
$targetRidArgs \
$runtimeOsArgs \
/p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \
/p:ArcadeBuildFromSource=true \
/p:AssetManifestFileName=$assetManifestFileName
Expand Down
Loading