diff --git a/eng/Build.ps1 b/eng/Build.ps1 index d7053f7da5a..a81b55acdad 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -89,6 +89,7 @@ if ($ci -and -not $PSBoundParameters.ContainsKey('msbuildMultiThreaded')) { } $BuildCategory = "" $BuildMessage = "" +$bootstrapMultiThreaded = !$PSBoundParameters.ContainsKey('msbuildMultiThreaded') -or $msbuildMultiThreaded $desktopTargetFramework = "net472" # Read product TFM from centralized source of truth via MSBuild @@ -827,7 +828,7 @@ try { if ($bootstrap) { $script:BuildMessage = "Failure building bootstrap compiler" - $bootstrapDir = Make-BootstrapBuild + $bootstrapDir = Make-BootstrapBuild -msbuildMultiThreaded $bootstrapMultiThreaded } $script:BuildMessage = "Failure building product" diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index 644171f1eb4..42c4a879247 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -232,7 +232,7 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string] # # Important to not set $script:bootstrapDir here yet as we're actually in the process of # building the bootstrap. -function Make-BootstrapBuild() { +function Make-BootstrapBuild([bool]$msbuildMultiThreaded = $true) { Write-Host "Building bootstrap '$bootstrapTfm' compiler with '$fsharpNetCoreProductTfm' .NET Core product TFM" $dir = Join-Path $ArtifactsDir "Bootstrap" @@ -248,6 +248,9 @@ function Make-BootstrapBuild() { # prepare compiler $projectpath = "$RepoRoot" + "proto.proj" $args = "publish `"$projectpath`" -c $bootstrapConfiguration" + if ($msbuildMultiThreaded) { + $args += " -mt" + } if ($binaryLog) { $logFilePath = Join-Path $LogDir "bootstrap.binlog" $args += " /bl:`"$logFilePath`"" diff --git a/eng/build.sh b/eng/build.sh index 2af459b621e..e10dbe95923 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -220,6 +220,7 @@ while [[ $# > 0 ]]; do done # Import Arcade functions +bootstrap_multi_threaded=${msbuild_multi_threaded:-true} . "$scriptroot/common/tools.sh" function Test() { @@ -334,6 +335,9 @@ function BuildSolution { BuildMessage="Error building tools" local args=("publish" "$repo_root/proto.proj" "$blrestore" "$bltools" "/p:Configuration=Proto" "/p:DotNetBuild=$product_build" "/p:DotNetBuildSourceOnly=$source_build" "/p:DotNetBuildFromVMR=$from_vmr" ${properties[@]+"${properties[@]}"}) + if [[ "$(NormalizeBoolArg "$bootstrap_multi_threaded")" == true ]]; then + args+=("-mt") + fi echo $args "$DOTNET_INSTALL_DIR/dotnet" "${args[@]}" || exit $? fi diff --git a/eng/test-determinism.ps1 b/eng/test-determinism.ps1 index 1984acc01a7..2450adeae61 100644 --- a/eng/test-determinism.ps1 +++ b/eng/test-determinism.ps1 @@ -406,6 +406,7 @@ function TryDownloadDotnetFrameworkSdk() { } try { + $msbuildMultiThreaded = $true . (Join-Path $PSScriptRoot "build-utils.ps1") # Create all of the logging directories diff --git a/tests/EndToEndBuildTests/MultithreadedTasks/README.md b/tests/EndToEndBuildTests/MultithreadedTasks/README.md index e8340336c8a..3f6a070e53a 100644 --- a/tests/EndToEndBuildTests/MultithreadedTasks/README.md +++ b/tests/EndToEndBuildTests/MultithreadedTasks/README.md @@ -34,7 +34,8 @@ Both reuse their built products and publish the SDK evidence. There are no separ The existing Linux and macOS build jobs use Arcade's `--mt true` option. The three `Plain_Build_*` SDK jobs pass `-mt` directly to MSBuild. Those plain builds use SDK-shipped tasks; the redirected product builds and this harness exercise the migrated tasks. -VS/MSBuild.exe jobs and Arcade-managed source-build configuration are unchanged. +Bootstrap publishing uses MT by default on Windows and Unix; explicit `-mt 0` / `--mt false` build options disable it. ILVerify and both compiler determinism modes explicitly opt into MSBuild MT. The determinism modes still compare the same F# compiler flags or sequential versus parallel compilation, independently of MSBuild scheduling. +Other VS/MSBuild.exe product builds and Arcade-managed source-build configuration are unchanged. No repository-wide environment override or replacement for Arcade's MT controls is added. Use `--repetitions 10` for local stress runs. diff --git a/tests/ILVerify/ilverify.ps1 b/tests/ILVerify/ilverify.ps1 index 70e331b06c3..8be69f41b2e 100644 --- a/tests/ILVerify/ilverify.ps1 +++ b/tests/ILVerify/ilverify.ps1 @@ -39,7 +39,7 @@ Write-Host "Checking whether running on Windows: $IsWindows" Write-Host "Repository path: $repo_path" [string] $script = if ($IsWindows) { Join-Path $repo_path "build.cmd" } else { Join-Path $repo_path "build.sh" } -[string] $additional_arguments = if ($IsWindows) { "-noVisualStudio -ci -bootstrap" } else { "" } +[string[]] $additional_arguments = if ($IsWindows) { "-noVisualStudio", "-ci", "-bootstrap", "-mt", "1" } else { "--mt", "true" } # Set environment variable to disable UpdateXlf target (not needed for IL verification) $env:UpdateXlfOnBuild = "false" @@ -76,11 +76,7 @@ if ($LASTEXITCODE -ne 0) { # Run build script for each configuration (NOTE: We don't build Proto) foreach ($configuration in $configurations) { Write-Host "Building $configuration configuration..." - if ($additional_arguments) { - & $script -c $configuration $additional_arguments - } else { - & $script -c $configuration - } + & $script -c $configuration @additional_arguments if ($LASTEXITCODE -ne 0 -And $LASTEXITCODE -ne '') { Write-Host "Build failed for $configuration configuration (last exit code: $LASTEXITCODE)." exit 1