Skip to content

Commit 6d27384

Browse files
committed
Remove __DistroRid calculation
1 parent e5cf690 commit 6d27384

File tree

11 files changed

+19
-95
lines changed

11 files changed

+19
-95
lines changed

Directory.Build.props

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,17 +246,16 @@
246246

247247
<!-- OutputRID is used to name the target platform.
248248
For portable builds, OutputRID matches _portableOS.
249-
For non-portable builds, it uses __DistroRid (from the native build script), or falls back to RuntimeInformation.RuntimeIdentifier.
249+
For non-portable builds, it expects caller to set OutputRID or falls back to RuntimeInformation.RuntimeIdentifier.
250250
Source-build sets OutputRID directly. -->
251251
<PropertyGroup Label="CalculateOutputRID">
252252
<_hostRid Condition="'$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</_hostRid>
253253
<_hostRid Condition="'$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</_hostRid>
254254

255-
<_parseDistroRid>$(__DistroRid)</_parseDistroRid>
256-
<_parseDistroRid Condition="'$(_parseDistroRid)' == ''">$(_hostRid)</_parseDistroRid>
257-
<_distroRidIndex>$(_parseDistroRid.LastIndexOf('-'))</_distroRidIndex>
255+
<_parseDistroRid Condition="'$(PortableBuild)' == 'true'">$(_hostRid)</_parseDistroRid>
256+
<_lastHyphenIndex Condition="'$(PortableBuild)' == 'true'">$(_parseDistroRid.LastIndexOf('-'))</_lastHyphenIndex>
258257

259-
<_outputOS>$(_parseDistroRid.SubString(0, $(_distroRidIndex)))</_outputOS>
258+
<_outputOS Condition="'$(PortableBuild)' == 'true'">$(_parseDistroRid.SubString(0, $(_lastHyphenIndex)))</_outputOS>
260259
<_outputOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_outputOS>
261260

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

eng/common/cross/build-android-rootfs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ done
118118

119119
cp -R "$__TmpDir/data/data/com.termux/files/usr/"* "$__ToolchainDir/sysroot/usr/"
120120

121-
# Generate platform file for build.sh script to assign to __DistroRid
121+
# Generate platform file for build.sh script to assign to __OutputRid
122122
echo "Generating platform file..."
123123
echo "RID=android.${__ApiLevel}-${__BuildArch}" > $__ToolchainDir/sysroot/android_platform
124124

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,5 @@
11
#!/bin/sh
22

3-
# getNonPortableDistroRid
4-
#
5-
# Input:
6-
# targetOs: (str)
7-
# targetArch: (str)
8-
# rootfsDir: (str)
9-
#
10-
# Return:
11-
# non-portable rid
12-
getNonPortableDistroRid()
13-
{
14-
targetOs="$1"
15-
targetArch="$2"
16-
rootfsDir="$3"
17-
nonPortableRid=""
18-
19-
if [ "$targetOs" = "linux" ]; then
20-
# shellcheck disable=SC1091
21-
if [ -e "${rootfsDir}/etc/os-release" ]; then
22-
. "${rootfsDir}/etc/os-release"
23-
if [ "${ID}" = "rhel" ] || [ "${ID}" = "rocky" ] || [ "${ID}" = "alpine" ] || [ "${ID}" = "ol" ]; then
24-
VERSION_ID="${VERSION_ID%.*}" # Remove the last version digit for these distros
25-
fi
26-
27-
if echo "${VERSION_ID:-}" | grep -qE '^([[:digit:]]|\.)+$'; then
28-
nonPortableRid="${ID}.${VERSION_ID}-${targetArch}"
29-
else
30-
# Rolling release distros either do not set VERSION_ID, set it as blank or
31-
# set it to non-version looking string (such as TEMPLATE_VERSION_ID on ArchLinux);
32-
# so omit it here to be consistent with everything else.
33-
nonPortableRid="${ID}-${targetArch}"
34-
fi
35-
elif [ -e "${rootfsDir}/android_platform" ]; then
36-
# shellcheck disable=SC1091
37-
. "${rootfsDir}/android_platform"
38-
nonPortableRid="$RID"
39-
fi
40-
fi
41-
42-
if [ "$targetOs" = "freebsd" ]; then
43-
# $rootfsDir can be empty. freebsd-version is a shell script and should always work.
44-
__freebsd_major_version=$("$rootfsDir"/bin/freebsd-version | cut -d'.' -f1)
45-
nonPortableRid="freebsd.$__freebsd_major_version-${targetArch}"
46-
elif command -v getprop >/dev/null && getprop ro.product.system.model | grep -qi android; then
47-
__android_sdk_version=$(getprop ro.build.version.sdk)
48-
nonPortableRid="android.$__android_sdk_version-${targetArch}"
49-
elif [ "$targetOs" = "illumos" ]; then
50-
__uname_version=$(uname -v)
51-
case "$__uname_version" in
52-
omnios-*)
53-
__omnios_major_version=$(echo "$__uname_version" | cut -c9-10)
54-
nonPortableRid="omnios.$__omnios_major_version-${targetArch}"
55-
;;
56-
joyent_*)
57-
__smartos_major_version=$(echo "$__uname_version" | cut -c9-10)
58-
nonPortableRid="smartos.$__smartos_major_version-${targetArch}"
59-
;;
60-
*)
61-
nonPortableRid="illumos-${targetArch}"
62-
;;
63-
esac
64-
elif [ "$targetOs" = "solaris" ]; then
65-
__uname_version=$(uname -v)
66-
__solaris_major_version=$(echo "$__uname_version" | cut -d'.' -f1)
67-
nonPortableRid="solaris.$__solaris_major_version-${targetArch}"
68-
elif [ "$targetOs" = "haiku" ]; then
69-
__uname_release="$(uname -r)"
70-
nonPortableRid=haiku.r"$__uname_release"-"$targetArch"
71-
fi
72-
73-
echo "$nonPortableRid" | tr '[:upper:]' '[:lower:]'
74-
}
75-
763
# initDistroRidGlobal
774
#
785
# Input:
@@ -86,7 +13,6 @@ getNonPortableDistroRid()
8613
# Notes:
8714
# It is important to note that the function does not return anything, but it
8815
# exports the following variables on success:
89-
# __DistroRid : Non-portable rid of the target platform.
9016
# __PortableTargetOS : OS-part of the portable rid that corresponds to the target platform.
9117
initDistroRidGlobal()
9218
{
@@ -105,8 +31,6 @@ initDistroRidGlobal()
10531
fi
10632
fi
10733

108-
__DistroRid=$(getNonPortableDistroRid "${targetOs}" "${targetArch}" "${rootfsDir}")
109-
11034
if [ -z "${__PortableTargetOS:-}" ]; then
11135
__PortableTargetOS="$targetOs"
11236

@@ -122,5 +46,5 @@ initDistroRidGlobal()
12246
fi
12347
fi
12448

125-
export __DistroRid __PortableTargetOS
49+
export __PortableTargetOS
12650
}

eng/common/templates-official/job/source-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ parameters:
1212
# The name of the job. This is included in the job ID.
1313
# targetRID: ''
1414
# The name of the target RID to use, instead of the one auto-detected by Arcade.
15-
# nonPortable: false
15+
# portableBuild: true
1616
# Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than
1717
# linux-x64), and compiling against distro-provided packages rather than portable ones.
1818
# skipPublishValidation: false

eng/common/templates-official/steps/source-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ steps:
9292
$targetRidArgs \
9393
$runtimeOsArgs \
9494
$baseOsArgs \
95-
/p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \
95+
/p:PortableBuild=${{ parameters.platform.portableBuild }} \
9696
/p:ArcadeBuildFromSource=true \
9797
/p:DotNetBuildSourceOnly=true \
9898
/p:DotNetBuildRepo=true \

eng/common/templates/job/source-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ parameters:
1212
# The name of the job. This is included in the job ID.
1313
# targetRID: ''
1414
# The name of the target RID to use, instead of the one auto-detected by Arcade.
15-
# nonPortable: false
15+
# portableBuild: true
1616
# Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than
1717
# linux-x64), and compiling against distro-provided packages rather than portable ones.
1818
# skipPublishValidation: false

eng/common/templates/steps/source-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ steps:
9292
$targetRidArgs \
9393
$runtimeOsArgs \
9494
$baseOsArgs \
95-
/p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \
95+
/p:PortableBuild=${{ parameters.platform.portableBuild }} \
9696
/p:ArcadeBuildFromSource=true \
9797
/p:DotNetBuildSourceOnly=true \
9898
/p:DotNetBuildRepo=true \

eng/native/build-commons.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,12 @@ if [[ "$__CrossBuild" == 1 ]]; then
563563
fi
564564
fi
565565

566-
# init the target distro name (__DistroRid) and target portable os (__PortableTargetOS).
566+
# init the OutputRID and target portable os (__PortableTargetOS).
567567
initTargetDistroRid
568568
if [ -z "$__OutputRid" ]; then
569569
if [[ "$__PortableBuild" == 0 ]]; then
570-
__OutputRid="$__DistroRid"
570+
echo "ERROR: --outputrid is required for non-portable builds"
571+
exit 1
571572
else
572573
__OutputRid="$__PortableTargetOS-$__TargetArch"
573574
fi

eng/pipelines/common/global-build-job.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ parameters:
1919
shouldContinueOnError: false
2020
isOfficialBuild: false
2121
isSourceBuild: false
22-
isNonPortableSourceBuild: false
22+
isPortableSourceBuild: true
2323
runtimeFlavor: 'coreclr'
2424
runtimeVariant: ''
2525
helixQueues: ''
@@ -174,7 +174,7 @@ jobs:
174174
platform:
175175
baseOS: ${{ parameters.baseOS }}
176176
buildScript: $(Build.SourcesDirectory)$(dir)build$(scriptExt)
177-
nonPortable: ${{ parameters.isNonPortableSourceBuild }}
177+
portableBuild: ${{ parameters.isPortableSourceBuild }}
178178
targetRID: ${{ parameters.targetRid }}
179179
name: ${{ parameters.platform }}
180180

eng/pipelines/common/platform-matrix.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ jobs:
313313
buildConfig: ${{ parameters.buildConfig }}
314314
helixQueueGroup: ${{ parameters.helixQueueGroup }}
315315
isSourceBuild: true
316-
isNonPortableSourceBuild: true
316+
isPortableSourceBuild: false
317317
${{ insert }}: ${{ parameters.jobParameters }}
318318

319319
# Non-existent RID Source Build
@@ -336,7 +336,7 @@ jobs:
336336
buildConfig: ${{ parameters.buildConfig }}
337337
helixQueueGroup: ${{ parameters.helixQueueGroup }}
338338
isSourceBuild: true
339-
isNonPortableSourceBuild: true
339+
isPortableSourceBuild: false
340340
${{ insert }}: ${{ parameters.jobParameters }}
341341

342342
# Portable Linux x64 Source Build
@@ -358,7 +358,7 @@ jobs:
358358
buildConfig: ${{ parameters.buildConfig }}
359359
helixQueueGroup: ${{ parameters.helixQueueGroup }}
360360
isSourceBuild: true
361-
isNonPortableSourceBuild: false
361+
isPortableSourceBuild: true
362362
${{ insert }}: ${{ parameters.jobParameters }}
363363

364364
# GCC Linux x64 Build

0 commit comments

Comments
 (0)