Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .vsts-dotnet-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
displayName: cibuild_bootstrapped_msbuild.cmd
inputs:
filename: 'eng/cibuild_bootstrapped_msbuild.cmd'
arguments: -onlyDocChanged $(onlyDocChanged)
arguments: '-onlyDocChanged $(onlyDocChanged) -stage2Properties /mt'
env:
ForceUseXCopyMSBuild: 1
# Task to collect code coverage on Windows. Disabled by default due to being unstable and sometimes it stucks forever
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
displayName: cibuild_bootstrapped_msbuild.cmd
inputs:
filename: 'eng/cibuild_bootstrapped_msbuild.cmd'
arguments: '-msbuildEngine dotnet -onlyDocChanged $(onlyDocChanged)'
arguments: '-msbuildEngine dotnet -onlyDocChanged $(onlyDocChanged) -stage2Properties /mt'
env:
MSBUILDUSESERVER: "1"
# Task to collect code coverage on Windows. Disabled by default due to being unstable and sometimes it stucks forever
Expand Down Expand Up @@ -267,6 +267,9 @@ jobs:
continueOnError: true
condition: eq(variables.onlyDocChanged, 0)

# Dedicated /mt validation that turns on the ThreadSafeTaskAnalyzer (BuildAnalyzer=true),
# kept as a separate Linux Core job because the analyzer is more expensive and the regular
# bootstrapped CI jobs (which all run /mt now too) do not need it.
- job: BootstrapMSBuildWithMTMode
displayName: "Linux Core Multithreaded Mode"
pool:
Expand Down Expand Up @@ -406,7 +409,7 @@ jobs:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- bash: sudo apt-get update
- bash: sudo apt-get install -y libxml2
- bash: . 'eng/cibuild_bootstrapped_msbuild.sh' --onlyDocChanged $(onlyDocChanged)
- bash: . 'eng/cibuild_bootstrapped_msbuild.sh' --onlyDocChanged $(onlyDocChanged) --stage2Properties '/mt'
displayName: CI Build
env:
MSBUILDUSESERVER: "1"
Expand Down Expand Up @@ -494,7 +497,7 @@ jobs:
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- bash: . 'eng/cibuild_bootstrapped_msbuild.sh' --onlyDocChanged $(onlyDocChanged)
- bash: . 'eng/cibuild_bootstrapped_msbuild.sh' --onlyDocChanged $(onlyDocChanged) --stage2Properties '/mt'
displayName: CI Build
env:
MSBUILDUSESERVER: "1"
Expand Down
25 changes: 20 additions & 5 deletions eng/cibuild_bootstrapped_msbuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Param(
[switch] $prepareMachine,
[bool] $buildStage1 = $True,
[bool] $onlyDocChanged = 0,
[switch] $skipTests,
[string] $stage2Properties = "",
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
)

Expand Down Expand Up @@ -85,9 +87,7 @@ try {
else
{
$buildToolPath = "$bootstrapRoot\core\dotnet.exe"
$propsFile = Join-Path $PSScriptRoot "Versions.props"
$bootstrapSdkVersion = ([xml](Get-Content $propsFile)).SelectSingleNode("//PropertyGroup/BootstrapSdkVersion").InnerText
$buildToolCommand = "$bootstrapRoot\core\sdk\$bootstrapSdkVersion\MSBuild.dll"
$buildToolCommand = "msbuild"
$buildToolFramework = "net"

$env:DOTNET_ROOT="$bootstrapRoot\core"
Expand Down Expand Up @@ -120,11 +120,26 @@ try {
# When using bootstrapped MSBuild:
# - Turn off node reuse (so that bootstrapped MSBuild processes don't stay running and lock files)
# - Create bootstrap environment as it's required when also running tests
# - $stage2Properties are appended to the stage 2 build only (matching cibuild_bootstrapped_msbuild.sh).
# Use this for switches like /mt that should not be passed to the stable MSBuild used in stage 1
# until a stable version of MT is available in the images.
# Branches mirror cibuild_bootstrapped_msbuild.sh exactly:
# onlyDocChanged=1 → bootstrap not created (artifacts not needed downstream)
Comment thread
JanProvaznik marked this conversation as resolved.
# skipTests → bootstrap IS created (downstream MAY consume it), tests omitted
# default → bootstrap created, tests run
# The @(...) wrapper is important: when -split returns exactly one element PowerShell
# gives back a string, and `& cmd @stringVar` splats its characters one-per-argument
# (so "/mt" becomes "/", "m", "t"). Wrapping with @() forces an array even for a
# single token.
$stage2Args = @(if ($stage2Properties) { $stage2Properties -split '\s+' | Where-Object { $_ } } else { @() })
if ($onlyDocChanged) {
& $PSScriptRoot\Common\Build.ps1 -restore -build -ci /p:CreateBootstrap=false /nr:false @properties
& $PSScriptRoot\Common\Build.ps1 -restore -build -ci /p:CreateBootstrap=false /nr:false @properties @stage2Args
}
elseif ($skipTests) {
& $PSScriptRoot\Common\Build.ps1 -restore -build -ci /nr:false @properties @stage2Args
}
else {
& $PSScriptRoot\Common\Build.ps1 -restore -build -test -ci /nr:false @properties
& $PSScriptRoot\Common\Build.ps1 -restore -build -test -ci /nr:false @properties @stage2Args
}

exit $lastExitCode
Expand Down
Loading