diff --git a/scripts/common.psm1 b/scripts/common.psm1 index c7a59ee7df..2991b7f292 100644 --- a/scripts/common.psm1 +++ b/scripts/common.psm1 @@ -290,3 +290,24 @@ function Get-MSBuildPath { } return $msbuild } + +function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) { + if ($RemotePath -notlike 'http*') { + Copy-Item $RemotePath $LocalPath + return + } + + $retries = 10 + while ($retries -gt 0) { + $retries -= 1 + try { + Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath + return + } + catch { + Write-Verbose "Request failed. $retries retries remaining" + } + } + + Write-Error "Download failed: '$RemotePath'." +} \ No newline at end of file diff --git a/src/Installers/Windows/build.ps1 b/src/Installers/Windows/build.ps1 index fc1e45b081..c6493b84c2 100644 --- a/src/Installers/Windows/build.ps1 +++ b/src/Installers/Windows/build.ps1 @@ -14,10 +14,9 @@ param( [string]$Runtime64Zip, [string]$BuildNumber = 't000', [string]$SignType = '', - + [string]$PackageVersionPropsUrl = $null, [string]$AccessTokenSuffix = $null, [string]$AssetRootUrl = $null, - [switch]$clean ) @@ -68,6 +67,14 @@ try { $msbuildArgs += "-p:DotNetAccessTokenSuffix=$AccessTokenSuffix" } + if ($PackageVersionPropsUrl) { + $IntermediateDir = Join-Path $PSScriptRoot 'obj' + $PropsFilePath = Join-Path $IntermediateDir 'external-dependencies.props' + New-Item -ItemType Directory $IntermediateDir -ErrorAction Ignore | Out-Null + Get-RemoteFile "${PackageVersionPropsUrl}${AccessTokenSuffix}" $PropsFilePath + $msbuildArgs += "-p:DotNetPackageVersionPropsPath=$PropsFilePath" + } + $msbuildArgs += '-t:Build' Invoke-Block { & $msbuild `