From 45a8ea8332796816e943ce652d2d00f75705266c Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Fri, 26 Aug 2022 13:09:17 +0200 Subject: [PATCH 01/20] Pass SourceBuild TargetRid and SourceBuildPortable args through the native script. --- Directory.Build.props | 2 +- eng/SourceBuild.props | 4 +- eng/build.sh | 17 ++++- eng/native/build-commons.sh | 15 +++- eng/native/init-distro-rid.sh | 111 ++++++++++++++++-------------- src/native/corehost/corehost.proj | 1 + 6 files changed, 91 insertions(+), 59 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 60a661e66ca44..64adc127cf63a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -231,7 +231,7 @@ - $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(OutputRid).$(Configuration)', 'corehost')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(PackageRID).$(Configuration)', 'corehost')) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index c17838918f8ce..48be2fadb1220 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -32,11 +32,11 @@ $(InnerBuildArgs) --verbosity $(LogVerbosity) $(InnerBuildArgs) --nodereuse false $(InnerBuildArgs) --warnAsError false - $(InnerBuildArgs) /p:PackageRid=$(TargetRid) + $(InnerBuildArgs) --packagerid $(TargetRid) $(InnerBuildArgs) /p:NoPgoOptimize=true $(InnerBuildArgs) /p:KeepNativeSymbols=true $(InnerBuildArgs) /p:RuntimeOS=$(TargetRidWithoutPlatform) - $(InnerBuildArgs) /p:PortableBuild=$(SourceBuildPortable) + $(InnerBuildArgs) --portablebuild $(SourceBuildPortable) $(InnerBuildArgs) /p:BuildDebPackage=false $(InnerBuildArgs) /p:EnableNgenOptimization=false diff --git a/eng/build.sh b/eng/build.sh index 84a4fd746c917..b3392315e6797 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -31,6 +31,7 @@ usage() echo " --os Target operating system: windows, Linux, FreeBSD, OSX, MacCatalyst, tvOS," echo " tvOSSimulator, iOS, iOSSimulator, Android, Browser, NetBSD, illumos or Solaris." echo " [Default: Your machine's OS.]" + echo " --packagerid Optional argument that overrides the target rid name." echo " --projects Project or solution file(s) to build." echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked." echo " Checked is exclusive to the CLR runtime. It is the same as Debug, except code is" @@ -134,12 +135,13 @@ initDistroRid() local buildArch="$2" local isCrossBuild="$3" local isPortableBuild="$4" + local packageRid="$5" # 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} ${buildArch} ${isPortableBuild} "${packageRid}" ${passedRootfsDir} } showSubsetHelp() @@ -152,6 +154,7 @@ cmakeargs='' extraargs='' crossBuild=0 portableBuild=1 +packageRid='' source $scriptroot/native/init-os-and-arch.sh @@ -402,6 +405,16 @@ while [[ $# > 0 ]]; do shift 1 ;; + -packagerid) + if [ -z ${2+x} ]; then + echo "No value for packagerid is supplied. See help (--help) for supported values." 1>&2 + exit 1 + fi + packageRid="$(echo "$2" | tr "[:upper:]" "[:lower:]")" + arguments="$arguments /p:PackageRid=$packageRid" + shift 2 + ;; + -portablebuild) if [ -z ${2+x} ]; then echo "No value for portablebuild is supplied. See help (--help) for supported values." 1>&2 @@ -468,7 +481,7 @@ if [[ "$os" == "Browser" && "$arch" != "wasm" ]]; then arch=wasm fi -initDistroRid $os $arch $crossBuild $portableBuild +initDistroRid $os $arch $crossBuild $portableBuild "$packageRid" # 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. diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 4199828f2970b..5942a546db305 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -11,7 +11,7 @@ initTargetDistroRid() passedRootfsDir="$ROOTFS_DIR" fi - initDistroRidGlobal "$__TargetOS" "$__TargetArch" "$__PortableBuild" "$passedRootfsDir" + initDistroRidGlobal "$__TargetOS" "$__TargetArch" "$__PortableBuild" "$packageRid" "$passedRootfsDir" } setup_dirs() @@ -212,6 +212,7 @@ usage() echo "-gccx.y: optional argument to build using gcc version x.y." echo "-ninja: target ninja instead of GNU make" echo "-numproc: set the number of build processes." + echo "-packagerid: optional argument that overrides the target rid name." echo "-portablebuild: pass -portablebuild=false to force a non-portable build." echo "-skipconfigure: skip build configuration." echo "-keepnativesymbols: keep native/unmanaged debug symbols." @@ -253,6 +254,8 @@ else fi fi +packageRid='' + while :; do if [[ "$#" -le 0 ]]; then break @@ -396,6 +399,16 @@ while :; do __TargetArch=wasm ;; + packagerid|-packagerid) + if [[ -n "$2" ]]; then + packageRid="$2" + shift + else + echo "ERROR: 'packageRid' requires a non-empty option argument" + exit 1 + fi + ;; + ppc64le|-ppc64le) __TargetArch=ppc64le ;; diff --git a/eng/native/init-distro-rid.sh b/eng/native/init-distro-rid.sh index 75012240633da..b852dd59fe7db 100644 --- a/eng/native/init-distro-rid.sh +++ b/eng/native/init-distro-rid.sh @@ -132,71 +132,76 @@ initDistroRidGlobal() local targetOs="$1" local buildArch="$2" local isPortable="$3" + local packageRid="$4" local rootfsDir="" - if [ "$#" -ge 4 ]; then - rootfsDir="$4" + if [ "$#" -ge 5 ]; then + rootfsDir="$5" fi - if [ -n "${rootfsDir}" ]; then - # We may have a cross build. Check for the existence of the rootfsDir - if [ ! -e "${rootfsDir}" ]; then - echo "Error rootfsDir has been passed, but the location is not valid." - exit 1 + if [ -n "$packageRid" ]; then + export __DistroRid=$packageRid + else + if [ -n "${rootfsDir}" ]; then + # We may have a cross build. Check for the existence of the rootfsDir + if [ ! -e "${rootfsDir}" ]; then + echo "Error rootfsDir has been passed, but the location is not valid." + exit 1 + fi fi - fi - initNonPortableDistroRid "${targetOs}" "${buildArch}" "${isPortable}" "${rootfsDir}" + initNonPortableDistroRid "${targetOs}" "${buildArch}" "${isPortable}" "${rootfsDir}" - if [ "$buildArch" = "wasm" ]; then - __DistroRid=browser-wasm - export __DistroRid - fi + if [ "$buildArch" = "wasm" ]; then + __DistroRid=browser-wasm + export __DistroRid + fi - if [ -z "${__DistroRid}" ]; then - # The non-portable build rid was not set. Set the portable rid. + if [ -z "${__DistroRid}" ]; then + # The non-portable build rid was not set. Set the portable rid. - __PortableBuild=1 - export __PortableBuild - local distroRid="" + __PortableBuild=1 + export __PortableBuild + local distroRid="" - # Check for musl-based distros (e.g Alpine Linux, Void Linux). - if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl || - strings "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl; then - distroRid="linux-musl-${buildArch}" - fi + # Check for musl-based distros (e.g Alpine Linux, Void Linux). + if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl || + strings "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl; then + distroRid="linux-musl-${buildArch}" + fi - if [ -z "${distroRid}" ]; then - if [ "$targetOs" = "Linux" ]; then - distroRid="linux-$buildArch" - elif [ "$targetOs" = "linux-bionic" ]; then - distroRid="linux-bionic-$buildArch" - elif [ "$targetOs" = "OSX" ]; then - distroRid="osx-$buildArch" - elif [ "$targetOs" = "MacCatalyst" ]; then - distroRid="maccatalyst-$buildArch" - elif [ "$targetOs" = "tvOS" ]; then - distroRid="tvos-$buildArch" - elif [ "$targetOs" = "tvOSSimulator" ]; then - distroRid="tvossimulator-$buildArch" - elif [ "$targetOs" = "iOS" ]; then - distroRid="ios-$buildArch" - elif [ "$targetOs" = "iOSSimulator" ]; then - distroRid="iossimulator-$buildArch" - elif [ "$targetOs" = "Android" ]; then - distroRid="android-$buildArch" - elif [ "$targetOs" = "Browser" ]; then - distroRid="browser-$buildArch" - elif [ "$targetOs" = "FreeBSD" ]; then - distroRid="freebsd-$buildArch" - elif [ "$targetOs" = "illumos" ]; then - distroRid="illumos-$buildArch" - elif [ "$targetOs" = "Solaris" ]; then - distroRid="solaris-$buildArch" + if [ -z "${distroRid}" ]; then + if [ "$targetOs" = "Linux" ]; then + distroRid="linux-$buildArch" + elif [ "$targetOs" = "linux-bionic" ]; then + distroRid="linux-bionic-$buildArch" + elif [ "$targetOs" = "OSX" ]; then + distroRid="osx-$buildArch" + elif [ "$targetOs" = "MacCatalyst" ]; then + distroRid="maccatalyst-$buildArch" + elif [ "$targetOs" = "tvOS" ]; then + distroRid="tvos-$buildArch" + elif [ "$targetOs" = "tvOSSimulator" ]; then + distroRid="tvossimulator-$buildArch" + elif [ "$targetOs" = "iOS" ]; then + distroRid="ios-$buildArch" + elif [ "$targetOs" = "iOSSimulator" ]; then + distroRid="iossimulator-$buildArch" + elif [ "$targetOs" = "Android" ]; then + distroRid="android-$buildArch" + elif [ "$targetOs" = "Browser" ]; then + distroRid="browser-$buildArch" + elif [ "$targetOs" = "FreeBSD" ]; then + distroRid="freebsd-$buildArch" + elif [ "$targetOs" = "illumos" ]; then + distroRid="illumos-$buildArch" + elif [ "$targetOs" = "Solaris" ]; then + distroRid="solaris-$buildArch" + fi fi - fi - __DistroRid="${distroRid}" - export __DistroRid + __DistroRid="${distroRid}" + export __DistroRid + fi fi if [ -z "$__DistroRid" ]; then diff --git a/src/native/corehost/corehost.proj b/src/native/corehost/corehost.proj index 9ce1a640eadaa..5999086ddae56 100644 --- a/src/native/corehost/corehost.proj +++ b/src/native/corehost/corehost.proj @@ -81,6 +81,7 @@ $(BuildArgs) -ninja $(BuildArgs) -runtimeflavor $(RuntimeFlavor) $(BuildArgs) /p:OfficialBuildId="$(OfficialBuildId)" + $(BuildArgs) -packagerid $(PackageRid) diff --git a/src/native/corehost/corehost.proj b/src/native/corehost/corehost.proj index 76e1dbaa677b9..58093203c2503 100644 --- a/src/native/corehost/corehost.proj +++ b/src/native/corehost/corehost.proj @@ -81,7 +81,7 @@ $(BuildArgs) -ninja $(BuildArgs) -runtimeflavor $(RuntimeFlavor) $(BuildArgs) /p:OfficialBuildId="$(OfficialBuildId)" - $(BuildArgs) -distrorid $(PackageRid) + $(BuildArgs) -distrorid $(OutputRid) $(OutputRid) - $(OutputRid) + $(PackageRID) <_TargetsAppleOS Condition="'$(TargetOS)' == 'OSX' or '$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOSSimulator'">true From d89911f74ac9d8efa4c0447c80d7d614f04eb7b3 Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Wed, 31 Aug 2022 18:42:43 +0200 Subject: [PATCH 08/20] Rename --distrorid to --outputrid. --- eng/build.sh | 9 ++- eng/native/build-commons.sh | 13 ++-- eng/native/init-distro-rid.sh | 110 +++++++++++++++--------------- src/native/corehost/build.sh | 7 +- src/native/corehost/corehost.proj | 2 +- 5 files changed, 71 insertions(+), 70 deletions(-) diff --git a/eng/build.sh b/eng/build.sh index a8172baafcdc6..352761a5208b9 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -31,7 +31,7 @@ usage() echo " --os Target operating system: windows, Linux, FreeBSD, OSX, MacCatalyst, tvOS," echo " tvOSSimulator, iOS, iOSSimulator, Android, Browser, NetBSD, illumos or Solaris." echo " [Default: Your machine's OS.]" - echo " --distrorid Optional argument that overrides the target rid name." + echo " --outputrid Optional argument that overrides the target rid name." echo " --projects Project or solution file(s) to build." echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked." echo " Checked is exclusive to the CLR runtime. It is the same as Debug, except code is" @@ -403,13 +403,12 @@ while [[ $# > 0 ]]; do shift 1 ;; - -distrorid) + -outputrid) if [ -z ${2+x} ]; then - echo "No value for distrorid is supplied. See help (--help) for supported values." 1>&2 + echo "No value for outputrid is supplied. See help (--help) for supported values." 1>&2 exit 1 fi - __DistroRid="$(echo "$2" | tr "[:upper:]" "[:lower:]")" - arguments="$arguments /p:OutputRid=$__DistroRid" + arguments="$arguments /p:OutputRid=$(echo "$2" | tr "[:upper:]" "[:lower:]")" shift 2 ;; diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 952a3edf79e20..bc0083eed7185 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -212,7 +212,7 @@ usage() echo "-gccx.y: optional argument to build using gcc version x.y." echo "-ninja: target ninja instead of GNU make" echo "-numproc: set the number of build processes." - echo "-distrorid: optional argument that overrides the target rid name." + echo "-outputrid: optional argument that overrides the target rid name." echo "-portablebuild: pass -portablebuild=false to force a non-portable build." echo "-skipconfigure: skip build configuration." echo "-keepnativesymbols: keep native/unmanaged debug symbols." @@ -233,6 +233,7 @@ __TargetArch=$arch __TargetOS=$os __HostOS=$os __BuildOS=$os +__OutputRid='' # Get the number of processors available to the scheduler # Other techniques such as `nproc` only get the number of @@ -397,12 +398,12 @@ while :; do __TargetArch=wasm ;; - distrorid|-distrorid) + outputrid|-outputrid) if [[ -n "$2" ]]; then - __DistroRid="$2" + __OutputRid="$2" shift else - echo "ERROR: 'distrorid' requires a non-empty option argument" + echo "ERROR: 'outputrid' requires a non-empty option argument" exit 1 fi ;; @@ -489,3 +490,7 @@ fi # init the target distro name initTargetDistroRid + +if [ -z "$__OutputRid" ]; then + __OutputRid="$(echo $__DistroRid | tr '[:upper:]' '[:lower:]')" +fi diff --git a/eng/native/init-distro-rid.sh b/eng/native/init-distro-rid.sh index 3c217eb5c1200..86d319d8ef5a2 100644 --- a/eng/native/init-distro-rid.sh +++ b/eng/native/init-distro-rid.sh @@ -137,72 +137,70 @@ initDistroRidGlobal() rootfsDir="$4" fi - if [ -z "${__DistroRid:-}" ]; then - if [ -n "${rootfsDir}" ]; then - # We may have a cross build. Check for the existence of the rootfsDir - if [ ! -e "${rootfsDir}" ]; then - echo "Error rootfsDir has been passed, but the location is not valid." - exit 1 - fi + if [ -n "${rootfsDir}" ]; then + # We may have a cross build. Check for the existence of the rootfsDir + if [ ! -e "${rootfsDir}" ]; then + echo "Error rootfsDir has been passed, but the location is not valid." + exit 1 fi + fi - initNonPortableDistroRid "${targetOs}" "${buildArch}" "${isPortable}" "${rootfsDir}" + initNonPortableDistroRid "${targetOs}" "${buildArch}" "${isPortable}" "${rootfsDir}" - if [ "$buildArch" = "wasm" ]; then - __DistroRid=browser-wasm - export __DistroRid - fi + if [ "$buildArch" = "wasm" ]; then + __DistroRid=browser-wasm + export __DistroRid + fi - if [ -z "${__DistroRid}" ]; then - # The non-portable build rid was not set. Set the portable rid. + if [ -z "${__DistroRid}" ]; then + # The non-portable build rid was not set. Set the portable rid. - __PortableBuild=1 - export __PortableBuild - local distroRid="" + __PortableBuild=1 + export __PortableBuild + local distroRid="" - # Check for musl-based distros (e.g Alpine Linux, Void Linux). - if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl || - strings "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl; then - distroRid="linux-musl-${buildArch}" - fi + # Check for musl-based distros (e.g Alpine Linux, Void Linux). + if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl || + strings "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl; then + distroRid="linux-musl-${buildArch}" + fi - if [ -z "${distroRid}" ]; then - if [ "$targetOs" = "Linux" ]; then - distroRid="linux-$buildArch" - elif [ "$targetOs" = "linux-bionic" ]; then - distroRid="linux-bionic-$buildArch" - elif [ "$targetOs" = "OSX" ]; then - distroRid="osx-$buildArch" - elif [ "$targetOs" = "MacCatalyst" ]; then - distroRid="maccatalyst-$buildArch" - elif [ "$targetOs" = "tvOS" ]; then - distroRid="tvos-$buildArch" - elif [ "$targetOs" = "tvOSSimulator" ]; then - distroRid="tvossimulator-$buildArch" - elif [ "$targetOs" = "iOS" ]; then - distroRid="ios-$buildArch" - elif [ "$targetOs" = "iOSSimulator" ]; then - distroRid="iossimulator-$buildArch" - elif [ "$targetOs" = "Android" ]; then - distroRid="android-$buildArch" - elif [ "$targetOs" = "Browser" ]; then - distroRid="browser-$buildArch" - elif [ "$targetOs" = "FreeBSD" ]; then - distroRid="freebsd-$buildArch" - elif [ "$targetOs" = "illumos" ]; then - distroRid="illumos-$buildArch" - elif [ "$targetOs" = "Solaris" ]; then - distroRid="solaris-$buildArch" - fi + if [ -z "${distroRid}" ]; then + if [ "$targetOs" = "Linux" ]; then + distroRid="linux-$buildArch" + elif [ "$targetOs" = "linux-bionic" ]; then + distroRid="linux-bionic-$buildArch" + elif [ "$targetOs" = "OSX" ]; then + distroRid="osx-$buildArch" + elif [ "$targetOs" = "MacCatalyst" ]; then + distroRid="maccatalyst-$buildArch" + elif [ "$targetOs" = "tvOS" ]; then + distroRid="tvos-$buildArch" + elif [ "$targetOs" = "tvOSSimulator" ]; then + distroRid="tvossimulator-$buildArch" + elif [ "$targetOs" = "iOS" ]; then + distroRid="ios-$buildArch" + elif [ "$targetOs" = "iOSSimulator" ]; then + distroRid="iossimulator-$buildArch" + elif [ "$targetOs" = "Android" ]; then + distroRid="android-$buildArch" + elif [ "$targetOs" = "Browser" ]; then + distroRid="browser-$buildArch" + elif [ "$targetOs" = "FreeBSD" ]; then + distroRid="freebsd-$buildArch" + elif [ "$targetOs" = "illumos" ]; then + distroRid="illumos-$buildArch" + elif [ "$targetOs" = "Solaris" ]; then + distroRid="solaris-$buildArch" fi - - __DistroRid="${distroRid}" fi - if [ -z "$__DistroRid" ]; then - echo "DistroRid is not set. This is almost certainly an error" - exit 1 - fi + __DistroRid="${distroRid}" + fi + + if [ -z "$__DistroRid" ]; then + echo "DistroRid is not set. This is almost certainly an error" + exit 1 fi export __DistroRid diff --git a/src/native/corehost/build.sh b/src/native/corehost/build.sh index ae44091c54892..f300b10f672f5 100755 --- a/src/native/corehost/build.sh +++ b/src/native/corehost/build.sh @@ -74,14 +74,13 @@ __LogsDir="$__RootBinDir/log" __MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs" # Set the remaining variables based upon the determined build configuration -__DistroRidLower="$(echo $__DistroRid | tr '[:upper:]' '[:lower:]')" -__BinDir="$__RootBinDir/bin/$__DistroRidLower.$__BuildType" -__IntermediatesDir="$__RootBinDir/obj/$__DistroRidLower.$__BuildType" +__BinDir="$__RootBinDir/bin/$__OutputRid.$__BuildType" +__IntermediatesDir="$__RootBinDir/obj/$__OutputRid.$__BuildType" export __BinDir __IntermediatesDir __RuntimeFlavor __CMakeArgs="-DCLI_CMAKE_HOST_VER=\"$__host_ver\" -DCLI_CMAKE_COMMON_HOST_VER=\"$__apphost_ver\" -DCLI_CMAKE_HOST_FXR_VER=\"$__fxr_ver\" $__CMakeArgs" -__CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__DistroRid\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs" +__CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__OutputRid\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs" __CMakeArgs="-DRUNTIME_FLAVOR=\"$__RuntimeFlavor\" $__CMakeArgs" __CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs" diff --git a/src/native/corehost/corehost.proj b/src/native/corehost/corehost.proj index 6910d2a21e925..a320ab4d814ab 100644 --- a/src/native/corehost/corehost.proj +++ b/src/native/corehost/corehost.proj @@ -81,7 +81,7 @@ $(BuildArgs) -ninja $(BuildArgs) -runtimeflavor $(RuntimeFlavor) $(BuildArgs) /p:OfficialBuildId="$(OfficialBuildId)" - $(BuildArgs) -distrorid $(OutputRid) + $(BuildArgs) -outputrid $(OutputRid) <_targetRidPlatformIndex>$(TargetRid.LastIndexOf('-')) - $(TargetRid.Substring(0, $(_targetRidPlatformIndex))) - $(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-')) + $(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-')) minimal @@ -26,7 +25,7 @@ - $(InnerBuildArgs) --arch $(TargetRidPlatform) + $(InnerBuildArgs) --arch $(TargetArch) $(InnerBuildArgs) --configuration $(Configuration) $(InnerBuildArgs) --allconfigurations $(InnerBuildArgs) --verbosity $(LogVerbosity) @@ -36,7 +35,6 @@ $(InnerBuildArgs) --portablebuild $(SourceBuildPortable) $(InnerBuildArgs) /p:NoPgoOptimize=true $(InnerBuildArgs) /p:KeepNativeSymbols=true - $(InnerBuildArgs) /p:RuntimeOS=$(TargetRidWithoutPlatform) $(InnerBuildArgs) /p:BuildDebPackage=false $(InnerBuildArgs) /p:EnableNgenOptimization=false From 9244703acd864c712865248dba17df3bb67965ab Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Fri, 2 Sep 2022 08:57:19 +0200 Subject: [PATCH 13/20] SourceBuild.props: set AdditionalRuntimeIdentifierParent. --- eng/SourceBuild.props | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index 1227e68608bc0..2626cacd19346 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -19,6 +19,8 @@ <_targetRidPlatformIndex>$(TargetRid.LastIndexOf('-')) $(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-')) + linux-$(TargetArch) + minimal @@ -37,6 +39,7 @@ $(InnerBuildArgs) /p:KeepNativeSymbols=true $(InnerBuildArgs) /p:BuildDebPackage=false $(InnerBuildArgs) /p:EnableNgenOptimization=false + $(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(AdditionalRuntimeIdentifierParent) From 77958f979737701c6b4220a1ddecc6b6d8d7005a Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Fri, 2 Sep 2022 09:18:12 +0200 Subject: [PATCH 14/20] Build banana.24-x64 instead. --- eng/SourceBuild.props | 14 +++++++++----- eng/pipelines/common/global-build-job.yml | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index 2626cacd19346..78c664376b579 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -15,11 +15,14 @@ $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) $(__DistroRid) - - <_targetRidPlatformIndex>$(TargetRid.LastIndexOf('-')) - $(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-')) + + <_targetRidArchIndex>$(TargetRid.LastIndexOf('-')) + $(TargetRid.Substring($(_targetRidArchIndex)).TrimStart('-')) + <_distroRidIndex>$(TargetRid.FirstIndexOf('.')) + $(TargetRid.Substring(0, $(_distroRidIndex))-$(TargetArch) - linux-$(TargetArch) + + linux-$(TargetArch) minimal @@ -39,7 +42,8 @@ $(InnerBuildArgs) /p:KeepNativeSymbols=true $(InnerBuildArgs) /p:BuildDebPackage=false $(InnerBuildArgs) /p:EnableNgenOptimization=false - $(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(AdditionalRuntimeIdentifierParent) + $(InnerBuildArgs) /p:AdditionalRuntimeIdentifiers=$(DistroRid) + $(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseRid) diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index b036919662179..b15847aadeea7 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -141,7 +141,7 @@ jobs: platform: buildScript: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt) nonPortable: true - targetRID: banana-x64 + targetRID: banana.24-x64 - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO From 2b3a641fe1df223c1f7105b276a7335a82c8ca53 Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Fri, 2 Sep 2022 09:56:43 +0200 Subject: [PATCH 15/20] Fix SourceBuild.props. --- eng/SourceBuild.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index 78c664376b579..10965d4a067ff 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -18,8 +18,8 @@ <_targetRidArchIndex>$(TargetRid.LastIndexOf('-')) $(TargetRid.Substring($(_targetRidArchIndex)).TrimStart('-')) - <_distroRidIndex>$(TargetRid.FirstIndexOf('.')) - $(TargetRid.Substring(0, $(_distroRidIndex))-$(TargetArch) + <_distroRidIndex>$(TargetRid.IndexOf('.')) + $(TargetRid.Substring(0, $(_distroRidIndex)))-$(TargetArch) linux-$(TargetArch) From 763dc66733d168100322c38a5126137bef95a5dc Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Fri, 2 Sep 2022 12:24:02 +0200 Subject: [PATCH 16/20] SourceBuild.props: try fix AdditionalRuntimeIdentifier* usage. --- eng/SourceBuild.props | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index 10965d4a067ff..2e49df0143259 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -15,14 +15,12 @@ $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) $(__DistroRid) - + <_targetRidArchIndex>$(TargetRid.LastIndexOf('-')) $(TargetRid.Substring($(_targetRidArchIndex)).TrimStart('-')) - <_distroRidIndex>$(TargetRid.IndexOf('.')) - $(TargetRid.Substring(0, $(_distroRidIndex)))-$(TargetArch) - - linux-$(TargetArch) + + linux minimal @@ -42,8 +40,7 @@ $(InnerBuildArgs) /p:KeepNativeSymbols=true $(InnerBuildArgs) /p:BuildDebPackage=false $(InnerBuildArgs) /p:EnableNgenOptimization=false - $(InnerBuildArgs) /p:AdditionalRuntimeIdentifiers=$(DistroRid) - $(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseRid) + $(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseRidOS) From a9da4afabda4bc65bd498552c8f9230e9aa30f18 Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Fri, 2 Sep 2022 12:46:36 +0200 Subject: [PATCH 17/20] source-build.yml: add runtimeOS parameter. --- eng/SourceBuild.props | 8 +++++--- eng/common/templates/steps/source-build.yml | 6 ++++++ eng/pipelines/common/global-build-job.yml | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index 2e49df0143259..0272b16c9c6eb 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -15,9 +15,10 @@ $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) $(__DistroRid) - - <_targetRidArchIndex>$(TargetRid.LastIndexOf('-')) - $(TargetRid.Substring($(_targetRidArchIndex)).TrimStart('-')) + + <_targetRidPlatformIndex>$(TargetRid.LastIndexOf('-')) + $(TargetRid.Substring(0, $(_targetRidPlatformIndex))) + $(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-')) linux @@ -38,6 +39,7 @@ $(InnerBuildArgs) --portablebuild $(SourceBuildPortable) $(InnerBuildArgs) /p:NoPgoOptimize=true $(InnerBuildArgs) /p:KeepNativeSymbols=true + $(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS) $(InnerBuildArgs) /p:BuildDebPackage=false $(InnerBuildArgs) /p:EnableNgenOptimization=false $(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseRidOS) diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml index 12a8ff94d8e96..4624885e3bfeb 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -63,6 +63,11 @@ steps: targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' fi + runtimeOsArgs= + if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then + runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' + fi + publishArgs= if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then publishArgs='--publish' @@ -75,6 +80,7 @@ steps: $internalRuntimeDownloadArgs \ $internalRestoreArgs \ $targetRidArgs \ + $runtimeOsArgs \ /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ /p:ArcadeBuildFromSource=true displayName: Build diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index b15847aadeea7..e043c0040661f 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -142,6 +142,7 @@ jobs: buildScript: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt) nonPortable: true targetRID: banana.24-x64 + runtimeOS: linux - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO From 0b228a7abb21c1f8b40d97037bf69a6a83f64d47 Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Tue, 27 Sep 2022 08:13:08 +0200 Subject: [PATCH 18/20] SourceBuild.props: derive RuntimeOS from NETCoreSdkRuntimeIdentifier. --- eng/SourceBuild.props | 13 +++++++------ eng/common/templates/steps/source-build.yml | 6 ------ eng/pipelines/common/global-build-job.yml | 1 - 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index e24b5ae926fc3..bebdcc2cf24c3 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -15,13 +15,14 @@ $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) $(__DistroRid) - + <_sdkRuntimeIdentifierPlatformIndex>$(NETCoreSdkRuntimeIdentifier.LastIndexOf('-')) + $(NETCoreSdkRuntimeIdentifier.Substring(0, $(_sdkRuntimeIdentifierPlatformIndex))) + <_targetRidPlatformIndex>$(TargetRid.LastIndexOf('-')) - $(TargetRid.Substring(0, $(_targetRidPlatformIndex))) $(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-')) - - linux + + $(BootstrapOS) minimal @@ -39,12 +40,12 @@ $(InnerBuildArgs) --portablebuild $(SourceBuildPortable) $(InnerBuildArgs) /p:NoPgoOptimize=true $(InnerBuildArgs) /p:KeepNativeSymbols=true - $(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS) + $(InnerBuildArgs) /p:RuntimeOS=$(BootstrapOS) $(InnerBuildArgs) /p:OfficialBuildId=$(OfficialBuildId) $(InnerBuildArgs) /p:ContinuousIntegrationBuild=$(ContinuousIntegrationBuild) $(InnerBuildArgs) /p:BuildDebPackage=false $(InnerBuildArgs) /p:EnableNgenOptimization=false - $(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseRidOS) + $(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS) diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml index 4624885e3bfeb..12a8ff94d8e96 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -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 - publishArgs= if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then publishArgs='--publish' @@ -80,7 +75,6 @@ steps: $internalRuntimeDownloadArgs \ $internalRestoreArgs \ $targetRidArgs \ - $runtimeOsArgs \ /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ /p:ArcadeBuildFromSource=true displayName: Build diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index e043c0040661f..b15847aadeea7 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -142,7 +142,6 @@ jobs: buildScript: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt) nonPortable: true targetRID: banana.24-x64 - runtimeOS: linux - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO From 5aa074afe2e112fe732b09ad06fa1c37a165737a Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Tue, 27 Sep 2022 10:27:24 +0200 Subject: [PATCH 19/20] Undo using NETCoreSdkRuntimeIdentifier. --- eng/SourceBuild.props | 16 +++++++++------- eng/common/templates/steps/source-build.yml | 6 ++++++ eng/pipelines/common/global-build-job.yml | 1 + 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index bebdcc2cf24c3..ebf8e683ed0ce 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -11,18 +11,20 @@ true false - + $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) $(__DistroRid) - <_sdkRuntimeIdentifierPlatformIndex>$(NETCoreSdkRuntimeIdentifier.LastIndexOf('-')) - $(NETCoreSdkRuntimeIdentifier.Substring(0, $(_sdkRuntimeIdentifierPlatformIndex))) - + <_targetRidPlatformIndex>$(TargetRid.LastIndexOf('-')) $(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-')) - - $(BootstrapOS) + + $(TargetRid.Substring(0, $(_targetRidPlatformIndex))) + + + $(RuntimeOS) minimal @@ -40,7 +42,7 @@ $(InnerBuildArgs) --portablebuild $(SourceBuildPortable) $(InnerBuildArgs) /p:NoPgoOptimize=true $(InnerBuildArgs) /p:KeepNativeSymbols=true - $(InnerBuildArgs) /p:RuntimeOS=$(BootstrapOS) + $(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS) $(InnerBuildArgs) /p:OfficialBuildId=$(OfficialBuildId) $(InnerBuildArgs) /p:ContinuousIntegrationBuild=$(ContinuousIntegrationBuild) $(InnerBuildArgs) /p:BuildDebPackage=false diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml index 12a8ff94d8e96..4624885e3bfeb 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -63,6 +63,11 @@ steps: targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' fi + runtimeOsArgs= + if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then + runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' + fi + publishArgs= if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then publishArgs='--publish' @@ -75,6 +80,7 @@ steps: $internalRuntimeDownloadArgs \ $internalRestoreArgs \ $targetRidArgs \ + $runtimeOsArgs \ /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ /p:ArcadeBuildFromSource=true displayName: Build diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index b15847aadeea7..e043c0040661f 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -142,6 +142,7 @@ jobs: buildScript: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt) nonPortable: true targetRID: banana.24-x64 + runtimeOS: linux - ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}: - script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO From 1965c296fe1b07adcb2fae87cb1b8867a0141bed Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Tue, 27 Sep 2022 18:35:06 +0200 Subject: [PATCH 20/20] Update eng/pipelines/common/global-build-job.yml Co-authored-by: Jeremy Koritzinsky --- eng/pipelines/common/global-build-job.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml index e043c0040661f..61ee087bfa0cc 100644 --- a/eng/pipelines/common/global-build-job.yml +++ b/eng/pipelines/common/global-build-job.yml @@ -141,6 +141,7 @@ jobs: platform: buildScript: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt) nonPortable: true + # Use a custom RID that isn't in the RID graph here to validate we don't break the usage of custom rids that aren't in the graph. targetRID: banana.24-x64 runtimeOS: linux