From 59e6ebbc6f69fa345b855826eb9b9bcae1ce8b75 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 9 Nov 2026 05:03:42 +0000 Subject: [PATCH 1/3] Update dependencies from build 340367 Updated Dependencies: Microsoft.DotNet.Arcade.Sdk (Version 12.0.0-beta.26551.101 -> 12.0.0-beta.26556.115) System.CommandLine (Version 4.0.0-alpha.1.26551.101 -> 4.0.0-alpha.1.26556.115) System.IO.Hashing, System.Security.Cryptography.Xml, System.Text.Json (Version 12.0.0-alpha.1.26551.101 -> 12.0.0-alpha.1.26556.115) [[ commit created by automation ]] --- eng/Version.Details.props | 10 ++-- eng/Version.Details.xml | 22 +++---- .../job/publish-build-assets.yml | 4 +- .../core-templates/post-build/post-build.yml | 2 +- eng/common/cross/build-rootfs.sh | 11 +--- eng/common/cross/tizen-build-rootfs.sh | 3 - eng/common/cross/toolchain.cmake | 58 +++---------------- eng/common/cross/x86/tizen/tizen.patch | 9 --- global.json | 6 +- 9 files changed, 31 insertions(+), 94 deletions(-) delete mode 100644 eng/common/cross/x86/tizen/tizen.patch diff --git a/eng/Version.Details.props b/eng/Version.Details.props index fe979b05fb..78b798e301 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,11 +6,11 @@ This file should be imported by eng/Versions.props - 12.0.0-beta.26551.101 - 4.0.0-alpha.1.26551.101 - 12.0.0-alpha.1.26551.101 - 12.0.0-alpha.1.26551.101 - 12.0.0-alpha.1.26551.101 + 12.0.0-beta.26556.115 + 4.0.0-alpha.1.26556.115 + 12.0.0-alpha.1.26556.115 + 12.0.0-alpha.1.26556.115 + 12.0.0-alpha.1.26556.115 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index af13bd3625..b849030546 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,28 +1,28 @@ - + - + https://github.com/dotnet/dotnet - e2a826638ffc3d7c2b3e72ccf827ddfe96269d57 + 6e6f978fd9ca19b62796a13ff5230b21af0c42fa - + https://github.com/dotnet/dotnet - e2a826638ffc3d7c2b3e72ccf827ddfe96269d57 + 6e6f978fd9ca19b62796a13ff5230b21af0c42fa - + https://github.com/dotnet/dotnet - e2a826638ffc3d7c2b3e72ccf827ddfe96269d57 + 6e6f978fd9ca19b62796a13ff5230b21af0c42fa - + https://github.com/dotnet/dotnet - e2a826638ffc3d7c2b3e72ccf827ddfe96269d57 + 6e6f978fd9ca19b62796a13ff5230b21af0c42fa - + https://github.com/dotnet/dotnet - e2a826638ffc3d7c2b3e72ccf827ddfe96269d57 + 6e6f978fd9ca19b62796a13ff5230b21af0c42fa diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index 330225ae09..5b2a930256 100644 --- a/eng/common/core-templates/job/publish-build-assets.yml +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -187,10 +187,10 @@ jobs: PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} is1ESPipeline: ${{ parameters.is1ESPipeline }} - # Darc is targeting 8.0, so make sure it's installed + # Darc is targeting 10.0, so make sure it's installed - task: UseDotNet@2 inputs: - version: 8.0.x + version: 10.0.x - task: AzureCLI@2 displayName: Publish Using Darc diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml index 6dcee6664d..6b0875baf6 100644 --- a/eng/common/core-templates/post-build/post-build.yml +++ b/eng/common/core-templates/post-build/post-build.yml @@ -301,7 +301,7 @@ stages: - task: UseDotNet@2 inputs: - version: 8.0.x + version: 10.0.x - task: AzureCLI@2 displayName: Publish Using Darc diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 3ce35ed12f..98e02db627 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -5,7 +5,7 @@ set -e usage() { echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [llvmx[.y]] [--skipunmount] --rootfsdir ]" - echo "BuildArch can be: arm(default), arm64, loongarch64, ppc64le, riscv64, s390x, x64, x86" + echo "BuildArch can be: arm(default), arm64, loongarch64, ppc64le, riscv64, s390x, x64" echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine" echo " for alpine can be specified with version: alpineX.YY or alpineedge" echo " for FreeBSD can be: freebsd14, freebsd15" @@ -230,12 +230,6 @@ while :; do __HaikuArch=x86_64 __UbuntuRepo="https://archive.ubuntu.com/ubuntu/" ;; - x86) - __BuildArch=x86 - __UbuntuArch=i386 - __AlpineArch=x86 - __UbuntuRepo="https://archive.ubuntu.com/ubuntu/" - ;; lldb*) version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" majorVersion="${version%%.*}" @@ -460,9 +454,6 @@ case "$__AlpineVersion" in if [[ "$__AlpineArch" =~ s390x|ppc64le ]]; then __AlpineVersion=3.15 # minimum version that supports lldb-dev __AlpinePackages+=" llvm12-libs" - elif [[ "$__AlpineArch" == "x86" ]]; then - __AlpineVersion=3.17 # minimum version that supports lldb-dev - __AlpinePackages+=" llvm15-libs" elif [[ "$__AlpineArch" == "loongarch64" ]]; then __AlpineVersion=3.21 # minimum version that supports lldb-dev __AlpinePackages+=" llvm19-libs" diff --git a/eng/common/cross/tizen-build-rootfs.sh b/eng/common/cross/tizen-build-rootfs.sh index ba31c93285..2f86370665 100755 --- a/eng/common/cross/tizen-build-rootfs.sh +++ b/eng/common/cross/tizen-build-rootfs.sh @@ -15,9 +15,6 @@ case "$ARCH" in arm64) TIZEN_ARCH="aarch64" ;; - x86) - TIZEN_ARCH="i686" - ;; x64) TIZEN_ARCH="x86_64" LINK_ARCH="x86" diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index ba77071090..71f10f422b 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -130,18 +130,8 @@ elseif(TARGET_ARCH_NAME STREQUAL "x64") elseif(HAIKU) set(TOOLCHAIN "x86_64-unknown-haiku") endif() -elseif(TARGET_ARCH_NAME STREQUAL "x86") - set(CMAKE_SYSTEM_PROCESSOR i686) - if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) - set(TOOLCHAIN "i586-alpine-linux-musl") - else() - set(TOOLCHAIN "i686-linux-gnu") - endif() - if(TIZEN) - set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu") - endif() else() - message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm, arm64, armel, armv6, loongarch64, ppc64le, riscv64, s390x, x64 and x86 are supported!") + message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm, arm64, armel, armv6, loongarch64, ppc64le, riscv64, s390x and x64 are supported!") endif() if(DEFINED ENV{TOOLCHAIN}) @@ -159,7 +149,7 @@ if(TIZEN) set(TIZEN_TOOLCHAIN_PATH "${prefix}/${TOOLCHAIN_VERSION}" PARENT_SCOPE) endfunction() - if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") + if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") find_toolchain_dir("${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") else() find_toolchain_dir("${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") @@ -300,18 +290,6 @@ elseif(TARGET_ARCH_NAME MATCHES "^(arm64|x64|riscv64)$") endif() elseif(TARGET_ARCH_NAME STREQUAL "s390x") add_toolchain_linker_flag("--target=${TOOLCHAIN}") -elseif(TARGET_ARCH_NAME STREQUAL "x86") - if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) - add_toolchain_linker_flag("--target=${TOOLCHAIN}") - add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}") - endif() - add_toolchain_linker_flag(-m32) - if(TIZEN) - add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") - add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") - add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") - add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") - endif() elseif(ILLUMOS) add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib/amd64") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/amd64/lib") @@ -322,7 +300,7 @@ endif() # Specify compile options -if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|loongarch64|ppc64le|riscv64|s390x|x64|x86)$" AND NOT ANDROID AND NOT OPENHARMONY AND NOT FREEBSD AND NOT OPENBSD) OR ILLUMOS OR HAIKU) +if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|loongarch64|ppc64le|riscv64|s390x|x64)$" AND NOT ANDROID AND NOT OPENHARMONY AND NOT FREEBSD AND NOT OPENBSD) OR ILLUMOS OR HAIKU) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN}) @@ -349,46 +327,26 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") endif() elseif(TARGET_ARCH_NAME STREQUAL "s390x") add_compile_options("--target=${TOOLCHAIN}") -elseif(TARGET_ARCH_NAME STREQUAL "x86") - if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) - add_compile_options(--target=${TOOLCHAIN}) - endif() - add_compile_options(-m32) - add_compile_options(-Wno-error=unused-command-line-argument) endif() if(TIZEN) - if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64|x86)$") + if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$") add_compile_options(-Wno-deprecated-declarations) # compile-time option add_compile_options(-D__extern_always_inline=inline) # compile-time option endif() endif() # Set LLDB include and library paths for builds that need lldb. -if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") - if(TARGET_ARCH_NAME STREQUAL "x86") - set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}") - else() # arm/armel case - set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}") - endif() +if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") + set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}") if(LLVM_CROSS_DIR) set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "") set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "") set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "") set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "") else() - if(TARGET_ARCH_NAME STREQUAL "x86") - set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "") - set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include") - if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}") - set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}") - else() - set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include") - endif() - else() # arm/armel case - set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "") - set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "") - endif() + set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "") + set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "") endif() endif() diff --git a/eng/common/cross/x86/tizen/tizen.patch b/eng/common/cross/x86/tizen/tizen.patch deleted file mode 100644 index f4fe8838ad..0000000000 --- a/eng/common/cross/x86/tizen/tizen.patch +++ /dev/null @@ -1,9 +0,0 @@ -diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so ---- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 -+++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 -@@ -2,4 +2,4 @@ - Use the shared library, but some functions are only in - the static library, so try that secondarily. */ - OUTPUT_FORMAT(elf32-i386) --GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 ) ) -+GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.2 ) ) diff --git a/global.json b/global.json index 67c8074cd5..b0176ff209 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "12.0.100-alpha.1.26528.108", + "version": "12.0.100-alpha.1.26555.106", "allowPrerelease": true, "rollForward": "latestFeature", "paths": [ @@ -10,10 +10,10 @@ "errorMessage": "The required .NET SDK wasn't found. Please run ./eng/common/dotnet.cmd/sh to install it." }, "tools": { - "dotnet": "12.0.100-alpha.1.26528.108" + "dotnet": "12.0.100-alpha.1.26555.106" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26551.101", + "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26556.115", "Microsoft.Build.NoTargets": "3.7.0" } } From 6883143f0d052c62bee6f13375b53ab86bf453b5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 16 Nov 2026 05:03:05 +0000 Subject: [PATCH 2/3] Update dependencies from build 341531 Updated Dependencies: Microsoft.DotNet.Arcade.Sdk (Version 12.0.0-beta.26556.115 -> 12.0.0-beta.26565.104) System.CommandLine (Version 4.0.0-alpha.1.26556.115 -> 4.0.0-alpha.1.26565.104) System.IO.Hashing, System.Security.Cryptography.Xml, System.Text.Json (Version 12.0.0-alpha.1.26556.115 -> 12.0.0-alpha.1.26565.104) [[ commit created by automation ]] --- eng/Version.Details.props | 10 ++++----- eng/Version.Details.xml | 22 +++++++++---------- .../job/publish-build-assets.yml | 2 +- .../core-templates/post-build/post-build.yml | 2 +- .../core-templates/steps/source-build.yml | 2 +- global.json | 6 ++--- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 78b798e301..5fbf7ebff7 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,11 +6,11 @@ This file should be imported by eng/Versions.props - 12.0.0-beta.26556.115 - 4.0.0-alpha.1.26556.115 - 12.0.0-alpha.1.26556.115 - 12.0.0-alpha.1.26556.115 - 12.0.0-alpha.1.26556.115 + 12.0.0-beta.26565.104 + 4.0.0-alpha.1.26565.104 + 12.0.0-alpha.1.26565.104 + 12.0.0-alpha.1.26565.104 + 12.0.0-alpha.1.26565.104 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b849030546..5360cacc3d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,28 +1,28 @@ - + - + https://github.com/dotnet/dotnet - 6e6f978fd9ca19b62796a13ff5230b21af0c42fa + 8fc142ba6d733754f83a1e9a9b87cad5de06b650 - + https://github.com/dotnet/dotnet - 6e6f978fd9ca19b62796a13ff5230b21af0c42fa + 8fc142ba6d733754f83a1e9a9b87cad5de06b650 - + https://github.com/dotnet/dotnet - 6e6f978fd9ca19b62796a13ff5230b21af0c42fa + 8fc142ba6d733754f83a1e9a9b87cad5de06b650 - + https://github.com/dotnet/dotnet - 6e6f978fd9ca19b62796a13ff5230b21af0c42fa + 8fc142ba6d733754f83a1e9a9b87cad5de06b650 - + https://github.com/dotnet/dotnet - 6e6f978fd9ca19b62796a13ff5230b21af0c42fa + 8fc142ba6d733754f83a1e9a9b87cad5de06b650 diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index 5b2a930256..31f76d242c 100644 --- a/eng/common/core-templates/job/publish-build-assets.yml +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -201,7 +201,7 @@ jobs: scriptPath: $(System.DefaultWorkingDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: > -BuildId $(BARBuildId) - -PublishingInfraVersion 3 + -PublishingInfraVersion ${{ parameters.publishingVersion }} -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml index 6b0875baf6..b1b0d17ea2 100644 --- a/eng/common/core-templates/post-build/post-build.yml +++ b/eng/common/core-templates/post-build/post-build.yml @@ -312,7 +312,7 @@ stages: scriptPath: $(System.DefaultWorkingDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: > -BuildId $(BARBuildId) - -PublishingInfraVersion 3 + -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -RequireDefaultChannels ${{ parameters.requireDefaultChannels }} diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index b75f59c428..c501b9ad3a 100644 --- a/eng/common/core-templates/steps/source-build.yml +++ b/eng/common/core-templates/steps/source-build.yml @@ -50,7 +50,7 @@ steps: ${{ parameters.platform.buildArguments }} \ $internalRuntimeDownloadArgs \ $targetRidArgs \ - $portableBuildArgs \ + $portableBuildArgs displayName: Build - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml diff --git a/global.json b/global.json index b0176ff209..bd4ebf4038 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "12.0.100-alpha.1.26555.106", + "version": "12.0.100-alpha.1.26557.102", "allowPrerelease": true, "rollForward": "latestFeature", "paths": [ @@ -10,10 +10,10 @@ "errorMessage": "The required .NET SDK wasn't found. Please run ./eng/common/dotnet.cmd/sh to install it." }, "tools": { - "dotnet": "12.0.100-alpha.1.26555.106" + "dotnet": "12.0.100-alpha.1.26557.102" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26556.115", + "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26565.104", "Microsoft.Build.NoTargets": "3.7.0" } } From ce867a476a48808e2754c03d469deec06f0fc270 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 23 Nov 2026 05:04:17 +0000 Subject: [PATCH 3/3] Update dependencies from build 342624 Updated Dependencies: Microsoft.DotNet.Arcade.Sdk (Version 12.0.0-beta.26565.104 -> 12.0.0-beta.26571.109) System.CommandLine (Version 4.0.0-alpha.1.26565.104 -> 4.0.0-alpha.1.26571.109) System.IO.Hashing, System.Security.Cryptography.Xml, System.Text.Json (Version 12.0.0-alpha.1.26565.104 -> 12.0.0-alpha.1.26571.109) [[ commit created by automation ]] --- eng/Version.Details.props | 10 +- eng/Version.Details.xml | 22 ++-- eng/common/Get-GitHubAppToken.ps1 | 103 +++++++++--------- eng/common/core-templates/job/onelocbuild.yml | 4 +- .../core-templates/steps/astred-artifacts.yml | 55 ++++++++-- .../steps/get-github-app-token.yml | 19 ++-- eng/common/cross/build-rootfs.sh | 15 ++- eng/common/tools.ps1 | 37 +++++-- eng/common/tools.sh | 29 ++++- global.json | 2 +- 10 files changed, 194 insertions(+), 102 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 5fbf7ebff7..d774bdfbcc 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,11 +6,11 @@ This file should be imported by eng/Versions.props - 12.0.0-beta.26565.104 - 4.0.0-alpha.1.26565.104 - 12.0.0-alpha.1.26565.104 - 12.0.0-alpha.1.26565.104 - 12.0.0-alpha.1.26565.104 + 12.0.0-beta.26571.109 + 4.0.0-alpha.1.26571.109 + 12.0.0-alpha.1.26571.109 + 12.0.0-alpha.1.26571.109 + 12.0.0-alpha.1.26571.109 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5360cacc3d..f3af1e4198 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,28 +1,28 @@ - + - + https://github.com/dotnet/dotnet - 8fc142ba6d733754f83a1e9a9b87cad5de06b650 + ee7a7c0752b641dc8c1142eb8f37fb1ec8510d0c - + https://github.com/dotnet/dotnet - 8fc142ba6d733754f83a1e9a9b87cad5de06b650 + ee7a7c0752b641dc8c1142eb8f37fb1ec8510d0c - + https://github.com/dotnet/dotnet - 8fc142ba6d733754f83a1e9a9b87cad5de06b650 + ee7a7c0752b641dc8c1142eb8f37fb1ec8510d0c - + https://github.com/dotnet/dotnet - 8fc142ba6d733754f83a1e9a9b87cad5de06b650 + ee7a7c0752b641dc8c1142eb8f37fb1ec8510d0c - + https://github.com/dotnet/dotnet - 8fc142ba6d733754f83a1e9a9b87cad5de06b650 + ee7a7c0752b641dc8c1142eb8f37fb1ec8510d0c diff --git a/eng/common/Get-GitHubAppToken.ps1 b/eng/common/Get-GitHubAppToken.ps1 index ec005e487c..8b26d303b4 100644 --- a/eng/common/Get-GitHubAppToken.ps1 +++ b/eng/common/Get-GitHubAppToken.ps1 @@ -1,11 +1,12 @@ # Mints a short-lived GitHub App installation access token by signing a JWT -# with an RSA private key (RS256). The signed JWT is exchanged with the GitHub -# API for a token scoped to a single installation. +# via Azure Key Vault's RSA signing operation (RS256). The private key never +# leaves Key Vault. The JWT is exchanged for a single installation's token. # # Requirements: -# - A GitHub App ID and PEM private key stored as Azure Key Vault secrets. -# - The federated Azure service connection running this script must have -# `Get` access to those two secrets. +# - The GitHub App's private key imported as a Key Vault RSA key. +# - Read access to the configured App-ID secret projection. +# - The federated Azure service connection must have the `Sign` action on +# that key. Reading private-key secrets is neither required nor supported. # - The App must be installed on the target organization/account # (`InstallationOwner`) with the permissions/repositories it needs. # @@ -14,17 +15,19 @@ [CmdletBinding()] param( - # Name of the Key Vault holding the GitHub App credentials. + # Key Vault holding the App-ID projection and RSA signing key. [Parameter(Mandatory = $true)] [string] $KeyVaultName, - # Secret Manager projection containing the GitHub App ID. + # Name of the RSA signing key, not a Key Vault secret. [Parameter(Mandatory = $true)] - [string] $AppIdSecretName, + [ValidateNotNullOrEmpty()] + [string] $KeyName, - # Secret Manager projection containing the PEM private key. + # Secret Manager projection containing the GitHub App's public ID. [Parameter(Mandatory = $true)] - [string] $AppPrivateKeySecretName, + [ValidateNotNullOrEmpty()] + [string] $AppIdSecretName, # Login of the organization or user account whose installation we should # mint the token for (e.g. `dotnet`, `microsoft`). @@ -51,55 +54,33 @@ function ConvertTo-Base64Url([byte[]] $bytes) { return [Convert]::ToBase64String($bytes).TrimEnd('=').Replace('+', '-').Replace('/', '_') } +Write-Host "Reading GitHub App ID from secret '$AppIdSecretName' in vault '$KeyVaultName'..." $previousNativeCommandErrorPreference = $PSNativeCommandUseErrorActionPreference try { - # Azure CLI can emit non-fatal Python warnings to stderr. $PSNativeCommandUseErrorActionPreference = $false - $keyVaultAccessToken = az account get-access-token ` + # az keyvault secret show fails for this projection with Errno 22; az rest keeps authentication in Azure CLI. + $escapedSecretName = [Uri]::EscapeDataString($AppIdSecretName) + $appId = az rest ` + --method get ` + --url "https://$KeyVaultName.vault.azure.net/secrets/${escapedSecretName}?api-version=7.4" ` --resource https://vault.azure.net ` - --query accessToken ` + --query value ` --output tsv ` --only-show-errors - $tokenExitCode = $LASTEXITCODE + $secretExitCode = $LASTEXITCODE } catch { - Write-PipelineTelemetryError -Category 'Build' -Message "Failed to acquire an Azure Key Vault access token: $_" + Write-PipelineTelemetryError -Category 'Build' -Message "Failed to read App ID secret '$AppIdSecretName' from vault '$KeyVaultName' with Azure CLI: $_" exit 1 } finally { $PSNativeCommandUseErrorActionPreference = $previousNativeCommandErrorPreference } -if ($tokenExitCode -ne 0 -or [string]::IsNullOrWhiteSpace($keyVaultAccessToken)) { - Write-PipelineTelemetryError -Category 'Build' -Message "'az account get-access-token' exited with code $tokenExitCode while acquiring an Azure Key Vault access token." +if ($secretExitCode -ne 0 -or [string]::IsNullOrWhiteSpace($appId)) { + Write-PipelineTelemetryError -Category 'Build' -Message "'az rest' failed with exit code $secretExitCode while reading App ID secret '$AppIdSecretName' from vault '$KeyVaultName'. Verify the service connection can read this App-ID projection." exit 1 } -function Get-KeyVaultSecret([string] $SecretName) { - # Use the data-plane REST API because `az keyvault secret show` can fail - # with Errno 22 on hosted Windows agents when reading these projections. - $escapedSecretName = [Uri]::EscapeDataString($SecretName) - $secretUri = "https://$KeyVaultName.vault.azure.net/secrets/$escapedSecretName`?api-version=7.4" - try { - $response = Invoke-RestMethod ` - -Uri $secretUri ` - -Headers @{ Authorization = "Bearer $keyVaultAccessToken" } ` - -Method Get - } - catch { - Write-PipelineTelemetryError -Category 'Build' -Message "Failed to read secret '$SecretName' from vault '$KeyVaultName': $_. Verify the secret exists and the service connection has 'Key Vault Secrets User' access to it." - exit 1 - } - if ([string]::IsNullOrWhiteSpace($response.value)) { - Write-PipelineTelemetryError -Category 'Build' -Message "Secret '$SecretName' in vault '$KeyVaultName' is empty." - exit 1 - } - return [string] $response.value -} - -Write-Host "Reading GitHub App credentials from vault '$KeyVaultName'..." -$appId = Get-KeyVaultSecret $AppIdSecretName -$privateKey = Get-KeyVaultSecret $AppPrivateKeySecretName - # Build JWT header and payload. Use [ordered] hashtables so JSON # serialization is deterministic. $jwtHeader = [ordered]@{ @@ -125,23 +106,34 @@ finally { $sha256.Dispose() } -Write-Host 'Signing JWT with the GitHub App private key...' -$rsa = [System.Security.Cryptography.RSA]::Create() +$digestBase64 = [Convert]::ToBase64String($digestBytes) +Write-Host "Signing JWT with key '$KeyName' in vault '$KeyVaultName'..." +$previousNativeCommandErrorPreference = $PSNativeCommandUseErrorActionPreference try { - $rsa.ImportFromPem($privateKey) - $signatureBytes = $rsa.SignHash( - $digestBytes, - [System.Security.Cryptography.HashAlgorithmName]::SHA256, - [System.Security.Cryptography.RSASignaturePadding]::Pkcs1) - $signatureUrl = ConvertTo-Base64Url $signatureBytes + # Azure CLI can emit non-fatal Python warnings to stderr. + $PSNativeCommandUseErrorActionPreference = $false + $signatureBase64 = az keyvault key sign ` + --vault-name $KeyVaultName ` + --name $KeyName ` + --algorithm RS256 ` + --digest $digestBase64 ` + --query signature ` + --output tsv ` + --only-show-errors + $signExitCode = $LASTEXITCODE } catch { - Write-PipelineTelemetryError -Category 'Build' -Message "Failed to sign the GitHub App JWT with the supplied private key: $_" + Write-PipelineTelemetryError -Category 'Build' -Message "Failed to sign the JWT via Key Vault (key '$KeyName', vault '$KeyVaultName'): $_. Verify the service connection has the Sign action on the key." exit 1 } finally { - $rsa.Dispose() + $PSNativeCommandUseErrorActionPreference = $previousNativeCommandErrorPreference +} +if ($signExitCode -ne 0 -or [string]::IsNullOrWhiteSpace($signatureBase64)) { + Write-PipelineTelemetryError -Category 'Build' -Message "'az keyvault key sign' exited with code $signExitCode for key '$KeyName' in vault '$KeyVaultName'. Verify the service connection has the Sign action on the key." + exit 1 } +$signatureUrl = $signatureBase64.Trim().TrimEnd('=').Replace('+', '-').Replace('/', '_') $jwt = "$signingInput.$signatureUrl" $headers = @{ @@ -198,6 +190,11 @@ catch { exit 1 } +if ([string]::IsNullOrWhiteSpace($tokenResponse.token)) { + Write-PipelineTelemetryError -Category 'Build' -Message "GitHub returned an empty installation token for '$InstallationOwner'." + exit 1 +} + Write-Host "Got installation token for '$InstallationOwner' (expires $($tokenResponse.expires_at))." if ($OutputVariableName) { Write-Host "Setting pipeline variable '$OutputVariableName'." diff --git a/eng/common/core-templates/job/onelocbuild.yml b/eng/common/core-templates/job/onelocbuild.yml index bd11c2e08c..555a656289 100644 --- a/eng/common/core-templates/job/onelocbuild.yml +++ b/eng/common/core-templates/job/onelocbuild.yml @@ -12,7 +12,7 @@ parameters: GitHubAppServiceConnection: 'dnceng-oneloc-githubapp' GitHubAppKeyVaultName: 'EngKeyVault' GitHubAppIdSecretName: 'oneloc-localization-app-app-id' - GitHubAppPrivateKeySecretName: 'oneloc-localization-app-app-private-key' + GitHubAppKeyName: 'oneloc-localization-app-key' SourcesDirectory: $(System.DefaultWorkingDirectory) CreatePr: true @@ -101,7 +101,7 @@ jobs: azureSubscription: ${{ parameters.GitHubAppServiceConnection }} keyVaultName: ${{ parameters.GitHubAppKeyVaultName }} appIdSecretName: ${{ parameters.GitHubAppIdSecretName }} - appPrivateKeySecretName: ${{ parameters.GitHubAppPrivateKeySecretName }} + keyName: ${{ parameters.GitHubAppKeyName }} installationOwner: ${{ parameters.GitHubOrg }} outputVariableName: 'GitHubAppInstallationToken' condition: ${{ parameters.condition }} diff --git a/eng/common/core-templates/steps/astred-artifacts.yml b/eng/common/core-templates/steps/astred-artifacts.yml index 86420925b4..adcf2a9281 100644 --- a/eng/common/core-templates/steps/astred-artifacts.yml +++ b/eng/common/core-templates/steps/astred-artifacts.yml @@ -9,6 +9,13 @@ parameters: - name: binlogDir type: string default: $(Build.ArtifactStagingDirectory)/AstredCapture/binlogs +- name: compilationDatabaseDir + type: string + default: '' +# Optional Windows setup command to obtain INCLUDE for compilation database imports. +- name: nativeEnvironmentCommand + type: string + default: '' - name: capturePath type: string default: $(Build.ArtifactStagingDirectory)/AstredCapture @@ -17,7 +24,7 @@ steps: - task: AstredInstaller@0 displayName: Install Astred CLI inputs: - Version: '2.14.1' + Version: '2.14.37' FeedUrl: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet-internal-FoSSE/nuget/v3/index.json' - pwsh: | @@ -25,19 +32,51 @@ steps: $apjOut = Join-Path $env:ASTRED_CAPTURE_PATH 'apj' New-Item -ItemType Directory -Force -Path $apjOut | Out-Null - $binlogs = Get-ChildItem -Path $env:ASTRED_BINLOG_DIR -Recurse -Force -Filter *.binlog ` - -ErrorAction SilentlyContinue + $binlogs = @(Get-ChildItem -Path $env:ASTRED_BINLOG_DIR -Recurse -Force -Filter *.binlog ` + -ErrorAction SilentlyContinue) if (-not $binlogs) { Write-Host "##vso[task.logissue type=warning]No binlogs found in $env:ASTRED_BINLOG_DIR. Check the calling job's Astred header configuration for MSBUILDDEBUGENGINE / MSBuildDebugEngine and MSBUILDDEBUGPATH." + } + + $compilationDatabases = @() + if ($env:ASTRED_COMPILATION_DATABASE_DIR) { + if (Test-Path -LiteralPath $env:ASTRED_COMPILATION_DATABASE_DIR -PathType Container) { + $compilationDatabases = @(Get-ChildItem -LiteralPath $env:ASTRED_COMPILATION_DATABASE_DIR ` + -Recurse -Force -File -Filter compile_commands.json) + } + if (-not $compilationDatabases) { + Write-Host "##vso[task.logissue type=warning]No compilation databases found in $env:ASTRED_COMPILATION_DATABASE_DIR. Native code built outside MSBuild will not be captured." + } + } + + if (-not $binlogs -and -not $compilationDatabases) { exit 0 } + if ($compilationDatabases -and $env:ASTRED_NATIVE_ENVIRONMENT_COMMAND) { + $nativeEnvironmentOutput = & $env:ComSpec /d /c "$env:ASTRED_NATIVE_ENVIRONMENT_COMMAND && set INCLUDE" + $nativeEnvironmentExitCode = $LASTEXITCODE + $nativeEnvironmentOutput | Where-Object { $_ -notlike 'INCLUDE*=*' } | + ForEach-Object { Write-Host $_ } + if ($nativeEnvironmentExitCode -ne 0) { + throw "Native compiler environment setup failed (exit $nativeEnvironmentExitCode)." + } + + $nativeInclude = $nativeEnvironmentOutput | + Where-Object { $_ -like 'INCLUDE=*' } | + ForEach-Object { $_.Substring('INCLUDE='.Length) } | + Select-Object -Last 1 + if ([string]::IsNullOrWhiteSpace($nativeInclude)) { + throw 'Native compiler environment setup did not define INCLUDE.' + } + $env:INCLUDE = $nativeInclude + } + $project = Join-Path $apjOut '.astred.project.json' - $binlogPaths = @($binlogs.FullName) - $responseFile = Join-Path $apjOut 'binlogs.rsp' - $binlogPaths | ForEach-Object { '"{0}"' -f $_ } | + $responseFile = Join-Path $apjOut 'astproj-inputs.rsp' + ($binlogs + $compilationDatabases) | ForEach-Object { '"{0}"' -f $_.FullName } | Set-Content -LiteralPath $responseFile -Encoding utf8 - Write-Host "astproj: processing $($binlogPaths.Count) binlog(s)" + Write-Host "astproj: processing $($binlogs.Count) binlog(s) and $($compilationDatabases.Count) compilation database(s)" astred astproj -nofolders "@$responseFile" "-o:$project" if ($LASTEXITCODE -ne 0) { throw "astproj failed (exit $LASTEXITCODE)" @@ -46,6 +85,8 @@ steps: workingDirectory: ${{ parameters.sourcesPath }} env: ASTRED_BINLOG_DIR: ${{ parameters.binlogDir }} + ASTRED_COMPILATION_DATABASE_DIR: ${{ parameters.compilationDatabaseDir }} + ASTRED_NATIVE_ENVIRONMENT_COMMAND: ${{ parameters.nativeEnvironmentCommand }} ASTRED_CAPTURE_PATH: ${{ parameters.capturePath }} continueOnError: true diff --git a/eng/common/core-templates/steps/get-github-app-token.yml b/eng/common/core-templates/steps/get-github-app-token.yml index 3eeb5a4c1b..66c6440e8a 100644 --- a/eng/common/core-templates/steps/get-github-app-token.yml +++ b/eng/common/core-templates/steps/get-github-app-token.yml @@ -1,11 +1,12 @@ # Mints a short-lived GitHub App installation access token by signing a JWT -# with an RSA private key (RS256). The JWT is exchanged with the GitHub API -# for a token scoped to a single installation. +# via Azure Key Vault's RSA signing operation (RS256), without reading the +# private key. The JWT is exchanged for a single installation's token. # # Requirements (per GitHub App you want to authenticate as): -# - A GitHub App ID and PEM private key stored as Azure Key Vault secrets. +# - The GitHub App's private key imported as a Key Vault RSA key. +# - Read access to the configured App-ID secret projection. # - The Azure service connection passed via `azureSubscription` must have -# `Get` access to those two secrets. +# the `Sign` action on that key. # - The App must be installed on the target organization/account # (`installationOwner`) with the permissions/repositories you need. # @@ -15,18 +16,18 @@ # enterprise classic-PAT lifetime policy. parameters: -# Azure DevOps service connection (federated) that can read the App credentials. +# Federated service connection authorized to sign with the App's RSA key. - name: azureSubscription type: string -# Name of the Key Vault holding Secret Manager's github-app-secret projections. +# Name of the Key Vault holding the App's RSA key. - name: keyVaultName type: string -- name: appIdSecretName +- name: keyName type: string -- name: appPrivateKeySecretName +- name: appIdSecretName type: string # Login of the organization or user account whose installation we should @@ -66,7 +67,7 @@ steps: inlineScript: | & "$(System.DefaultWorkingDirectory)/eng/common/Get-GitHubAppToken.ps1" ` -KeyVaultName '${{ parameters.keyVaultName }}' ` + -KeyName '${{ parameters.keyName }}' ` -AppIdSecretName '${{ parameters.appIdSecretName }}' ` - -AppPrivateKeySecretName '${{ parameters.appPrivateKeySecretName }}' ` -InstallationOwner '${{ parameters.installationOwner }}' ` -OutputVariableName '${{ parameters.outputVariableName }}' diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 98e02db627..f58a96e78a 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -451,13 +451,18 @@ case "$__AlpineVersion" in 3.17) __AlpinePackages+=" llvm15-libs" ;; edge) __AlpineLlvmLibsLookup=1 ;; *) + __AlpineVersionNumber=0 + if [[ -n "$__AlpineMajorVersion" ]]; then + __AlpineVersionNumber=$((10#$__AlpineMajorVersion * 100 + 10#$__AlpineMinorVersion)) + fi + if [[ "$__AlpineArch" =~ s390x|ppc64le ]]; then __AlpineVersion=3.15 # minimum version that supports lldb-dev __AlpinePackages+=" llvm12-libs" - elif [[ "$__AlpineArch" == "loongarch64" ]]; then + elif [[ "$__AlpineArch" == "loongarch64" ]] && (( __AlpineVersionNumber <= 321 )); then __AlpineVersion=3.21 # minimum version that supports lldb-dev __AlpinePackages+=" llvm19-libs" - elif [[ "$__AlpineArch" == "riscv64" ]]; then + elif [[ "$__AlpineArch" == "riscv64" ]] && (( __AlpineVersionNumber <= 322 )); then __AlpineVersion=3.22 # lldb-dev requires 3.21+, but 3.22+ provides the newer linux-headers needed for RISC-V extension probes __AlpinePackages+=" llvm20-libs" elif [[ -n "$__AlpineMajorVersion" ]]; then @@ -523,7 +528,7 @@ ensureDownloadTool() } if [[ "$__CodeName" == "alpine" ]]; then - __ApkToolsVersion=3.0.8-r0 + __ApkToolsVersion=3.0.9-r0 __ApkToolsDir="$(mktemp -d)" __ApkKeysDir="$(mktemp -d)" arch="$(uname -m)" @@ -540,9 +545,9 @@ if [[ "$__CodeName" == "alpine" ]]; then fi if [[ "$arch" == "x86_64" ]]; then - __ApkToolsSHA512SUM="6ab4f5e521efbfff75a4b0ecc6a028b4df0c22eadc46c18a30fa03faca0f6efd6c546b3682a856e66865f0152993a9cc843c15633a7d01b6e0f9d225b1e31ef8" + __ApkToolsSHA512SUM="c97f27bef2940bb6c23323bf9fe0f3c60932a3c676f1cea23d5f5664ee8be27f349bb0c905f5f3e1fe0b04cfd79d6e422829c49b12cacbce21b02d9b2d1fa083" elif [[ "$arch" == "aarch64" ]]; then - __ApkToolsSHA512SUM="c592bfefe3b3bc73d56fef5293a2c5c27a71d0555df7ca7db638a70c7ac81be6509f6348f28fe7474ae9adbda6f21c00a8c20d8a6ba6d5579f2ffa78d55184d2" + __ApkToolsSHA512SUM="121b77c2e1ac3c856e168c335d57887ab9716bf6b704e30309c37cf8d0935f72a1775aa6628ec1f73eeec0ca7282f4b40836887e62dac94063485b496ad460c9" else >&2 echo "ERROR: Unsupported apk-tools-static host architecture '$arch'." exit 1 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 04c8bb4830..f2e42780a2 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -185,7 +185,7 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { } } - $dotnetSdkVersion = $GlobalJson.tools.dotnet + $dotnetSdkVersion = GetDotNetSdkVersion # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. @@ -241,6 +241,24 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { return $global:_DotNetInstallDir = $dotnetRoot } +# Returns the .NET SDK version to install: 'tools.dotnet' if specified, otherwise 'sdk.version', otherwise $null. +function GetDotNetSdkVersion() { + if ((Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') -and $GlobalJson.tools.dotnet) { + return $GlobalJson.tools.dotnet + } + + if ((Get-Member -InputObject $GlobalJson -Name 'sdk') -and (Get-Member -InputObject $GlobalJson.sdk -Name 'version') -and $GlobalJson.sdk.version) { + return $GlobalJson.sdk.version + } + + return $null +} + +# True if global.json specifies a .NET SDK version to install, either via 'tools.dotnet' or via 'sdk.version'. +function GlobalJsonSpecifiesDotNetSdk() { + return [bool](GetDotNetSdkVersion) +} + function Retry($downloadBlock, $maxRetries = 5) { $retries = 1 @@ -588,15 +606,15 @@ function InitializeBuildTool() { $msbuildEngine = GetDefaultMSBuildEngine } - # Initialize dotnet cli if listed in 'tools' + # Initialize dotnet cli if global.json specifies a .NET SDK version ('tools.dotnet' or 'sdk.version') $dotnetRoot = $null - if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { + if (GlobalJsonSpecifiesDotNetSdk) { $dotnetRoot = InitializeDotNetCli -install:$restore } if ($msbuildEngine -eq 'dotnet') { if (!$dotnetRoot) { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "/global.json must specify 'tools.dotnet'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "/global.json must specify 'tools.dotnet' or 'sdk.version'." ExitWithExitCode 1 } $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet') @@ -625,11 +643,11 @@ function GetDefaultMSBuildEngine() { return 'vs' } - if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { + if (GlobalJsonSpecifiesDotNetSdk) { return 'dotnet' } - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet', 'sdk.version' or 'tools.vs'." ExitWithExitCode 1 } @@ -938,8 +956,13 @@ $ToolsDir = Join-Path $RepoRoot '.tools' $LogDir = Join-Path (Join-Path $ArtifactsDir 'log') $configuration $TempDir = Join-Path (Join-Path $ArtifactsDir 'tmp') $configuration $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot 'global.json') | ConvertFrom-Json +# The 'tools' section is optional (the SDK version can come from 'sdk.version'). Default it to an empty object +# so that code inspecting it doesn't need to handle a missing section. +if (-not (Get-Member -InputObject $GlobalJson -Name 'tools')) { + $GlobalJson | Add-Member -NotePropertyName 'tools' -NotePropertyValue ([pscustomobject]@{}) +} # true if global.json contains a "runtimes" section -$globalJsonHasRuntimes = if ($GlobalJson.tools.PSObject.Properties.Name -Match 'runtimes') { $true } else { $false } +$globalJsonHasRuntimes = [bool](Get-Member -InputObject $GlobalJson.tools -Name 'runtimes') Create-Directory $ToolsetDir Create-Directory $TempDir diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 0e28c1117b..28286b7052 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -130,6 +130,31 @@ function ReadGlobalVersion { fi } +# Reads the .NET SDK version to install from global.json: 'tools.dotnet' if specified, otherwise 'sdk.version'. +function ReadDotNetSdkVersion { + _ReadDotNetSdkVersion="" + + if command -v jq &> /dev/null; then + _ReadDotNetSdkVersion="$(jq -r '.tools.dotnet // .sdk.version // empty' "$global_json_file")" + else + local global_json + global_json="$(cat "$global_json_file")" + # Matches "sdk": { ... "version": "" }. Quoted strings are consumed as a whole so that braces + # inside them (e.g. in "errorMessage") don't end the sdk object. The version is the third capture group. + local sdk_version_regex='"sdk"[[:space:]]*:[[:space:]]*[{]([^"}]|"([^"\\]|\\.)*")*"version"[[:space:]]*:[[:space:]]*"([^"]+)"' + if [[ "$global_json" =~ \"dotnet\"[[:space:]\:]*\"([^\"]+) ]]; then + _ReadDotNetSdkVersion=${BASH_REMATCH[1]} + elif [[ "$global_json" =~ $sdk_version_regex ]]; then + _ReadDotNetSdkVersion=${BASH_REMATCH[3]} + fi + fi + + if [[ -z "$_ReadDotNetSdkVersion" ]]; then + Write-PipelineTelemetryError -category 'InitializeToolset' "Error: /global.json must specify 'tools.dotnet' or 'sdk.version'." + ExitWithExitCode 1 + fi +} + function InitializeDotNetCli { if [[ -n "${_InitializeDotNetCli:-}" ]]; then return @@ -158,8 +183,8 @@ function InitializeDotNetCli { fi fi - ReadGlobalVersion "dotnet" - local dotnet_sdk_version=$_ReadGlobalVersion + ReadDotNetSdkVersion + local dotnet_sdk_version=$_ReadDotNetSdkVersion local dotnet_root="" # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, diff --git a/global.json b/global.json index bd4ebf4038..07936a7c9e 100644 --- a/global.json +++ b/global.json @@ -13,7 +13,7 @@ "dotnet": "12.0.100-alpha.1.26557.102" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26565.104", + "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26571.109", "Microsoft.Build.NoTargets": "3.7.0" } }