diff options
author | dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> | 2019-12-12 16:24:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-12 16:24:35 +0300 |
commit | d6d87c94ad72484e00345b0f29246d229bb97b3b (patch) | |
tree | 03222a06ad75743e6123b73a3a77eb5d81743ffc /eng/common/tools.ps1 | |
parent | 132d8afe7ac5eae64b7597f120319fd2ccca5d5a (diff) |
Update dependencies from https://github.com/dotnet/arcade build 20191211.6 (#855)
- Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19611.6
Diffstat (limited to 'eng/common/tools.ps1')
-rw-r--r-- | eng/common/tools.ps1 | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index d762c9f04..09c3a3325 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -98,7 +98,7 @@ function Exec-Process([string]$command, [string]$commandArgs) { } } -function InitializeDotNetCli([bool]$install) { +function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { if (Test-Path variable:global:_DotNetInstallDir) { return $global:_DotNetInstallDir } @@ -146,6 +146,22 @@ function InitializeDotNetCli([bool]$install) { } $env:DOTNET_INSTALL_DIR = $dotnetRoot + + if ($createSdkLocationFile) { + # Create a temporary file under the toolset dir and rename it to sdk.txt to avoid races. + do { + $sdkCacheFileTemp = Join-Path $ToolsetDir $([System.IO.Path]::GetRandomFileName()) + } + until (!(Test-Path $sdkCacheFileTemp)) + Set-Content -Path $sdkCacheFileTemp -Value $dotnetRoot + + try { + Rename-Item -Force -Path $sdkCacheFileTemp 'sdk.txt' + } catch { + # Somebody beat us + Remove-Item -Path $sdkCacheFileTemp + } + } } # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom @@ -216,7 +232,10 @@ function InstallDotNet([string] $dotnetRoot, } catch { Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet runtime '$runtime' from custom location '$runtimeSourceFeed'." + ExitWithExitCode 1 } + } else { + ExitWithExitCode 1 } } } @@ -274,8 +293,11 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $vsMajorVersion = $vsMinVersion.Major $xcopyMSBuildVersion = "$vsMajorVersion.$($vsMinVersion.Minor).0-alpha" } - - $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install + + $vsInstallDir = $null + if ($xcopyMSBuildVersion.Trim() -ine "none") { + $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install + } if ($vsInstallDir -eq $null) { throw 'Unable to find Visual Studio that has required version and components installed' } |