Files
runner-images/images/win/scripts/Installers/Validate-Boost.ps1
Maksim Petrov 0967620111 Switch Windows hostedtoolcache provisioner to GitHub Actions NPM registry (#315)
* Toolcache: add basic error handling in Windows toolcache provisioner

* Toolcache: add GITHUB_FEED_TOKEN into packer templates for Windows

* Toolcache: separate toolcache.json for Windows

* Rework "Validate-ToolCache" script (#6)

* Rework validate toolcache script

* change boost root folder

* Add boost 1.69 for windows-2019

* Add toolcache config variable to Windows 16, 19

* Revert "Add toolcache config variable to Windows 16, 19"

* Add default boost version for validate-boost VS19

* Remove bjam test for boost

* Add boost 1.72 validation for win-2016

Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
Co-authored-by: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com>
2020-01-29 10:41:09 +03:00

76 lines
1.9 KiB
PowerShell

################################################################################
## File: Validate-Boost.ps1
## Desc: Validate Boost
################################################################################
function Validate-BoostVersion
{
Param
(
[String]$BoostRootPath,
[String]$BoostRelease
)
$ReleasePath = Join-Path -Path $BoostRootPath -ChildPath $BoostRelease
if (Test-Path "$ReleasePath\b2.exe")
{
Write-Host "Boost.Build $BoostRelease is successfully installed"
return
}
Write-Host "$BoostRelease not found"
exit 1
}
# Verify that Boost is on the path
if (Get-Command -Name 'b2')
{
Write-Host "Boost is on the path"
}
else
{
Write-Host "Boost is not on the path"
exit 1
}
# Adding description of the software to Markdown
$tmplMark = @"
#### {0}
_Environment:_
* {1}: root directory of the Boost version {0} installation
"@
$tmplMarkRoot = @"
#### {0}
* PATH: contains the location of Boost version {0}
* BOOST_ROOT: root directory of the Boost version {0} installation
* {1}: root directory of the Boost version {0} installation
"@
$SoftwareName = 'Boost'
$Description = New-Object System.Text.StringBuilder
$BoostRootDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath "Boost"
$BoostVersionsToInstall = $env:BOOST_VERSIONS.split(",")
foreach($BoostVersion in $BoostVersionsToInstall)
{
Validate-BoostVersion -BoostRootPath $BoostRootDirectory -BoostRelease $BoostVersion
$BoostVersionTag = "BOOST_ROOT_{0}" -f $BoostVersion.Replace('.', '_')
if($BoostVersion -eq $env:BOOST_DEFAULT)
{
$null = $Description.AppendLine(($tmplMarkRoot -f $BoostVersion, $BoostVersionTag))
}
else
{
$null = $Description.AppendLine(($tmplMark -f $BoostVersion, $BoostVersionTag))
}
}
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString()