diff options
author | dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> | 2020-11-02 16:36:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 16:36:39 +0300 |
commit | 068b622e449ac44ac4d3e0131b797ef7107f2764 (patch) | |
tree | 06277bb5ac3d4876e8e86e6e0130ab56bd89aa68 /eng/common/tools.ps1 | |
parent | 3a382900799ab44071246fe4394041164f9c9b9b (diff) |
Update dependencies from https://github.com/dotnet/arcade build 20201029.1 (#1599)
[master] Update dependencies from dotnet/arcade
Diffstat (limited to 'eng/common/tools.ps1')
-rw-r--r-- | eng/common/tools.ps1 | 63 |
1 files changed, 25 insertions, 38 deletions
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 9014e0625..fc09059ff 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -57,15 +57,11 @@ set-strictmode -version 2.0 $ErrorActionPreference = 'Stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -# If specified, provides an alternate path for getting .NET Core SDKs and Runtimes. This script will still try public sources first. +# If specifies, provides an alternate path for getting .NET Core SDKs and Runtimes. This script will still try public sources first. [string]$runtimeSourceFeed = if (Test-Path variable:runtimeSourceFeed) { $runtimeSourceFeed } else { $null } # Base-64 encoded SAS token that has permission to storage container described by $runtimeSourceFeed [string]$runtimeSourceFeedKey = if (Test-Path variable:runtimeSourceFeedKey) { $runtimeSourceFeedKey } else { $null } -# If false, use copy of dotnet-install from /eng/common/dotnet-install-scripts (for custom behaviors). -# otherwise will fetch from public location. -[bool]$useDefaultDotnetInstall = if (Test-Path variable:useDefaultDotnetInstall) { $useDefaultDotnetInstall } else { $false } - function Create-Directory ([string[]] $path) { New-Item -Path $path -Force -ItemType 'Directory' | Out-Null } @@ -197,46 +193,37 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { function GetDotNetInstallScript([string] $dotnetRoot) { $installScript = Join-Path $dotnetRoot 'dotnet-install.ps1' if (!(Test-Path $installScript)) { - create-directory $dotnetroot - - if ($useDefaultDotnetInstall) - { - $progresspreference = 'silentlycontinue' # don't display the console progress ui - it's a huge perf hit + Create-Directory $dotnetRoot + $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - $maxretries = 5 - $retries = 1 + $maxRetries = 5 + $retries = 1 - $uri = "https://dot.net/$dotnetinstallscriptversion/dotnet-install.ps1" + $uri = "https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1" - while($true) { - try { - write-host "get $uri" - invoke-webrequest $uri -outfile $installscript - break - } - catch { - write-host "failed to download '$uri'" - write-error $_.exception.message -erroraction continue - } + while($true) { + try { + Write-Host "GET $uri" + Invoke-WebRequest $uri -OutFile $installScript + break + } + catch { + Write-Host "Failed to download '$uri'" + Write-Error $_.Exception.Message -ErrorAction Continue + } - if (++$retries -le $maxretries) { - $delayinseconds = [math]::pow(2, $retries) - 1 # exponential backoff - write-host "retrying. waiting for $delayinseconds seconds before next attempt ($retries of $maxretries)." - start-sleep -seconds $delayinseconds - } - else { - throw "unable to download file in $maxretries attempts." - } + if (++$retries -le $maxRetries) { + $delayInSeconds = [math]::Pow(2, $retries) - 1 # Exponential backoff + Write-Host "Retrying. Waiting for $delayInSeconds seconds before next attempt ($retries of $maxRetries)." + Start-Sleep -Seconds $delayInSeconds } - } - else - { - # Use a special version of the script from eng/common that understands the existence of a "productVersion.txt" in a dotnet path. - # See https://github.com/dotnet/arcade/issues/6047 for details - $engCommonCopy = Resolve-Path (Join-Path $PSScriptRoot 'dotnet-install-scripts\dotnet-install.ps1') - Copy-Item $engCommonCopy -Destination $installScript -Force + else { + throw "Unable to download file in $maxRetries attempts." + } + } } + return $installScript } |