From 81eaac080f85fb0d6e4caaca84e7eba058cea636 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 21 Oct 2026 13:44:57 +0200 Subject: [PATCH 01/11] Change product TFM from net11.0 to net12.0 for .NET 12 scouting Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8dc30c74-e8bc-4ab4-b25f-2ebb9ae42ad7 --- eng/TargetFrameworks.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/TargetFrameworks.props b/eng/TargetFrameworks.props index a55b1e1a3bb..2bea1ee3384 100644 --- a/eng/TargetFrameworks.props +++ b/eng/TargetFrameworks.props @@ -11,7 +11,7 @@ - net11.0 + net12.0 $([System.Text.RegularExpressions.Regex]::Replace('$(FSharpNetCoreProductTargetFramework)', '^net(\d+)\.0$', '$1')) From db3b2a459041136e57f635ab1405d2815b4ae5b5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 15:53:10 +0000 Subject: [PATCH 02/11] Reset files to feature/net12-scouting Reset patterns: - global.json - eng/Version.Details.xml - eng/Version.Details.props - eng/Versions.props - eng/common/** - eng/TargetFrameworks.props --- eng/TargetFrameworks.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/TargetFrameworks.props b/eng/TargetFrameworks.props index a55b1e1a3bb..2bea1ee3384 100644 --- a/eng/TargetFrameworks.props +++ b/eng/TargetFrameworks.props @@ -11,7 +11,7 @@ - net11.0 + net12.0 $([System.Text.RegularExpressions.Regex]::Replace('$(FSharpNetCoreProductTargetFramework)', '^net(\d+)\.0$', '$1')) From 261fbe1993b5536877ed9656f27c989dc1607b65 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 21 Oct 2026 16:25:22 +0000 Subject: [PATCH 03/11] Update dependencies from https://github.com/dotnet/arcade build 20261009.4 On relative base path root Microsoft.DotNet.Arcade.Sdk From Version 12.0.0-beta.26505.2 -> To Version 12.0.0-beta.26509.4 --- eng/Version.Details.props | 2 +- eng/Version.Details.xml | 4 ++-- eng/common/build.ps1 | 4 ---- eng/common/core-templates/steps/astred-artifacts.yml | 9 ++++++--- eng/common/msbuild.ps1 | 5 ----- eng/common/tools.ps1 | 10 ++++++---- eng/common/tools.sh | 8 ++------ global.json | 6 +++--- 8 files changed, 20 insertions(+), 28 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 8251142a313..dc56a1c1225 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,7 +6,7 @@ This file should be imported by eng/Versions.props - 12.0.0-beta.26505.2 + 12.0.0-beta.26509.4 10.0.14 10.0.14 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fead4e0cd63..ba06132dda3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -77,9 +77,9 @@ - + https://github.com/dotnet/arcade - 5a63d054ea793bdbdb6aa9f4558558e3a8f41529 + 7dad90156e9d69e991ad499ece9cf805cabcf506 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 305132a6d6d..64c5ed10263 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -181,10 +181,6 @@ try { if (-not $PSBoundParameters.ContainsKey('nodeReuse')) { $nodeReuse = $false } - # MSBuild's multi-threaded mode isn't run on CI unless it was explicitly requested via -msbuildMultiThreaded. - if (-not $PSBoundParameters.ContainsKey('msbuildMultiThreaded')) { - $msbuildMultiThreaded = $false - } } if (-not [string]::IsNullOrEmpty($binaryLogName)) { diff --git a/eng/common/core-templates/steps/astred-artifacts.yml b/eng/common/core-templates/steps/astred-artifacts.yml index b27a54e08ef..86420925b44 100644 --- a/eng/common/core-templates/steps/astred-artifacts.yml +++ b/eng/common/core-templates/steps/astred-artifacts.yml @@ -21,7 +21,7 @@ steps: FeedUrl: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet-internal-FoSSE/nuget/v3/index.json' - pwsh: | - $ErrorActionPreference = 'Continue' + $ErrorActionPreference = 'Stop' $apjOut = Join-Path $env:ASTRED_CAPTURE_PATH 'apj' New-Item -ItemType Directory -Force -Path $apjOut | Out-Null @@ -34,10 +34,13 @@ steps: $project = Join-Path $apjOut '.astred.project.json' $binlogPaths = @($binlogs.FullName) + $responseFile = Join-Path $apjOut 'binlogs.rsp' + $binlogPaths | ForEach-Object { '"{0}"' -f $_ } | + Set-Content -LiteralPath $responseFile -Encoding utf8 Write-Host "astproj: processing $($binlogPaths.Count) binlog(s)" - astred astproj -nofolders @binlogPaths "-o:$project" + astred astproj -nofolders "@$responseFile" "-o:$project" if ($LASTEXITCODE -ne 0) { - Write-Host "##vso[task.logissue type=warning]astproj failed (exit $LASTEXITCODE)" + throw "astproj failed (exit $LASTEXITCODE)" } displayName: Generate Astred Project Files workingDirectory: ${{ parameters.sourcesPath }} diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 index 8076945064d..161f8e8077c 100644 --- a/eng/common/msbuild.ps1 +++ b/eng/common/msbuild.ps1 @@ -19,11 +19,6 @@ try { $nodeReuse = $false } - # MSBuild's multi-threaded mode isn't run on CI unless it was explicitly requested via -msbuildMultiThreaded. - if ($ci -and -not $PSBoundParameters.ContainsKey('msbuildMultiThreaded')) { - $msbuildMultiThreaded = $false - } - MSBuild @extraArgs } catch { diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index cea14279b85..9cb84a8a941 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -31,8 +31,9 @@ # Set to true to reuse msbuild nodes. Recommended to not reuse on CI. [bool]$nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { !$ci } -# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for local builds and not run on CI. -[bool]$msbuildMultiThreaded = if (Test-Path variable:msbuildMultiThreaded) { $msbuildMultiThreaded } else { !$ci } +# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for both local and CI builds. +# Not applied when building with msbuild.exe (VS MSBuild). +[bool]$msbuildMultiThreaded = if (Test-Path variable:msbuildMultiThreaded) { $msbuildMultiThreaded } else { $true } # Configures warning treatment in msbuild. [bool]$warnAsError = if (Test-Path variable:warnAsError) { $warnAsError } else { $true } @@ -812,8 +813,9 @@ function MSBuild() { $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" - # Build with MSBuild's multi-threaded mode. - if ($msbuildMultiThreaded) { + # Build with MSBuild's multi-threaded mode, but not with msbuild.exe (VS MSBuild) for now. + # TODO: Enable for VS MSBuild as well: https://github.com/dotnet/dotnet/issues/9989 + if ($msbuildMultiThreaded -and [System.IO.Path]::GetFileName($buildTool.Path) -ne 'msbuild.exe') { $cmdArgs += ' -mt' } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index fdbc19243f1..3b4a5ac5142 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -60,13 +60,9 @@ else node_reuse=${node_reuse:-true} fi -# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for local builds and not run on CI. +# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for both local and CI builds. msbuild_multi_threaded=$(NormalizeBoolArg "${msbuild_multi_threaded:-}") -if [[ "$ci" == true ]]; then - msbuild_multi_threaded=${msbuild_multi_threaded:-false} -else - msbuild_multi_threaded=${msbuild_multi_threaded:-true} -fi +msbuild_multi_threaded=${msbuild_multi_threaded:-true} # Configures warning treatment in msbuild. warn_as_error=$(NormalizeBoolArg "${warn_as_error:-}") diff --git a/global.json b/global.json index c01cb2bb7fc..07c8230ed59 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "11.0.100-rc.1.26420.103", + "version": "12.0.100-alpha.1.26480.102", "allowPrerelease": true, "rollForward": "latestMinor", "paths": [ @@ -13,7 +13,7 @@ "runner": "Microsoft.Testing.Platform" }, "tools": { - "dotnet": "11.0.100-rc.1.26420.103", + "dotnet": "12.0.100-alpha.1.26480.102", "vs": { "version": "18.0", "components": [ @@ -23,7 +23,7 @@ "xcopy-msbuild": "18.0.0" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26505.2", + "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26509.4", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2" } } From aff0169a55d68c560c66add7a2be11d59517180e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 16:30:49 +0000 Subject: [PATCH 04/11] Update dependencies from https://github.com/dotnet/arcade build 20261009.4 (#20837) [feature/net12-scouting] Update dependencies from dotnet/arcade --- eng/Version.Details.props | 2 +- eng/Version.Details.xml | 4 ++-- eng/common/build.ps1 | 4 ---- eng/common/core-templates/steps/astred-artifacts.yml | 9 ++++++--- eng/common/msbuild.ps1 | 5 ----- eng/common/tools.ps1 | 10 ++++++---- eng/common/tools.sh | 8 ++------ global.json | 6 +++--- 8 files changed, 20 insertions(+), 28 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 8251142a313..dc56a1c1225 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,7 +6,7 @@ This file should be imported by eng/Versions.props - 12.0.0-beta.26505.2 + 12.0.0-beta.26509.4 10.0.14 10.0.14 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fead4e0cd63..ba06132dda3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -77,9 +77,9 @@ - + https://github.com/dotnet/arcade - 5a63d054ea793bdbdb6aa9f4558558e3a8f41529 + 7dad90156e9d69e991ad499ece9cf805cabcf506 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 305132a6d6d..64c5ed10263 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -181,10 +181,6 @@ try { if (-not $PSBoundParameters.ContainsKey('nodeReuse')) { $nodeReuse = $false } - # MSBuild's multi-threaded mode isn't run on CI unless it was explicitly requested via -msbuildMultiThreaded. - if (-not $PSBoundParameters.ContainsKey('msbuildMultiThreaded')) { - $msbuildMultiThreaded = $false - } } if (-not [string]::IsNullOrEmpty($binaryLogName)) { diff --git a/eng/common/core-templates/steps/astred-artifacts.yml b/eng/common/core-templates/steps/astred-artifacts.yml index b27a54e08ef..86420925b44 100644 --- a/eng/common/core-templates/steps/astred-artifacts.yml +++ b/eng/common/core-templates/steps/astred-artifacts.yml @@ -21,7 +21,7 @@ steps: FeedUrl: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet-internal-FoSSE/nuget/v3/index.json' - pwsh: | - $ErrorActionPreference = 'Continue' + $ErrorActionPreference = 'Stop' $apjOut = Join-Path $env:ASTRED_CAPTURE_PATH 'apj' New-Item -ItemType Directory -Force -Path $apjOut | Out-Null @@ -34,10 +34,13 @@ steps: $project = Join-Path $apjOut '.astred.project.json' $binlogPaths = @($binlogs.FullName) + $responseFile = Join-Path $apjOut 'binlogs.rsp' + $binlogPaths | ForEach-Object { '"{0}"' -f $_ } | + Set-Content -LiteralPath $responseFile -Encoding utf8 Write-Host "astproj: processing $($binlogPaths.Count) binlog(s)" - astred astproj -nofolders @binlogPaths "-o:$project" + astred astproj -nofolders "@$responseFile" "-o:$project" if ($LASTEXITCODE -ne 0) { - Write-Host "##vso[task.logissue type=warning]astproj failed (exit $LASTEXITCODE)" + throw "astproj failed (exit $LASTEXITCODE)" } displayName: Generate Astred Project Files workingDirectory: ${{ parameters.sourcesPath }} diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 index 8076945064d..161f8e8077c 100644 --- a/eng/common/msbuild.ps1 +++ b/eng/common/msbuild.ps1 @@ -19,11 +19,6 @@ try { $nodeReuse = $false } - # MSBuild's multi-threaded mode isn't run on CI unless it was explicitly requested via -msbuildMultiThreaded. - if ($ci -and -not $PSBoundParameters.ContainsKey('msbuildMultiThreaded')) { - $msbuildMultiThreaded = $false - } - MSBuild @extraArgs } catch { diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index cea14279b85..9cb84a8a941 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -31,8 +31,9 @@ # Set to true to reuse msbuild nodes. Recommended to not reuse on CI. [bool]$nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { !$ci } -# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for local builds and not run on CI. -[bool]$msbuildMultiThreaded = if (Test-Path variable:msbuildMultiThreaded) { $msbuildMultiThreaded } else { !$ci } +# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for both local and CI builds. +# Not applied when building with msbuild.exe (VS MSBuild). +[bool]$msbuildMultiThreaded = if (Test-Path variable:msbuildMultiThreaded) { $msbuildMultiThreaded } else { $true } # Configures warning treatment in msbuild. [bool]$warnAsError = if (Test-Path variable:warnAsError) { $warnAsError } else { $true } @@ -812,8 +813,9 @@ function MSBuild() { $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" - # Build with MSBuild's multi-threaded mode. - if ($msbuildMultiThreaded) { + # Build with MSBuild's multi-threaded mode, but not with msbuild.exe (VS MSBuild) for now. + # TODO: Enable for VS MSBuild as well: https://github.com/dotnet/dotnet/issues/9989 + if ($msbuildMultiThreaded -and [System.IO.Path]::GetFileName($buildTool.Path) -ne 'msbuild.exe') { $cmdArgs += ' -mt' } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index fdbc19243f1..3b4a5ac5142 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -60,13 +60,9 @@ else node_reuse=${node_reuse:-true} fi -# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for local builds and not run on CI. +# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for both local and CI builds. msbuild_multi_threaded=$(NormalizeBoolArg "${msbuild_multi_threaded:-}") -if [[ "$ci" == true ]]; then - msbuild_multi_threaded=${msbuild_multi_threaded:-false} -else - msbuild_multi_threaded=${msbuild_multi_threaded:-true} -fi +msbuild_multi_threaded=${msbuild_multi_threaded:-true} # Configures warning treatment in msbuild. warn_as_error=$(NormalizeBoolArg "${warn_as_error:-}") diff --git a/global.json b/global.json index c01cb2bb7fc..07c8230ed59 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "11.0.100-rc.1.26420.103", + "version": "12.0.100-alpha.1.26480.102", "allowPrerelease": true, "rollForward": "latestMinor", "paths": [ @@ -13,7 +13,7 @@ "runner": "Microsoft.Testing.Platform" }, "tools": { - "dotnet": "11.0.100-rc.1.26420.103", + "dotnet": "12.0.100-alpha.1.26480.102", "vs": { "version": "18.0", "components": [ @@ -23,7 +23,7 @@ "xcopy-msbuild": "18.0.0" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26505.2", + "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26509.4", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2" } } From 74521b64a832b17157c782aae0bfebc1fcaf4d52 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 21 Oct 2026 19:26:54 +0200 Subject: [PATCH 05/11] Fix .NET 12 scouting build and NuGet resolution with alpha SDK Early .NET 12 alpha SDKs ship with NETCoreAppMaximumVersion=11.0 in Microsoft.NETCoreSdk.BundledVersions.props before the SDK's own TFM bump lands, causing _CheckForUnsupportedNETCoreVersion to fail with NETSDK1045 when targeting net12.0 or running #r "nuget:" on .NET 12. Set NETCoreAppMaximumVersion=12.0 when targeting net12.0. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8dc30c74-e8bc-4ab4-b25f-2ebb9ae42ad7 --- eng/TargetFrameworks.props | 3 +++ .../FSharp.DependencyManager.ProjectFile.fs | 1 + tests/FSharp.Build.UnitTests/ResourceTests.fs | 1 + .../CompilerService/EncMethodDebugInformationTests.fs | 1 + tests/FSharp.Test.Utilities/ProjectGeneration.fs | 1 + tests/FSharp.Test.Utilities/Utilities.fs | 1 + tests/fsharp/single-test.fs | 1 + 7 files changed, 9 insertions(+) diff --git a/eng/TargetFrameworks.props b/eng/TargetFrameworks.props index 2bea1ee3384..bd879d7f3fd 100644 --- a/eng/TargetFrameworks.props +++ b/eng/TargetFrameworks.props @@ -16,6 +16,9 @@ $([System.Text.RegularExpressions.Regex]::Replace('$(FSharpNetCoreProductTargetFramework)', '^net(\d+)\.0$', '$1')) + + 12.0 + net10.0 diff --git a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs index dfe128da71d..c2230089d1e 100644 --- a/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs +++ b/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs @@ -49,6 +49,7 @@ $(POUND_R) $(TARGETFRAMEWORK) + 12.0 $(RUNTIMEIDENTIFIER) false true diff --git a/tests/FSharp.Build.UnitTests/ResourceTests.fs b/tests/FSharp.Build.UnitTests/ResourceTests.fs index 711e9e2a0ab..c91faabf8d3 100644 --- a/tests/FSharp.Build.UnitTests/ResourceTests.fs +++ b/tests/FSharp.Build.UnitTests/ResourceTests.fs @@ -27,6 +27,7 @@ let private createSdkProjectDirectory () = false {productTfm} + 12.0 {buildDirectory ++ "Microsoft.FSharp.NetSdk.targets"} {initialConfig.FSharpBuild} "{initialConfig.DOTNETFSCCOMPILERPATH}" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerService/EncMethodDebugInformationTests.fs b/tests/FSharp.Compiler.ComponentTests/CompilerService/EncMethodDebugInformationTests.fs index e7d748c1673..652085644cd 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerService/EncMethodDebugInformationTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerService/EncMethodDebugInformationTests.fs @@ -329,6 +329,7 @@ let private buildCSharpScratchPdb () = Library {TestFramework.productTfm} + 12.0 portable false true diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index 1a8a05f38e3..c5e5e44702c 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -458,6 +458,7 @@ let private renderFsProj (p: SyntheticProject) = Exe {productTfm} + 12.0 diff --git a/tests/FSharp.Test.Utilities/Utilities.fs b/tests/FSharp.Test.Utilities/Utilities.fs index 1db689ca706..51a98ea387b 100644 --- a/tests/FSharp.Test.Utilities/Utilities.fs +++ b/tests/FSharp.Test.Utilities/Utilities.fs @@ -146,6 +146,7 @@ module Utilities = Exe $TARGETFRAMEWORK + 12.0 true true diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index eddb0dc6080..79c4b62e4aa 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -145,6 +145,7 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo $(OUTPUTTYPE) $(TARGETFRAMEWORK) + 12.0 true false $(DEBUG) From 005cfb000fc50735eeca7f6a4fd1d8706a0966b2 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 22 Oct 2026 09:08:39 +0200 Subject: [PATCH 06/11] Use FSharpNetCoreProductTargetFramework in MultithreadedTasks harness Read FSharpNetCoreProductTargetFramework from eng/TargetFrameworks.props instead of hardcoding net11.0 in MultithreadedTasks/run.fsx and Fixture.fsproj. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8dc30c74-e8bc-4ab4-b25f-2ebb9ae42ad7 --- .../MultithreadedTasks/Fixture.fsproj | 2 +- .../MultithreadedTasks/run.fsx | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/tests/EndToEndBuildTests/MultithreadedTasks/Fixture.fsproj b/tests/EndToEndBuildTests/MultithreadedTasks/Fixture.fsproj index c6386be1144..398bab9cb8b 100644 --- a/tests/EndToEndBuildTests/MultithreadedTasks/Fixture.fsproj +++ b/tests/EndToEndBuildTests/MultithreadedTasks/Fixture.fsproj @@ -1,6 +1,6 @@ - net11.0 + $(FSharpNetCoreProductTargetFramework) Exe false true diff --git a/tests/EndToEndBuildTests/MultithreadedTasks/run.fsx b/tests/EndToEndBuildTests/MultithreadedTasks/run.fsx index 6f8d2a1b6a7..125abe00d8a 100644 --- a/tests/EndToEndBuildTests/MultithreadedTasks/run.fsx +++ b/tests/EndToEndBuildTests/MultithreadedTasks/run.fsx @@ -53,12 +53,17 @@ let succeed label arguments = let _, sdk = succeed "sdk" [ "--version" ] let _, msbuild = succeed "msbuild" [ "msbuild"; "-version"; "-nologo" ] +let tfm = + let props = File.ReadAllText(Path.Combine(repo, "eng", "TargetFrameworks.props")) + let matched = Regex.Match(props, @"]*>(net\d+\.\d+)") + if not matched.Success then failwith "Could not determine FSharpNetCoreProductTargetFramework from eng/TargetFrameworks.props" + matched.Groups[1].Value let sdkPath = Path.Combine(repo, ".dotnet", "sdk", sdk.Trim()) -let product = Path.Combine(repo, "artifacts", "bin", "fsc", configuration, "net11.0") +let product = Path.Combine(repo, "artifacts", "bin", "fsc", configuration, tfm) let taskProduct = Path.Combine(repo, "artifacts", "bin", "FSharp.Build", configuration, "netstandard2.0") let taskAssembly = Path.Combine(taskProduct, "FSharp.Build.dll") let compiler = Path.Combine(product, "fsc.dll") -let localFsi = Path.Combine(repo, "artifacts", "bin", "fsi", configuration, "net11.0", "fsi.dll") +let localFsi = Path.Combine(repo, "artifacts", "bin", "fsi", configuration, tfm, "fsi.dll") for path in [ taskAssembly; compiler; localFsi ] do if not (File.Exists path) then failwithf "Build local product bits first: missing %s" path let taskHash = hash taskAssembly @@ -67,18 +72,18 @@ write (Path.Combine(root, "versions.txt")) $"SDK {sdk}MSBuild {msbuild}Tasks {ta // An ordinary SDK helper project uses only assemblies supplied by the running SDK, without NuGet packages. let helper = Path.Combine(root, "probe") -write (Path.Combine(root, "Directory.Build.props")) "false" +write (Path.Combine(root, "Directory.Build.props")) $"""false""" write (Path.Combine(root, "Directory.Build.targets")) "" write (Path.Combine(helper, "Probe.cs")) (File.ReadAllText(Path.Combine(__SOURCE_DIRECTORY__, "Probe.cs"))) write (Path.Combine(helper, "Probe.csproj")) $""" - net11.0false + {tfm}false {xml sdkPath}/Microsoft.Build.Framework.dllfalse {xml sdkPath}/Microsoft.Build.Utilities.Core.dllfalse """ succeed "probe-build" [ "build"; Path.Combine(helper, "Probe.csproj"); "-nologo"; "-v:minimal"; "-nr:false" ] |> ignore -let probeAssembly = Path.Combine(helper, "bin", "Debug", "net11.0", "Probe.dll") +let probeAssembly = Path.Combine(helper, "bin", "Debug", tfm, "Probe.dll") let graph = Path.Combine(root, "graph") let projects = [| for index in 1 .. projectCount -> sprintf "P%02d" index |] write (Path.Combine(graph, "Directory.Build.props")) $""" @@ -192,10 +197,10 @@ let validateOutputs label = for file in [ "fsi.txt"; "obj/substituted/template.txt" ] do if File.ReadAllText(Path.Combine(directory, file)) <> name then failwithf "%s: wrong %s" name file for file, marker in [ "Strings.fs", "RESX_" + name; "ILLink.Substitutions.xml", $"fullname=\"{name}\"" ] do - if not (File.ReadAllText(Path.Combine(directory, "obj/Release/net11.0", file)).Contains marker) then + if not (File.ReadAllText(Path.Combine(directory, $"obj/Release/{tfm}", file)).Contains marker) then failwithf "%s: generated %s has the wrong marker" name file - succeed (label + "-" + name) [ Path.Combine(directory, "bin", "Release", "net11.0", name + ".dll") ] |> ignore - for child in [ "bin/Release/net11.0"; "obj/Release/net11.0" ] do + succeed (label + "-" + name) [ Path.Combine(directory, "bin", "Release", tfm, name + ".dll") ] |> ignore + for child in [ $"bin/Release/{tfm}"; $"obj/Release/{tfm}" ] do for file in Directory.GetFiles(Path.Combine(directory, child), "*", SearchOption.AllDirectories) do if [ ".dll"; ".pdb"; ".fs"; ".resx"; ".resources"; ".xml" ] |> List.contains (Path.GetExtension file) then yield Path.GetRelativePath(graph, file), hash file ] |> Map.ofList @@ -248,7 +253,7 @@ for mt in [ false; true ] do if failure = "resource" && errors.Length <> 1 then failwithf "%s reported %d errors for one malformed resource" label errors.Length for name in projects |> Array.skip 1 do - let dll = Path.Combine(graph, name, "bin/Release/net11.0", name + ".dll") + let dll = Path.Combine(graph, name, $"bin/Release/{tfm}", name + ".dll") succeed (label + "-" + name) [ dll ] |> ignore if hash dll <> baseline[Path.GetRelativePath(graph, dll)] then failwithf "%s contaminated %s" label name printfn "%s: expected failure; %d unaffected executables match baseline" label (projectCount - 1) @@ -263,7 +268,7 @@ let resourceNames file = [ for handle in metadata.ManifestResources -> metadata.GetString(metadata.GetManifestResource(handle).Name) ] let trimProject = Path.Combine(graph, projects[1]) let metadata names = names |> List.filter (fun (name: string) -> name.StartsWith("FSharpSignature") || name.StartsWith("FSharpOptimization")) |> Set.ofList -let untrimmed = Path.Combine(trimProject, "bin/Release/net11.0", projects[1] + ".dll") +let untrimmed = Path.Combine(trimProject, $"bin/Release/{tfm}", projects[1] + ".dll") let originalMetadata = metadata (resourceNames untrimmed) if originalMetadata.IsEmpty then failwith "Trimming control has no F# metadata" let trimFailures = ResizeArray() From 73d9645d302cc04af2a7722e6928916fdea19f74 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 23 Oct 2026 11:15:32 +0000 Subject: [PATCH 07/11] Reset files to feature/net12-scouting Reset patterns: - global.json - eng/Version.Details.xml - eng/Version.Details.props - eng/Versions.props - eng/common/** - eng/TargetFrameworks.props --- eng/TargetFrameworks.props | 5 ++++- eng/Version.Details.props | 2 +- eng/Version.Details.xml | 6 +++--- eng/common/build.ps1 | 4 ---- eng/common/core-templates/steps/astred-artifacts.yml | 9 ++++++--- eng/common/msbuild.ps1 | 5 ----- eng/common/tools.ps1 | 10 ++++++---- eng/common/tools.sh | 8 ++------ global.json | 6 +++--- 9 files changed, 25 insertions(+), 30 deletions(-) diff --git a/eng/TargetFrameworks.props b/eng/TargetFrameworks.props index a55b1e1a3bb..bd879d7f3fd 100644 --- a/eng/TargetFrameworks.props +++ b/eng/TargetFrameworks.props @@ -11,11 +11,14 @@ - net11.0 + net12.0 $([System.Text.RegularExpressions.Regex]::Replace('$(FSharpNetCoreProductTargetFramework)', '^net(\d+)\.0$', '$1')) + + 12.0 + net10.0 diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 8251142a313..dc56a1c1225 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,7 +6,7 @@ This file should be imported by eng/Versions.props - 12.0.0-beta.26505.2 + 12.0.0-beta.26509.4 10.0.14 10.0.14 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 315a0c42d5d..ba06132dda3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,6 +1,6 @@ - + https://github.com/dotnet/msbuild @@ -77,9 +77,9 @@ - + https://github.com/dotnet/arcade - 5a63d054ea793bdbdb6aa9f4558558e3a8f41529 + 7dad90156e9d69e991ad499ece9cf805cabcf506 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 305132a6d6d..64c5ed10263 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -181,10 +181,6 @@ try { if (-not $PSBoundParameters.ContainsKey('nodeReuse')) { $nodeReuse = $false } - # MSBuild's multi-threaded mode isn't run on CI unless it was explicitly requested via -msbuildMultiThreaded. - if (-not $PSBoundParameters.ContainsKey('msbuildMultiThreaded')) { - $msbuildMultiThreaded = $false - } } if (-not [string]::IsNullOrEmpty($binaryLogName)) { diff --git a/eng/common/core-templates/steps/astred-artifacts.yml b/eng/common/core-templates/steps/astred-artifacts.yml index b27a54e08ef..86420925b44 100644 --- a/eng/common/core-templates/steps/astred-artifacts.yml +++ b/eng/common/core-templates/steps/astred-artifacts.yml @@ -21,7 +21,7 @@ steps: FeedUrl: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet-internal-FoSSE/nuget/v3/index.json' - pwsh: | - $ErrorActionPreference = 'Continue' + $ErrorActionPreference = 'Stop' $apjOut = Join-Path $env:ASTRED_CAPTURE_PATH 'apj' New-Item -ItemType Directory -Force -Path $apjOut | Out-Null @@ -34,10 +34,13 @@ steps: $project = Join-Path $apjOut '.astred.project.json' $binlogPaths = @($binlogs.FullName) + $responseFile = Join-Path $apjOut 'binlogs.rsp' + $binlogPaths | ForEach-Object { '"{0}"' -f $_ } | + Set-Content -LiteralPath $responseFile -Encoding utf8 Write-Host "astproj: processing $($binlogPaths.Count) binlog(s)" - astred astproj -nofolders @binlogPaths "-o:$project" + astred astproj -nofolders "@$responseFile" "-o:$project" if ($LASTEXITCODE -ne 0) { - Write-Host "##vso[task.logissue type=warning]astproj failed (exit $LASTEXITCODE)" + throw "astproj failed (exit $LASTEXITCODE)" } displayName: Generate Astred Project Files workingDirectory: ${{ parameters.sourcesPath }} diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 index 8076945064d..161f8e8077c 100644 --- a/eng/common/msbuild.ps1 +++ b/eng/common/msbuild.ps1 @@ -19,11 +19,6 @@ try { $nodeReuse = $false } - # MSBuild's multi-threaded mode isn't run on CI unless it was explicitly requested via -msbuildMultiThreaded. - if ($ci -and -not $PSBoundParameters.ContainsKey('msbuildMultiThreaded')) { - $msbuildMultiThreaded = $false - } - MSBuild @extraArgs } catch { diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index cea14279b85..9cb84a8a941 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -31,8 +31,9 @@ # Set to true to reuse msbuild nodes. Recommended to not reuse on CI. [bool]$nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { !$ci } -# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for local builds and not run on CI. -[bool]$msbuildMultiThreaded = if (Test-Path variable:msbuildMultiThreaded) { $msbuildMultiThreaded } else { !$ci } +# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for both local and CI builds. +# Not applied when building with msbuild.exe (VS MSBuild). +[bool]$msbuildMultiThreaded = if (Test-Path variable:msbuildMultiThreaded) { $msbuildMultiThreaded } else { $true } # Configures warning treatment in msbuild. [bool]$warnAsError = if (Test-Path variable:warnAsError) { $warnAsError } else { $true } @@ -812,8 +813,9 @@ function MSBuild() { $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" - # Build with MSBuild's multi-threaded mode. - if ($msbuildMultiThreaded) { + # Build with MSBuild's multi-threaded mode, but not with msbuild.exe (VS MSBuild) for now. + # TODO: Enable for VS MSBuild as well: https://github.com/dotnet/dotnet/issues/9989 + if ($msbuildMultiThreaded -and [System.IO.Path]::GetFileName($buildTool.Path) -ne 'msbuild.exe') { $cmdArgs += ' -mt' } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index fdbc19243f1..3b4a5ac5142 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -60,13 +60,9 @@ else node_reuse=${node_reuse:-true} fi -# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for local builds and not run on CI. +# Set to true to build with MSBuild's multi-threaded mode (-mt). Enabled by default for both local and CI builds. msbuild_multi_threaded=$(NormalizeBoolArg "${msbuild_multi_threaded:-}") -if [[ "$ci" == true ]]; then - msbuild_multi_threaded=${msbuild_multi_threaded:-false} -else - msbuild_multi_threaded=${msbuild_multi_threaded:-true} -fi +msbuild_multi_threaded=${msbuild_multi_threaded:-true} # Configures warning treatment in msbuild. warn_as_error=$(NormalizeBoolArg "${warn_as_error:-}") diff --git a/global.json b/global.json index c01cb2bb7fc..07c8230ed59 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "11.0.100-rc.1.26420.103", + "version": "12.0.100-alpha.1.26480.102", "allowPrerelease": true, "rollForward": "latestMinor", "paths": [ @@ -13,7 +13,7 @@ "runner": "Microsoft.Testing.Platform" }, "tools": { - "dotnet": "11.0.100-rc.1.26420.103", + "dotnet": "12.0.100-alpha.1.26480.102", "vs": { "version": "18.0", "components": [ @@ -23,7 +23,7 @@ "xcopy-msbuild": "18.0.0" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26505.2", + "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26509.4", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2" } } From 4b12e3f2549e7f03cc2ebdba6d21567e9ec21c00 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2026 06:39:16 +0000 Subject: [PATCH 08/11] Update dependencies from https://github.com/dotnet/arcade build 20261023.11 (#20864) [feature/net12-scouting] Update dependencies from dotnet/arcade --- eng/Version.Details.props | 2 +- eng/Version.Details.xml | 4 ++-- eng/common/native/NativeAotSupported.props | 2 -- eng/common/native/install-dependencies.sh | 2 +- global.json | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index dc56a1c1225..1a82137fbaf 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,7 +6,7 @@ This file should be imported by eng/Versions.props - 12.0.0-beta.26509.4 + 12.0.0-beta.26523.11 10.0.14 10.0.14 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ba06132dda3..11a497e2911 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -77,9 +77,9 @@ - + https://github.com/dotnet/arcade - 7dad90156e9d69e991ad499ece9cf805cabcf506 + 7663bc91853be9540495d9e502f1b29a02b8be83 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/common/native/NativeAotSupported.props b/eng/common/native/NativeAotSupported.props index cdff9ef0361..c8931ef3aaf 100644 --- a/eng/common/native/NativeAotSupported.props +++ b/eng/common/native/NativeAotSupported.props @@ -3,7 +3,6 @@ <_NativeAotSupportedOS Condition=" - '$(TargetOS)' != 'browser' and '$(TargetOS)' != 'haiku' and '$(TargetOS)' != 'illumos' and '$(TargetOS)' != 'netbsd' and @@ -12,7 +11,6 @@ <_NativeAotSupportedArch Condition=" - '$(TargetArchitecture)' != 'wasm' and '$(TargetArchitecture)' != 's390x' and '$(TargetArchitecture)' != 'ppc64le' and ('$(TargetArchitecture)' != 'x86' or '$(TargetOS)' == 'windows') diff --git a/eng/common/native/install-dependencies.sh b/eng/common/native/install-dependencies.sh index aff839fa097..be405fd62ec 100644 --- a/eng/common/native/install-dependencies.sh +++ b/eng/common/native/install-dependencies.sh @@ -26,7 +26,7 @@ case "$os" in apt install -y build-essential gettext locales cmake llvm clang lld lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \ libssl-dev libkrb5-dev pigz cpio ninja-build file - localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 + localedef -i en_US -c -f UTF-8 en_US.UTF-8 elif [ "$ID" = "fedora" ] || [ "$ID" = "rhel" ] || [ "$ID" = "azurelinux" ] || [ "$ID" = "centos" ]; then pkg_mgr="$(command -v tdnf 2>/dev/null || command -v dnf)" $pkg_mgr install -y cmake llvm lld lldb clang python curl libicu-devel openssl-devel krb5-devel lttng-ust-devel pigz cpio ninja-build file diff --git a/global.json b/global.json index 07c8230ed59..48bf438abcc 100644 --- a/global.json +++ b/global.json @@ -23,7 +23,7 @@ "xcopy-msbuild": "18.0.0" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26509.4", + "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26523.11", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2" } } From 208757a4292be9dddb8aaf8a298731b53ca70631 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:49:59 +0000 Subject: [PATCH 09/11] Update dependencies from https://github.com/dotnet/arcade build 20261030.2 (#20905) [feature/net12-scouting] Update dependencies from dotnet/arcade --- NuGet.config | 1 - eng/Version.Details.props | 2 +- eng/Version.Details.xml | 4 ++-- eng/common/core-templates/job/onelocbuild.yml | 2 +- eng/common/native/NativeAotSupported.props | 3 ++- global.json | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/NuGet.config b/NuGet.config index 68322e55d8c..8218d2b2479 100644 --- a/NuGet.config +++ b/NuGet.config @@ -8,7 +8,6 @@ - diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 1a82137fbaf..d0866be61a0 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,7 +6,7 @@ This file should be imported by eng/Versions.props - 12.0.0-beta.26523.11 + 12.0.0-beta.26530.2 10.0.14 10.0.14 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 11a497e2911..5879ec8aa0f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -77,9 +77,9 @@ - + https://github.com/dotnet/arcade - 7663bc91853be9540495d9e502f1b29a02b8be83 + c4681eb4c38539bf73b61bb8c41d8938ca864083 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/common/core-templates/job/onelocbuild.yml b/eng/common/core-templates/job/onelocbuild.yml index b772dc57880..bd11c2e08cb 100644 --- a/eng/common/core-templates/job/onelocbuild.yml +++ b/eng/common/core-templates/job/onelocbuild.yml @@ -106,7 +106,7 @@ jobs: outputVariableName: 'GitHubAppInstallationToken' condition: ${{ parameters.condition }} - - task: OneLocBuild@2 + - task: OneLocBuild@3 displayName: OneLocBuild env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) diff --git a/eng/common/native/NativeAotSupported.props b/eng/common/native/NativeAotSupported.props index c8931ef3aaf..002aa9c248c 100644 --- a/eng/common/native/NativeAotSupported.props +++ b/eng/common/native/NativeAotSupported.props @@ -6,7 +6,8 @@ '$(TargetOS)' != 'haiku' and '$(TargetOS)' != 'illumos' and '$(TargetOS)' != 'netbsd' and - '$(TargetOS)' != 'solaris' + '$(TargetOS)' != 'solaris' and + '$(TargetOS)' != 'openharmony' ">true diff --git a/global.json b/global.json index 48bf438abcc..677bf782525 100644 --- a/global.json +++ b/global.json @@ -23,7 +23,7 @@ "xcopy-msbuild": "18.0.0" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26523.11", + "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26530.2", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2" } } From aaafcd7e5bb1c5eaddf4f31ef1d50769d6b24c6e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:12:19 +0100 Subject: [PATCH 10/11] [automated] Merge branch 'main' => 'feature/net12-scouting' (#20855) * Pin BCL packages to 10.0.13 for internal full-signed builds (#20853) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d411284f-2a6b-4b0d-9ee5-18b2de547fd9 * Reset files to feature/net12-scouting Reset patterns: - global.json - eng/Version.Details.xml - eng/Version.Details.props - eng/Versions.props - eng/common/** - eng/TargetFrameworks.props --------- Co-authored-by: Adam Boniecki <20281641+abonie@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Tomas Grosup Copilot-Session: d411284f-2a6b-4b0d-9ee5-18b2de547fd9 --- azure-pipelines.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 83dd8b0b686..918a29acfbe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -126,6 +126,8 @@ extends: variables: - name: _SignType value: Real + - name: BclPackageVersion + value: '10.0.13' steps: - checkout: self clean: true @@ -143,6 +145,11 @@ extends: /p:OfficialBuildId=$(BUILD.BUILDNUMBER) /p:VisualStudioDropName=$(VisualStudioDropName) /p:GenerateSbom=true + /p:SystemCollectionsImmutablePackageVersion=$(BclPackageVersion) + /p:SystemCompositionPackageVersion=$(BclPackageVersion) + /p:SystemDiagnosticsDiagnosticSourcePackageVersion=$(BclPackageVersion) + /p:SystemReflectionMetadataPackageVersion=$(BclPackageVersion) + /p:SystemSecurityCryptographyXmlPackageVersion=$(BclPackageVersion) env: NativeToolsOnMachine: true FSHARP_CACHE_OVERRIDE: 256 From 42fb1616f9449ca99b597d5a2f4682c8f18ff17e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2026 05:12:24 +0000 Subject: [PATCH 11/11] [feature/net12-scouting] Update dependencies from dotnet/arcade (#20946) [feature/net12-scouting] Update dependencies from dotnet/arcade --- eng/Version.Details.props | 2 +- eng/Version.Details.xml | 4 +- eng/common/Get-GitHubAppToken.ps1 | 103 +++++---- .../core-templates/job/helix-job-monitor.yml | 4 + eng/common/core-templates/job/onelocbuild.yml | 22 +- .../job/publish-build-assets.yml | 6 +- .../core-templates/post-build/post-build.yml | 4 +- .../steps/get-github-app-token.yml | 19 +- .../core-templates/steps/source-build.yml | 2 +- eng/common/cross/build-rootfs.sh | 56 +++-- eng/common/cross/install-debs.py | 203 +++++++++++++----- eng/common/cross/tizen-build-rootfs.sh | 3 - eng/common/cross/toolchain.cmake | 58 +---- eng/common/cross/x86/tizen/tizen.patch | 9 - eng/common/sdk-task.ps1 | 15 +- eng/common/sdk-task.sh | 15 +- eng/common/tools.ps1 | 41 +++- eng/common/tools.sh | 36 +++- global.json | 6 +- 19 files changed, 366 insertions(+), 242 deletions(-) delete mode 100644 eng/common/cross/x86/tizen/tizen.patch diff --git a/eng/Version.Details.props b/eng/Version.Details.props index d0866be61a0..7b4b2cb77ba 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,7 +6,7 @@ This file should be imported by eng/Versions.props - 12.0.0-beta.26530.2 + 12.0.0-beta.26577.1 10.0.14 10.0.14 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5879ec8aa0f..a131195c184 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -77,9 +77,9 @@ - + https://github.com/dotnet/arcade - c4681eb4c38539bf73b61bb8c41d8938ca864083 + a41280025cf493207b2c676e03ff5e4f1ce17683 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/common/Get-GitHubAppToken.ps1 b/eng/common/Get-GitHubAppToken.ps1 index ec005e487c3..8b26d303b4f 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/helix-job-monitor.yml b/eng/common/core-templates/job/helix-job-monitor.yml index ef8ee08fbd2..6672705ac5f 100644 --- a/eng/common/core-templates/job/helix-job-monitor.yml +++ b/eng/common/core-templates/job/helix-job-monitor.yml @@ -165,6 +165,10 @@ jobs: steps: - checkout: self fetchDepth: 1 + fetchTags: false + fetchFilter: blob:none + # Cone-mode sparse checkout also includes all root-level files (e.g. global.json and NuGet.config). + sparseCheckoutDirectories: eng .config - ${{ if and(eq(parameters.useEntraAuthentication, true), eq(parameters.azureSubscription, '')) }}: - pwsh: throw "azureSubscription must be set when useEntraAuthentication is true." diff --git a/eng/common/core-templates/job/onelocbuild.yml b/eng/common/core-templates/job/onelocbuild.yml index bd11c2e08cb..901ca2e6d10 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 @@ -21,6 +21,12 @@ parameters: UseLfLineEndings: true UseCheckedInLocProjectJson: false SkipLocProjectJsonGeneration: false + # Path to LocProject.json, relative to $(System.DefaultWorkingDirectory). + # Changing it requires SkipLocProjectJsonGeneration: true. + LocProjectPath: eng/Localize/LocProject.json + # Optional: steps to run before LocProject.json is generated and OneLocBuild runs, + # for example to create a custom LocProject.json. + preSteps: [] LanguageSet: VS_Main_Languages LclSource: lclFilesInRepo LclPackageId: '' @@ -74,6 +80,11 @@ jobs: - 'OneLocBuild is supported only in dnceng/internal and DevDiv/DevDiv.': error - ${{ if eq(parameters.CeapexServiceConnection, '') }}: - 'CeapexServiceConnection must identify a WIF service connection.': error + - ${{ if and(ne(parameters.LocProjectPath, 'eng/Localize/LocProject.json'), ne(parameters.SkipLocProjectJsonGeneration, 'true')) }}: + - 'A custom LocProjectPath requires SkipLocProjectJsonGeneration to be true.': error + + - ${{ each step in parameters.preSteps }}: + - ${{ step }} - ${{ if ne(parameters.SkipLocProjectJsonGeneration, 'true') }}: - task: Powershell@2 @@ -101,7 +112,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 }} @@ -111,7 +122,7 @@ jobs: env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) inputs: - locProj: eng/Localize/LocProject.json + locProj: ${{ parameters.LocProjectPath }} outDir: $(Build.ArtifactStagingDirectory) lclSource: ${{ parameters.LclSource }} lclPackageId: ${{ parameters.LclPackageId }} @@ -138,8 +149,9 @@ jobs: - task: CopyFiles@2 displayName: Copy LocProject.json inputs: - SourceFolder: '$(System.DefaultWorkingDirectory)/eng/Localize/' - Contents: 'LocProject.json' + SourceFolder: '$(System.DefaultWorkingDirectory)' + Contents: '${{ parameters.LocProjectPath }}' + flattenFolders: true TargetFolder: '$(Build.ArtifactStagingDirectory)/loc' condition: ${{ parameters.condition }} diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index 330225ae093..31f76d242c7 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 @@ -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 6dcee6664d6..b1b0d17ea2d 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 @@ -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/get-github-app-token.yml b/eng/common/core-templates/steps/get-github-app-token.yml index 3eeb5a4c1bc..66c6440e8af 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/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index b75f59c428d..c501b9ad3a4 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/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 3ce35ed12fd..e01c59a184d 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" @@ -78,7 +78,7 @@ __AlpinePackages+=" krb5-dev" __AlpinePackages+=" openssl-dev" __AlpinePackages+=" zlib-dev" -__FreeBSDBase="14.4-RELEASE" +__FreeBSDBase="14.5-RELEASE" __FreeBSDPkg="2.8.0" __FreeBSDABI="14" __FreeBSDPackages="libunwind" @@ -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%%.*}" @@ -457,16 +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" == "x86" ]]; then - __AlpineVersion=3.17 # minimum version that supports lldb-dev - __AlpinePackages+=" llvm15-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 @@ -532,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)" @@ -549,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 @@ -615,11 +611,35 @@ elif [[ "$__CodeName" == "freebsd" ]]; then ensureDownloadTool + case "${__FreeBSDBase}/${__FreeBSDMachineArch}" in + 14.5-RELEASE/amd64) + __FreeBSDBaseSHA256SUM="d16b68fe0e9e136ce67ab1084042c848bbffecd1eb295f206bd1c6785deb45a4" + ;; + 14.5-RELEASE/aarch64) + __FreeBSDBaseSHA256SUM="4b7a61ed4ddbd598b5048d5800898ba0d43dcba4cdb12ba58302e0202eaa26aa" + ;; + 15.1-RELEASE/amd64) + __FreeBSDBaseSHA256SUM="3768988b151c20f965679062b065c63a977d6bbb9f47fd83695ec2c40790c18f" + ;; + 15.1-RELEASE/aarch64) + __FreeBSDBaseSHA256SUM="5b7a46a0abfbe23a1d4454b5600e2efcfce16b705bc7e9c851c37470c035ef98" + ;; + *) + >&2 echo "ERROR: No known checksum for FreeBSD ${__FreeBSDBase} ${__FreeBSDMachineArch} base.txz." + exit 1 + ;; + esac + + __FreeBSDBaseUrl="https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" + __FreeBSDBasePackage="$__RootfsDir/base.txz" if [[ "$__hasWget" == 1 ]]; then - wget -O- "https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" | tar -C "$__RootfsDir" -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version + wget -O "$__FreeBSDBasePackage" "$__FreeBSDBaseUrl" else - curl -SL "https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" | tar -C "$__RootfsDir" -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version + curl -fSL -o "$__FreeBSDBasePackage" "$__FreeBSDBaseUrl" fi + echo "$__FreeBSDBaseSHA256SUM $__FreeBSDBasePackage" | sha256sum -c + tar -C "$__RootfsDir" -Jxf "$__FreeBSDBasePackage" ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version + rm "$__FreeBSDBasePackage" echo "ABI = \"FreeBSD:${__FreeBSDABI}:${__FreeBSDMachineArch}\"; FINGERPRINTS = \"${__RootfsDir}/usr/share/keys\"; REPOS_DIR = [\"${__RootfsDir}/etc/pkg\"]; REPO_AUTOUPDATE = NO; RUN_SCRIPTS = NO;" > "${__RootfsDir}"/usr/local/etc/pkg.conf echo "FreeBSD: { url: \"pkg+https://pkg.FreeBSD.org/\${ABI}/quarterly\", mirror_type: \"srv\", signature_type: \"fingerprints\", fingerprints: \"/usr/share/keys/pkg\", enabled: yes }" > "${__RootfsDir}"/etc/pkg/FreeBSD.conf mkdir -p "$__RootfsDir"/tmp diff --git a/eng/common/cross/install-debs.py b/eng/common/cross/install-debs.py index e2d5ef4030a..02d4de3e488 100644 --- a/eng/common/cross/install-debs.py +++ b/eng/common/cross/install-debs.py @@ -44,7 +44,8 @@ async def download_file(session, url, dest_path, max_retries=3, retry_delay=2, t print(f"Error downloading {url}: {type(e).__name__} - {e}. Retrying...") attempt += 1 - await asyncio.sleep(retry_delay) + if attempt < max_retries: + await asyncio.sleep(retry_delay) raise Exception(f"Failed to download {url} after {max_retries} attempts.") @@ -66,83 +67,179 @@ async def download_deb_files_parallel(mirror, packages, tmp_dir): async def download_package_index_parallel(mirror, arch, suites, check_sig, keyring): """Download package index files for specified suites and components entirely in memory.""" - tasks = [] timeout = aiohttp.ClientTimeout(total=60) async with aiohttp.ClientSession(timeout=timeout) as session: - for suite in suites: - for component in ["main", "universe"]: - tasks.append(fetch_and_decompress(session, mirror, arch, suite, component, check_sig, keyring)) - - results = await asyncio.gather(*tasks) + tasks = [fetch_suite_indexes(session, mirror, arch, suite, ["main", "universe"], check_sig, keyring) for suite in suites] + # Let every task finish before the session closes so one failure doesn't + # surface as noisy "Session is closed" errors from the others. + suite_results = await gather_all(*tasks) merged_content = "" - for result in results: - if isinstance(result, str): - if merged_content: - merged_content += "\n\n" - merged_content += result + for results in suite_results: + for result in results: + if isinstance(result, str): + if merged_content: + merged_content += "\n\n" + merged_content += result return merged_content -async def fetch_and_decompress(session, mirror, arch, suite, component, check_sig, keyring): - """Fetch and decompress the Packages.gz file.""" +async def fetch_url(session, url, max_retries=3, retry_delay=2): + """Fetch a URL with retries on transient failures. Returns None on 404.""" + for attempt in range(max_retries): + try: + async with session.get(url) as response: + if response.status == 200: + return await response.read() + if response.status == 404: + return None + if response.status < 500 and response.status not in (408, 429): + raise Exception(f"Failed to download {url}, Status Code: {response.status}") + print(f"Error downloading {url}: Status Code {response.status}. Retrying...") + except (asyncio.TimeoutError, aiohttp.ClientError) as e: + print(f"Error downloading {url}: {type(e).__name__} - {e}. Retrying...") + + if attempt < max_retries - 1: + await asyncio.sleep(retry_delay * (attempt + 1)) + raise Exception(f"Failed to download {url} after {max_retries} attempts.") + +async def gather_all(*coroutines): + """Run coroutines concurrently, letting all finish before raising the first failure.""" + results = await asyncio.gather(*coroutines, return_exceptions=True) + for result in results: + if isinstance(result, BaseException): + raise result + return results + +async def fetch_suite_indexes(session, mirror, arch, suite, components, check_sig, keyring, max_attempts=5, retry_delay=10): + """Fetch the package indexes for one suite. + + With signature checking, every index is verified against a single signed + Release snapshot. Mirrors behind load balancers can serve different + snapshots on consecutive requests while they sync, so a mismatch restarts + the whole suite from a fresh signed Release. + """ + if not check_sig: + return await gather_all(*(fetch_unverified_index(session, mirror, arch, suite, component) for component in components)) + + for attempt in range(1, max_attempts + 1): + try: + release_content = await fetch_release_file(session, mirror, suite, keyring) + if release_content is None: + # Suites such as Debian's -security live in a separate + # archive, so the mirror may not carry them at all. + print(f"Skipped suite: {mirror}/dists/{suite} (doesn't exist)") + return [] + return await gather_all(*(fetch_verified_index(session, mirror, arch, suite, component, release_content) for component in components)) + except Exception as e: + if attempt == max_attempts: + raise + print(f"Inconsistent metadata for {suite} (attempt {attempt}/{max_attempts}): {e}. Retrying with a fresh Release file...") + await asyncio.sleep(retry_delay * attempt) + +async def fetch_unverified_index(session, mirror, arch, suite, component): path = f"{component}/binary-{arch}/Packages.gz" url = f"{mirror}/dists/{suite}/{path}" - async with session.get(url) as response: - if response.status == 200: - compressed_data = await response.read() - decompressed_data = gzip.decompress(compressed_data).decode('utf-8') - print(f"Downloaded index: {url}") + compressed_data = await fetch_url(session, url) + if compressed_data is None: + print(f"Skipped index: {url} (doesn't exist)") + return None - if check_sig: - # Verify the package index against the sha256 recorded in the Release file - release_file_content = await fetch_release_file(session, mirror, suite, keyring) - packages_sha = parse_release_file(release_file_content, path) + print(f"Downloaded index: {url}") + return gzip.decompress(compressed_data).decode('utf-8') - sha256 = hashlib.sha256(compressed_data).hexdigest() - if sha256 != packages_sha: - raise Exception(f"SHA256 mismatch for {path}: expected {packages_sha}, got {sha256}") - print(f"Checksum verified for {path}") +async def fetch_verified_index(session, mirror, arch, suite, component, release_content): + """Fetch Packages.gz and verify it against the sha256 recorded in the signed Release file.""" + path = f"{component}/binary-{arch}/Packages.gz" + expected_sha = find_release_checksum(release_content, path) + if expected_sha is None: + print(f"Skipped index: {mirror}/dists/{suite}/{path} (not listed in Release)") + return None - return decompressed_data - else: - print(f"Skipped index: {url} (doesn't exist)") - return None + urls = [] + # by-hash paths are immutable, so they can't change between fetching the + # Release file and fetching the index. + if re.search(r'^Acquire-By-Hash:\s*yes\s*$', release_content, re.MULTILINE | re.IGNORECASE): + urls.append(f"{mirror}/dists/{suite}/{component}/binary-{arch}/by-hash/SHA256/{expected_sha}") + urls.append(f"{mirror}/dists/{suite}/{path}") + + for url in urls: + compressed_data = await fetch_url(session, url) + if compressed_data is None: + continue + + sha256 = hashlib.sha256(compressed_data).hexdigest() + if sha256 != expected_sha: + raise Exception(f"SHA256 mismatch for {url}: expected {expected_sha}, got {sha256}") + + print(f"Downloaded index: {url}") + print(f"Checksum verified for {path}") + return gzip.decompress(compressed_data).decode('utf-8') + + raise Exception(f"Index {path} listed in Release for {suite} was not found on the mirror") async def fetch_release_file(session, mirror, suite, keyring): - """Fetch Release and Release.gpg files and verify the signature.""" + """Fetch the Release file for a suite and verify its signature. - release_url = f"{mirror}/dists/{suite}/Release" - release_gpg_url = f"{mirror}/dists/{suite}/Release.gpg" + Prefer the inline-signed InRelease, which carries content and signature in + one file. The detached Release and Release.gpg pair can come from two + different snapshots when the mirror updates between requests. - with tempfile.NamedTemporaryFile() as release_file, tempfile.NamedTemporaryFile() as release_gpg_file: - await download_file(session, release_url, release_file.name) - await download_file(session, release_gpg_url, release_gpg_file.name) - - print("Verifying signature of Release with Release.gpg.") - # Use gpgv rather than gpg for verification. gpgv verifies a detached - # signature against a fixed keyring without involving gpg-agent or - # keyboxd, which makes it robust on hosts running GnuPG 2.4+ (e.g. Azure - # Linux) where "gpg --keyring" routes through keyboxd and can fail. - verify_command = ["gpgv"] - if keyring: - verify_command += ["--keyring", keyring] - verify_command += [release_gpg_file.name, release_file.name] - result = subprocess.run(verify_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + Returns None when the mirror doesn't carry the suite. + """ + inrelease = await fetch_url(session, f"{mirror}/dists/{suite}/InRelease") + if inrelease is not None: + with tempfile.NamedTemporaryFile() as inrelease_file: + inrelease_file.write(inrelease) + inrelease_file.flush() + + print(f"Verifying signature of {suite}/InRelease.") + # Use gpgv rather than gpg for verification. gpgv verifies against a + # fixed keyring without involving gpg-agent or keyboxd, which makes it + # robust on hosts running GnuPG 2.4+ (e.g. Azure Linux) where + # "gpg --keyring" routes through keyboxd and can fail. + result = subprocess.run(gpgv_command(keyring) + ["--output", "-", inrelease_file.name], stdout=subprocess.PIPE, stderr=subprocess.PIPE) if result.returncode != 0: raise Exception(f"Signature verification failed: {result.stderr.decode('utf-8')}") print("Signature verified successfully.") + return result.stdout.decode('utf-8') + + release = await fetch_url(session, f"{mirror}/dists/{suite}/Release") + if release is None: + return None + + release_gpg = await fetch_url(session, f"{mirror}/dists/{suite}/Release.gpg") + if release_gpg is None: + raise Exception(f"Release for {suite} has no InRelease or Release.gpg signature") + + with tempfile.NamedTemporaryFile() as release_file, tempfile.NamedTemporaryFile() as release_gpg_file: + release_file.write(release) + release_file.flush() + release_gpg_file.write(release_gpg) + release_gpg_file.flush() + + print(f"Verifying signature of {suite}/Release with Release.gpg.") + result = subprocess.run(gpgv_command(keyring) + [release_gpg_file.name, release_file.name], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if result.returncode != 0: + raise Exception(f"Signature verification failed: {result.stderr.decode('utf-8')}") + + print("Signature verified successfully.") + return release.decode('utf-8') - with open(release_file.name) as f: - return f.read() +def gpgv_command(keyring): + command = ["gpgv"] + if keyring: + command += ["--keyring", keyring] + return command -def parse_release_file(content, path): - """Parses the Release file and returns sha256 checksum of the specified path.""" +def find_release_checksum(content, path): + """Returns the sha256 checksum of the specified path in the Release file, or None.""" # data looks like this: # @@ -153,7 +250,7 @@ def parse_release_file(content, path): if entry[2] == path and len(entry[0]) == 64: return entry[0] - raise Exception(f"Could not find checksum for {path} in Release file.") + return None def parse_debian_version(version): """Parse a Debian package version into epoch, upstream version, and revision.""" diff --git a/eng/common/cross/tizen-build-rootfs.sh b/eng/common/cross/tizen-build-rootfs.sh index ba31c93285f..2f86370665a 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 ba770710900..71f10f422b3 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 f4fe8838ad6..00000000000 --- 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/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index 8d72d803dd2..ad35ccb0dd6 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -49,15 +49,16 @@ function Print-Usage() { Write-Host "Command line arguments not listed above are passed thru to msbuild." } -function Build([string]$target) { - $logSuffix = if ($target -eq 'Execute') { '' } else { ".$target" } - $log = Join-Path $LogDir "$task$logSuffix.binlog" +# Restore is driven by MSBuild's /restore switch, which the shared MSBuild helper adds +# whenever restore is enabled. No separate restore invocation is necessary. +function Build() { + $log = Join-Path $LogDir "$task.binlog" $binaryLogArg = if ($binaryLog) { "/bl:$log" } else { "" } $outputPath = Join-Path $ToolsetDir "$task\" MSBuild $taskProject ` $binaryLogArg ` - /t:$target ` + /t:Execute ` /p:Configuration=$configuration ` /p:RepoRoot=$RepoRoot ` /p:BaseIntermediateOutputPath=$outputPath ` @@ -88,11 +89,7 @@ try { ExitWithExitCode 1 } - if ($restore) { - Build 'Restore' - } - - Build 'Execute' + Build } catch { Write-Host $_.ScriptStackTrace diff --git a/eng/common/sdk-task.sh b/eng/common/sdk-task.sh index a7f1ba060d7..0c14d45a9c0 100644 --- a/eng/common/sdk-task.sh +++ b/eng/common/sdk-task.sh @@ -28,18 +28,17 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +# Restore is driven by MSBuild's /restore switch, which the shared MSBuild helper adds +# whenever restore is enabled. No separate restore invocation is necessary. Build() { - local target=$1 - local log_suffix="" - [[ "$target" != "Execute" ]] && log_suffix=".$target" - local log="$log_dir/$task$log_suffix.binlog" + local log="$log_dir/$task.binlog" local binaryLogArg="" [[ $binary_log == true ]] && binaryLogArg="/bl:$log" local output_path="$toolset_dir/$task/" MSBuild "$taskProject" \ $binaryLogArg \ - /t:"$target" \ + /t:Execute \ /p:Configuration="$configuration" \ /p:RepoRoot="$repo_root" \ /p:BaseIntermediateOutputPath="$output_path" \ @@ -121,11 +120,7 @@ if [[ ! -e "$taskProject" ]]; then ExitWithExitCode 1 fi -if $restore; then - Build "Restore" -fi - -Build "Execute" +Build ExitWithExitCode 0 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 9cb84a8a941..f2e42780a21 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 } @@ -811,7 +829,9 @@ function MSBuild() { } } - $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" + $restoreSwitch = if ($restore) { ' /restore' } else { '' } + + $cmdArgs = "$($buildTool.Command)$restoreSwitch /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" # Build with MSBuild's multi-threaded mode, but not with msbuild.exe (VS MSBuild) for now. # TODO: Enable for VS MSBuild as well: https://github.com/dotnet/dotnet/issues/9989 @@ -936,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 3b4a5ac5142..28286b7052c 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, @@ -615,7 +640,12 @@ function MSBuild { warnnotaserror_switch="/warnnotaserror:$warn_not_as_error /p:AdditionalWarningsNotAsErrors=${warn_not_as_error//;/%3B}" fi - RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch $warnnotaserror_switch ${logger_switch[@]+"${logger_switch[@]}"} /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" + local restore_switch="" + if [[ "$restore" == true ]]; then + restore_switch="/restore" + fi + + RunBuildTool "$_InitializeBuildToolCommand" $restore_switch /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch $warnnotaserror_switch ${logger_switch[@]+"${logger_switch[@]}"} /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } function GetDarc { diff --git a/global.json b/global.json index 677bf782525..a7a754b1e0a 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "12.0.100-alpha.1.26480.102", + "version": "12.0.100-alpha.1.26555.106", "allowPrerelease": true, "rollForward": "latestMinor", "paths": [ @@ -13,7 +13,7 @@ "runner": "Microsoft.Testing.Platform" }, "tools": { - "dotnet": "12.0.100-alpha.1.26480.102", + "dotnet": "12.0.100-alpha.1.26555.106", "vs": { "version": "18.0", "components": [ @@ -23,7 +23,7 @@ "xcopy-msbuild": "18.0.0" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26530.2", + "Microsoft.DotNet.Arcade.Sdk": "12.0.0-beta.26577.1", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2" } }