Fix to not download Dnx always during a build.
This commit is contained in:
parent
3395b43bd9
commit
3a2b87a92d
2 changed files with 33 additions and 15 deletions
|
@ -6,11 +6,8 @@
|
||||||
$Rid = "win7-x64"
|
$Rid = "win7-x64"
|
||||||
$Tfm = "dnxcore50"
|
$Tfm = "dnxcore50"
|
||||||
|
|
||||||
$DnxVersion = "1.0.0-rc1-update1"
|
|
||||||
|
|
||||||
$RepoRoot = Convert-Path "$PSScriptRoot\.."
|
$RepoRoot = Convert-Path "$PSScriptRoot\.."
|
||||||
$OutputDir = "$RepoRoot\artifacts\$Rid"
|
$OutputDir = "$RepoRoot\artifacts\$Rid"
|
||||||
$DnxDir = "$OutputDir\dnx"
|
|
||||||
$Stage1Dir = "$OutputDir\stage1"
|
$Stage1Dir = "$OutputDir\stage1"
|
||||||
$Stage2Dir = "$OutputDir\stage2"
|
$Stage2Dir = "$OutputDir\stage2"
|
||||||
$HostDir = "$OutputDir\corehost"
|
$HostDir = "$OutputDir\corehost"
|
||||||
|
|
|
@ -14,6 +14,36 @@ $ErrorActionPreference="Stop"
|
||||||
$StartPath = $env:PATH
|
$StartPath = $env:PATH
|
||||||
$StartDotNetHome = $env:DOTNET_HOME
|
$StartDotNetHome = $env:DOTNET_HOME
|
||||||
|
|
||||||
|
function getDnx()
|
||||||
|
{
|
||||||
|
$DnxPackage = "dnx-coreclr-win-x64.1.0.0-rc1-update1.nupkg"
|
||||||
|
$DnxVersion = "1.0.0-rc1-16231"
|
||||||
|
$DnxDir = "$OutputDir\dnx"
|
||||||
|
$DnxRoot = "$DnxDir/bin"
|
||||||
|
|
||||||
|
# check if the required dnx version is already downloaded
|
||||||
|
if ((Test-Path "$DnxRoot\dnx.exe")) {
|
||||||
|
$dnxOut = & "$DnxRoot\dnx.exe" --version
|
||||||
|
|
||||||
|
if ($dnxOut -Match $DnxVersion) {
|
||||||
|
Write-Host "Dnx version - $DnxVersion already downloaded."
|
||||||
|
return $DnxRoot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Download dnx to copy to stage2
|
||||||
|
Remove-Item -Recurse -Force -ErrorAction Ignore $DnxDir
|
||||||
|
mkdir -Force "$DnxDir" | Out-Null
|
||||||
|
|
||||||
|
Write-Host "Downloading Dnx version - $DnxVersion."
|
||||||
|
$DnxUrl="https://api.nuget.org/packages/$DnxPackage"
|
||||||
|
Invoke-WebRequest -UseBasicParsing "$DnxUrl" -OutFile "$DnxDir\dnx.zip"
|
||||||
|
|
||||||
|
Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null
|
||||||
|
[System.IO.Compression.ZipFile]::ExtractToDirectory("$DnxDir\dnx.zip", "$DnxDir")
|
||||||
|
return $DnxRoot
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
# Check prereqs
|
# Check prereqs
|
||||||
|
@ -42,22 +72,13 @@ Download it from https://www.cmake.org
|
||||||
$DotNetTools = "$($env:LOCALAPPDATA)\Microsoft\dotnet"
|
$DotNetTools = "$($env:LOCALAPPDATA)\Microsoft\dotnet"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download dnx to copy to stage2
|
$DnxRoot = getDnx
|
||||||
if ((Test-Path "$DnxDir")) {
|
|
||||||
Remove-Item -Recurse -Force $DnxDir
|
|
||||||
}
|
|
||||||
mkdir "$DnxDir" | Out-Null
|
|
||||||
$DnxUrl="https://api.nuget.org/packages/dnx-coreclr-win-x64.$DnxVersion.nupkg"
|
|
||||||
Invoke-WebRequest -UseBasicParsing "$DnxUrl" -OutFile "$DnxDir\dnx.zip"
|
|
||||||
Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null
|
|
||||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$DnxDir\dnx.zip", "$DnxDir")
|
|
||||||
$DnxRoot = "$DnxDir/bin"
|
|
||||||
|
|
||||||
# Restore packages
|
# Restore packages
|
||||||
header "Restoring packages"
|
header "Restoring packages"
|
||||||
& "$DnxRoot\dnu" restore "$RepoRoot" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache
|
& "$DnxRoot\dnu" restore "$RepoRoot" --quiet --runtime "$Rid" --no-cache
|
||||||
if (!$?) {
|
if (!$?) {
|
||||||
Write-Host "Command failed: " dotnet restore "$RepoRoot" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache
|
Write-Host "Command failed: " "$DnxRoot\dnu" restore "$RepoRoot" --quiet --runtime "$Rid" --no-cache
|
||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue