Toolcache: Add NPM Toolcache support for Windows/Linux

This commit is contained in:
Maksim Petrov
2019-12-30 11:40:10 +03:00
parent 95954b3f02
commit 4c30ace0cc
14 changed files with 300 additions and 207 deletions

View File

@@ -1,28 +1,16 @@
################################################################################
## File: Install-Boost.ps1
## File: Set-BoostRoot.ps1
## Team: CI-Build
## Desc: Install boost using tool cache
################################################################################
$ToolCache = 'C:\hostedtoolcache\windows\boost'
$BoostDirectory = Join-Path -Path $env:ProgramFiles -ChildPath "Boost"
$BoostVersionsToInstall = $env:BOOST_VERSIONS.split(',')
$BoostVersions = $env:BOOST_VERSIONS.split(',')
$BoostDefault = $env:BOOST_DEFAULT
foreach($BoostVersion in $BoostVersionsToInstall)
foreach($BoostVersion in $BoostVersions)
{
$ZipName = Join-Path -Path $ToolCache -ChildPath "boost_${BoostVersion}_msvc-14.1.zip"
if (-Not (Test-Path $ZipName))
{
Write-Host "$ZipName not found"
exit 1
}
Write-Host "Expanding $ZipName"
$BoostInstallationDir = Join-Path -Path $BoostDirectory -ChildPath $BoostVersion
# Expand-Archive slower for 70% than 7z
& "$env:ProgramFiles\7-Zip\7z.exe" x $ZipName -o"$BoostDirectory" -y
$EnvBoostPath = "BOOST_ROOT_{0}" -f ($BoostVersion.Replace('.', '_'))
setx $EnvBoostPath $BoostInstallationDir /M | Out-Null
@@ -36,10 +24,3 @@ foreach($BoostVersion in $BoostVersionsToInstall)
setx BOOST_ROOT $BoostInstallationDir /M | Out-Null
}
}
# Removing boost cache folder
Write-Host "Removing boost cache folder"
if (Test-Path $ToolCache)
{
Remove-Item -Path $ToolCache -Force -Recurse
}