1 # Initialize variables if they aren't already defined.
2 # These may be defined as parameters of the importing script, or set after importing this script.
4 # CI mode - set to true on CI server for PR validation build or official build.
5 [bool
]$ci = if (Test-Path variable
:ci
) { $ci } else { $false }
7 # Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names.
8 [string
]$configuration = if (Test-Path variable
:configuration
) { $configuration } else { "Debug" }
10 # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build.
11 # Binary log must be enabled on CI.
12 [bool
]$binaryLog = if (Test-Path variable
:binaryLog
) { $binaryLog } else { $ci }
14 # Set to true to use the pipelines logger which will enable Azure logging output.
15 # https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md
16 # This flag is meant as a temporary opt-opt for the feature while validate it across
17 # our consumers. It will be deleted in the future.
18 [bool
]$pipelinesLog = if (Test-Path variable
:pipelinesLog
) { $pipelinesLog } else { $ci }
20 # Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes).
21 [bool
]$prepareMachine = if (Test-Path variable
:prepareMachine
) { $prepareMachine } else { $false }
23 # True to restore toolsets and dependencies.
24 [bool
]$restore = if (Test-Path variable
:restore
) { $restore } else { $true }
26 # Adjusts msbuild verbosity level.
27 [string
]$verbosity = if (Test-Path variable
:verbosity
) { $verbosity } else { "minimal" }
29 # Set to true to reuse msbuild nodes. Recommended to not reuse on CI.
30 [bool
]$nodeReuse = if (Test-Path variable
:nodeReuse
) { $nodeReuse } else { !$ci }
32 # Configures warning treatment in msbuild.
33 [bool
]$warnAsError = if (Test-Path variable
:warnAsError
) { $warnAsError } else { $true }
35 # Specifies which msbuild engine to use for build: 'vs', 'dotnet' or unspecified (determined based on presence of tools.vs in global.json).
36 [string
]$msbuildEngine = if (Test-Path variable
:msbuildEngine
) { $msbuildEngine } else { $null }
38 # True to attempt using .NET Core already that meets requirements specified in global.json
39 # installed on the machine instead of downloading one.
40 [bool
]$useInstalledDotNetCli = if (Test-Path variable
:useInstalledDotNetCli
) { $useInstalledDotNetCli } else { $true }
42 # Enable repos to use a particular version of the on-line dotnet-install scripts.
43 # default URL: https://dot.net/v1/dotnet-install.ps1
44 [string
]$dotnetInstallScriptVersion = if (Test-Path variable
:dotnetInstallScriptVersion
) { $dotnetInstallScriptVersion } else { "v1" }
46 # True to use global NuGet cache instead of restoring packages to repository-local directory.
47 [bool
]$useGlobalNuGetCache = if (Test-Path variable
:useGlobalNuGetCache
) { $useGlobalNuGetCache } else { !$ci }
49 # An array of names of processes to stop on script exit if prepareMachine is true.
50 $processesToStopOnExit = if (Test-Path variable
:processesToStopOnExit
) { $processesToStopOnExit } else { @
("msbuild", "dotnet", "vbcscompiler") }
52 set-strictmode
-version
2.0
53 $ErrorActionPreference = "Stop"
54 [Net
.ServicePointManager
]::SecurityProtocol
= [Net
.SecurityProtocolType
]::Tls12
56 function Create-Directory
([string
[]] $path) {
57 if (!(Test-Path $path)) {
58 New-Item -path
$path -force
-itemType
"Directory" | Out-Null
62 function Unzip
([string
]$zipfile, [string
]$outpath) {
63 Add-Type
-AssemblyName System
.IO
.Compression
.FileSystem
64 [System
.IO
.Compression
.ZipFile
]::ExtractToDirectory
($zipfile, $outpath)
67 # This will exec a process using the console and return it's exit code.
68 # This will not throw when the process fails.
69 # Returns process exit code.
70 function Exec-Process
([string
]$command, [string
]$commandArgs) {
71 $startInfo = New-Object System
.Diagnostics
.ProcessStartInfo
72 $startInfo.FileName
= $command
73 $startInfo.Arguments
= $commandArgs
74 $startInfo.UseShellExecute
= $false
75 $startInfo.WorkingDirectory
= Get-Location
77 $process = New-Object System
.Diagnostics
.Process
78 $process.StartInfo
= $startInfo
79 $process.Start
() | Out-Null
83 while (-not
$process.WaitForExit
(100)) {
84 # Non-blocking loop done to allow ctr-c interrupts
88 return $global:LASTEXITCODE
= $process.ExitCode
91 # If we didn't finish then an error occurred or the user hit ctrl-c. Either
92 # way kill the process
99 function InitializeDotNetCli
([bool
]$install) {
100 if (Test-Path variable
:global
:_DotNetInstallDir
) {
101 return $global:_DotNetInstallDir
104 # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism
105 $env:DOTNET_MULTILEVEL_LOOKUP
=0
107 # Disable first run since we do not need all ASP.NET packages restored.
108 $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE
=1
110 # Disable telemetry on CI.
112 $env:DOTNET_CLI_TELEMETRY_OPTOUT
=1
115 # Source Build uses DotNetCoreSdkDir variable
116 if ($env:DotNetCoreSdkDir
-ne
$null) {
117 $env:DOTNET_INSTALL_DIR
= $env:DotNetCoreSdkDir
120 # Find the first path on %PATH% that contains the dotnet.exe
121 if ($useInstalledDotNetCli -and
(-not
$globalJsonHasRuntimes) -and
($env:DOTNET_INSTALL_DIR
-eq
$null)) {
122 $dotnetCmd = Get-Command "dotnet.exe" -ErrorAction SilentlyContinue
123 if ($dotnetCmd -ne
$null) {
124 $env:DOTNET_INSTALL_DIR
= Split-Path $dotnetCmd.Path
-Parent
128 $dotnetSdkVersion = $GlobalJson.tools
.dotnet
130 # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version,
131 # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues.
132 if ((-not
$globalJsonHasRuntimes) -and
($env:DOTNET_INSTALL_DIR
-ne
$null) -and
(Test-Path(Join-Path $env:DOTNET_INSTALL_DIR
"sdk\$dotnetSdkVersion"))) {
133 $dotnetRoot = $env:DOTNET_INSTALL_DIR
135 $dotnetRoot = Join-Path $RepoRoot ".dotnet"
137 if (-not
(Test-Path(Join-Path $dotnetRoot "sdk\$dotnetSdkVersion"))) {
139 InstallDotNetSdk
$dotnetRoot $dotnetSdkVersion
141 Write-PipelineTelemetryError
-Category
"InitializeToolset" -Message
"Unable to find dotnet with SDK version '$dotnetSdkVersion'"
146 $env:DOTNET_INSTALL_DIR
= $dotnetRoot
149 # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom
150 # build steps from using anything other than what we've downloaded.
151 # It also ensures that VS msbuild will use the downloaded sdk targets.
152 $env:PATH
= "$dotnetRoot;$env:PATH"
154 # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build
155 Write-PipelinePrependPath
-Path
$dotnetRoot
157 Write-PipelineSetVariable
-Name
'DOTNET_MULTILEVEL_LOOKUP' -Value
'0'
158 Write-PipelineSetVariable
-Name
'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' -Value
'1'
160 return $global:_DotNetInstallDir
= $dotnetRoot
163 function GetDotNetInstallScript
([string
] $dotnetRoot) {
164 $installScript = Join-Path $dotnetRoot "dotnet-install.ps1"
165 if (!(Test-Path $installScript)) {
166 Create-Directory
$dotnetRoot
167 $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit
168 Invoke-WebRequest
"https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1" -OutFile
$installScript
171 return $installScript
174 function InstallDotNetSdk
([string
] $dotnetRoot, [string
] $version, [string
] $architecture = "") {
175 InstallDotNet
$dotnetRoot $version $architecture
178 function InstallDotNet
([string
] $dotnetRoot, [string
] $version, [string
] $architecture = "", [string
] $runtime = "", [bool
] $skipNonVersionedFiles = $false) {
179 $installScript = GetDotNetInstallScript
$dotnetRoot
180 $installParameters = @
{
182 InstallDir
= $dotnetRoot
185 if ($architecture) { $installParameters.Architecture
= $architecture }
186 if ($runtime) { $installParameters.Runtime
= $runtime }
187 if ($skipNonVersionedFiles) { $installParameters.SkipNonVersionedFiles
= $skipNonVersionedFiles }
189 & $installScript @installParameters
190 if ($lastExitCode -ne
0) {
191 Write-PipelineTelemetryError
-Category
"InitializeToolset" -Message
"Failed to install dotnet cli (exit code '$lastExitCode')."
192 ExitWithExitCode
$lastExitCode
197 # Locates Visual Studio MSBuild installation.
198 # The preference order for MSBuild to use is as follows:
200 # 1. MSBuild from an active VS command prompt
201 # 2. MSBuild from a compatible VS installation
202 # 3. MSBuild from the xcopy tool package
204 # Returns full path to msbuild.exe.
207 function InitializeVisualStudioMSBuild
([bool
]$install, [object
]$vsRequirements = $null) {
208 if (Test-Path variable
:global
:_MSBuildExe
) {
209 return $global:_MSBuildExe
212 if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools
.vs
}
213 $vsMinVersionStr = if ($vsRequirements.version
) { $vsRequirements.version
} else { "15.9" }
214 $vsMinVersion = [Version
]::new
($vsMinVersionStr)
216 # Try msbuild command available in the environment.
217 if ($env:VSINSTALLDIR
-ne
$null) {
218 $msbuildCmd = Get-Command "msbuild.exe" -ErrorAction SilentlyContinue
219 if ($msbuildCmd -ne
$null) {
220 # Workaround for https://github.com/dotnet/roslyn/issues/35793
221 # Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+
222 $msbuildVersion = [Version
]::new
((Get-Item $msbuildCmd.Path
).VersionInfo
.ProductVersion
.Split
(@
('-', '+'))[0])
224 if ($msbuildVersion -ge
$vsMinVersion) {
225 return $global:_MSBuildExe
= $msbuildCmd.Path
228 # Report error - the developer environment is initialized with incompatible VS version.
229 throw "Developer Command Prompt for VS $($env:VisualStudioVersion) is not recent enough. Please upgrade to $vsMinVersionStr or build from a plain CMD window"
233 # Locate Visual Studio installation or download x-copy msbuild.
234 $vsInfo = LocateVisualStudio
$vsRequirements
235 if ($vsInfo -ne
$null) {
236 $vsInstallDir = $vsInfo.installationPath
237 $vsMajorVersion = $vsInfo.installationVersion
.Split
('.')[0]
239 InitializeVisualStudioEnvironmentVariables
$vsInstallDir $vsMajorVersion
242 if (Get-Member -InputObject
$GlobalJson.tools
-Name
"xcopy-msbuild") {
243 $xcopyMSBuildVersion = $GlobalJson.tools
.'xcopy-msbuild'
244 $vsMajorVersion = $xcopyMSBuildVersion.Split
('.')[0]
246 $vsMajorVersion = $vsMinVersion.Major
247 $xcopyMSBuildVersion = "$vsMajorVersion.$($vsMinVersion.Minor).0-alpha"
250 $vsInstallDir = InitializeXCopyMSBuild
$xcopyMSBuildVersion $install
251 if ($vsInstallDir -eq
$null) {
252 throw "Unable to find Visual Studio that has required version and components installed"
256 $msbuildVersionDir = if ([int
]$vsMajorVersion -lt
16) { "$vsMajorVersion.0" } else { "Current" }
257 return $global:_MSBuildExe
= Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin\msbuild.exe"
260 function InitializeVisualStudioEnvironmentVariables
([string
] $vsInstallDir, [string
] $vsMajorVersion) {
261 $env:VSINSTALLDIR
= $vsInstallDir
262 Set-Item "env:VS$($vsMajorVersion)0COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\")
264 $vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\"
265 if (Test-Path $vsSdkInstallDir) {
266 Set-Item "env:VSSDK$($vsMajorVersion)0Install" $vsSdkInstallDir
267 $env:VSSDKInstall
= $vsSdkInstallDir
271 function InstallXCopyMSBuild
([string
]$packageVersion) {
272 return InitializeXCopyMSBuild
$packageVersion -install
$true
275 function InitializeXCopyMSBuild
([string
]$packageVersion, [bool
]$install) {
276 $packageName = "RoslynTools.MSBuild"
277 $packageDir = Join-Path $ToolsDir "msbuild\$packageVersion"
278 $packagePath = Join-Path $packageDir "$packageName.$packageVersion.nupkg"
280 if (!(Test-Path $packageDir)) {
285 Create-Directory
$packageDir
286 Write-Host "Downloading $packageName $packageVersion"
287 $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit
288 Invoke-WebRequest
"https://dotnet.myget.org/F/roslyn-tools/api/v2/package/$packageName/$packageVersion/" -OutFile
$packagePath
289 Unzip
$packagePath $packageDir
292 return Join-Path $packageDir "tools"
296 # Locates Visual Studio instance that meets the minimal requirements specified by tools.vs object in global.json.
298 # The following properties of tools.vs are recognized:
299 # "version": "{major}.{minor}"
300 # Two part minimal VS version, e.g. "15.9", "16.0", etc.
301 # "components": ["componentId1", "componentId2", ...]
302 # Array of ids of workload components that must be available in the VS instance.
303 # See e.g. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-enterprise?view=vs-2017
305 # Returns JSON describing the located VS instance (same format as returned by vswhere),
306 # or $null if no instance meeting the requirements is found on the machine.
308 function LocateVisualStudio
([object
]$vsRequirements = $null){
309 if (Get-Member -InputObject
$GlobalJson.tools
-Name
"vswhere") {
310 $vswhereVersion = $GlobalJson.tools
.vswhere
312 $vswhereVersion = "2.5.2"
315 $vsWhereDir = Join-Path $ToolsDir "vswhere\$vswhereVersion"
316 $vsWhereExe = Join-Path $vsWhereDir "vswhere.exe"
318 if (!(Test-Path $vsWhereExe)) {
319 Create-Directory
$vsWhereDir
320 Write-Host "Downloading vswhere"
321 Invoke-WebRequest
"https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile
$vswhereExe
324 if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools
.vs
}
325 $args = @
("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild", "-products", "*")
327 if (Get-Member -InputObject
$vsRequirements -Name
"version") {
329 $args += $vsRequirements.version
332 if (Get-Member -InputObject
$vsRequirements -Name
"components") {
333 foreach ($component in $vsRequirements.components
) {
339 $vsInfo =& $vsWhereExe $args | ConvertFrom-Json
341 if ($lastExitCode -ne
0) {
345 # use first matching instance
349 function InitializeBuildTool
() {
350 if (Test-Path variable
:global
:_BuildTool
) {
351 return $global:_BuildTool
354 if (-not
$msbuildEngine) {
355 $msbuildEngine = GetDefaultMSBuildEngine
358 # Initialize dotnet cli if listed in 'tools'
360 if (Get-Member -InputObject
$GlobalJson.tools
-Name
"dotnet") {
361 $dotnetRoot = InitializeDotNetCli
-install
:$restore
364 if ($msbuildEngine -eq
"dotnet") {
366 Write-PipelineTelemetryError
-Category
"InitializeToolset" -Message
"/global.json must specify 'tools.dotnet'."
369 $buildTool = @
{ Path
= Join-Path $dotnetRoot "dotnet.exe"; Command
= "msbuild"; Tool
= "dotnet"; Framework
= "netcoreapp2.1" }
370 } elseif
($msbuildEngine -eq
"vs") {
372 $msbuildPath = InitializeVisualStudioMSBuild
-install
:$restore
374 Write-PipelineTelemetryError
-Category
"InitializeToolset" -Message
$_
378 $buildTool = @
{ Path
= $msbuildPath; Command
= ""; Tool
= "vs"; Framework
= "net472" }
380 Write-PipelineTelemetryError
-Category
"InitializeToolset" -Message
"Unexpected value of -msbuildEngine: '$msbuildEngine'."
384 return $global:_BuildTool
= $buildTool
387 function GetDefaultMSBuildEngine
() {
388 # Presence of tools.vs indicates the repo needs to build using VS msbuild on Windows.
389 if (Get-Member -InputObject
$GlobalJson.tools
-Name
"vs") {
393 if (Get-Member -InputObject
$GlobalJson.tools
-Name
"dotnet") {
397 Write-PipelineTelemetryError
-Category
"InitializeToolset" -Message
"-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'."
401 function GetNuGetPackageCachePath
() {
402 if ($env:NUGET_PACKAGES
-eq
$null) {
403 # Use local cache on CI to ensure deterministic build,
404 # use global cache in dev builds to avoid cost of downloading packages.
405 if ($useGlobalNuGetCache) {
406 $env:NUGET_PACKAGES
= Join-Path $env:UserProfile
".nuget\packages"
408 $env:NUGET_PACKAGES
= Join-Path $RepoRoot ".packages"
412 return $env:NUGET_PACKAGES
415 # Returns a full path to an Arcade SDK task project file.
416 function GetSdkTaskProject
([string
]$taskName) {
417 return Join-Path (Split-Path (InitializeToolset
) -Parent
) "SdkTasks\$taskName.proj"
420 function InitializeNativeTools
() {
421 if (Get-Member -InputObject
$GlobalJson -Name
"native-tools") {
425 InstallDirectory
= "$ToolsDir"
428 & "$PSScriptRoot/init-tools-native.ps1" @nativeArgs
432 function InitializeToolset
() {
433 if (Test-Path variable
:global
:_ToolsetBuildProj
) {
434 return $global:_ToolsetBuildProj
437 $nugetCache = GetNuGetPackageCachePath
439 $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk'
440 $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt"
442 if (Test-Path $toolsetLocationFile) {
443 $path = Get-Content $toolsetLocationFile -TotalCount
1
444 if (Test-Path $path) {
445 return $global:_ToolsetBuildProj
= $path
450 Write-PipelineTelemetryError
-Category
"InitializeToolset" -Message
"Toolset version $toolsetVersion has not been restored."
454 $buildTool = InitializeBuildTool
456 $proj = Join-Path $ToolsetDir "restore.proj"
457 $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "ToolsetRestore.binlog") } else { "" }
459 '<Project Sdk="Microsoft.DotNet.Arcade.Sdk"/>' | Set-Content $proj
461 MSBuild-Core
$proj $bl /t
:__WriteToolsetLocation
/clp:ErrorsOnly`
;NoSummary
/p
:__ToolsetLocationOutputFile
=$toolsetLocationFile
463 $path = Get-Content $toolsetLocationFile -TotalCount
1
464 if (!(Test-Path $path)) {
465 throw "Invalid toolset path: $path"
468 return $global:_ToolsetBuildProj
= $path
471 function ExitWithExitCode
([int
] $exitCode) {
472 if ($ci -and
$prepareMachine) {
478 function Stop-Processes
() {
479 Write-Host "Killing running build processes..."
480 foreach ($processName in $processesToStopOnExit) {
481 Get-Process -Name
$processName -ErrorAction SilentlyContinue
| Stop-Process
486 # Executes msbuild (or 'dotnet msbuild') with arguments passed to the function.
487 # The arguments are automatically quoted.
488 # Terminates the script if the build fails.
492 $buildTool = InitializeBuildTool
494 # Work around issues with Azure Artifacts credential provider
495 # https://github.com/dotnet/arcade/issues/3932
496 if ($ci -and
$buildTool.Tool
-eq
"dotnet") {
497 dotnet nuget locals http-cache
-c
499 $env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS
= 20
500 $env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS
= 20
501 Write-PipelineSetVariable
-Name
'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS' -Value
'20'
502 Write-PipelineSetVariable
-Name
'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value
'20'
505 $toolsetBuildProject = InitializeToolset
506 $path = Split-Path -parent
$toolsetBuildProject
507 $path = Join-Path $path (Join-Path $buildTool.Framework
"Microsoft.DotNet.Arcade.Sdk.dll")
508 $args += "/logger:$path"
515 # Executes msbuild (or 'dotnet msbuild') with arguments passed to the function.
516 # The arguments are automatically quoted.
517 # Terminates the script if the build fails.
519 function MSBuild-Core
() {
522 Write-PipelineTaskError
-Message
"Binary log must be enabled in CI build."
527 Write-PipelineTaskError
-Message
"Node reuse must be disabled in CI build."
532 $buildTool = InitializeBuildTool
534 $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci"
537 $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true"
540 $cmdArgs += " /p:TreatWarningsAsErrors=false"
543 foreach ($arg in $args) {
544 if ($arg -ne
$null -and
$arg.Trim
() -ne
"") {
545 $cmdArgs += " `"$arg`
""
549 $exitCode = Exec-Process
$buildTool.Path
$cmdArgs
551 if ($exitCode -ne
0) {
552 Write-PipelineTaskError
-Message
"Build failed."
554 $buildLog = GetMSBuildBinaryLogCommandLineArgument
$args
555 if ($buildLog -ne
$null) {
556 Write-Host "See log: $buildLog" -ForegroundColor DarkGray
559 ExitWithExitCode
$exitCode
563 function GetMSBuildBinaryLogCommandLineArgument
($arguments) {
564 foreach ($argument in $arguments) {
565 if ($argument -ne
$null) {
566 $arg = $argument.Trim
()
567 if ($arg.StartsWith
("/bl:", "OrdinalIgnoreCase")) {
568 return $arg.Substring
("/bl:".Length
)
571 if ($arg.StartsWith
("/binaryLogger:", "OrdinalIgnoreCase")) {
572 return $arg.Substring
("/binaryLogger:".Length
)
580 . $PSScriptRoot\pipeline-logging-functions
.ps1
582 $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")
583 $EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
584 $ArtifactsDir = Join-Path $RepoRoot "artifacts"
585 $ToolsetDir = Join-Path $ArtifactsDir "toolset"
586 $ToolsDir = Join-Path $RepoRoot ".tools"
587 $LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration
588 $TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration
589 $GlobalJson = Get-Content -Raw
-Path
(Join-Path $RepoRoot "global.json") | ConvertFrom-Json
590 # true if global.json contains a "runtimes" section
591 $globalJsonHasRuntimes = if ($GlobalJson.tools
.PSObject
.Properties
.Name
-Match
'runtimes') { $true } else { $false }
593 Create-Directory
$ToolsetDir
594 Create-Directory
$TempDir
595 Create-Directory
$LogDir
597 Write-PipelineSetVariable
-Name
'Artifacts' -Value
$ArtifactsDir
598 Write-PipelineSetVariable
-Name
'Artifacts.Toolset' -Value
$ToolsetDir
599 Write-PipelineSetVariable
-Name
'Artifacts.Log' -Value
$LogDir
600 Write-PipelineSetVariable
-Name
'TEMP' -Value
$TempDir
601 Write-PipelineSetVariable
-Name
'TMP' -Value
$TempDir
603 # Import custom tools configuration, if present in the repo.
604 # Note: Import in global scope so that the script set top-level variables without qualification.
605 $configureToolsetScript = Join-Path $EngRoot "configure-toolset.ps1"
606 if (Test-Path $configureToolsetScript) {
607 . $configureToolsetScript