mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 11:21:12 +08:00
e6cabdece5
* start 2021-04-16 process Major new things: * update to macOS Big Sur (11.*) * switch from VirtualBox to Parallels due to ^ (and also ARM) Minor new things: * update from xcode CLT 12 to 12.4 This PR includes new stuff for creating the base box for parallels. Still to do: using the new box type. * update the vagrantfile stuff * link the CI to the new version * modify how macOS boxes are made the Vagrantfile for the final VM will only download the azure pipeline stuff this allows us to keep the versions of brew applications stable * fix cpus and memory * add vagrant plugins to installables * Skip cppgraphqlgen ICE. * [sdformat6] Remove unneeded include(FindBoost) which causes problems when the system cmake version doesn't match the one deployed by vcpkg. * switch to dmg for installing osxfuse/sshfs * Set cores to 11 (leaving 1 thread for host) Co-authored-by: Billy Robert ONeal III <bion@microsoft.com>
133 lines
4.4 KiB
PowerShell
Executable File
133 lines
4.4 KiB
PowerShell
Executable File
#!pwsh
|
|
#Requires -Version 6.0
|
|
|
|
<#
|
|
.SYNOPSIS
|
|
Installs the set of prerequisites for the macOS CI hosts.
|
|
|
|
.DESCRIPTION
|
|
Install-Prerequisites.ps1 installs all of the necessary prerequisites
|
|
to run the vcpkg macOS CI in a vagrant virtual machine,
|
|
skipping all prerequisites that are already installed and of the right version.
|
|
|
|
.INPUTS
|
|
None
|
|
|
|
.OUTPUTS
|
|
None
|
|
#>
|
|
[CmdletBinding()]
|
|
Param()
|
|
|
|
Set-StrictMode -Version 2
|
|
|
|
if (-not $IsMacOS) {
|
|
Write-Error 'This script should only be run on a macOS host'
|
|
throw
|
|
}
|
|
|
|
Import-Module "$PSScriptRoot/Utilities.psm1"
|
|
|
|
$Installables = Get-Content "$PSScriptRoot/configuration/installables.json" | ConvertFrom-Json
|
|
|
|
$Installables.Applications | ForEach-Object {
|
|
$VersionCommand = $_.VersionCommand
|
|
$InstalledVersion = (& $VersionCommand[0] $VersionCommand[1..$VersionCommand.Length])
|
|
if (-not $?) {
|
|
Write-Host "$($_.Name) not installed; installing now"
|
|
} else {
|
|
$InstalledVersion = $InstalledVersion -join "`n"
|
|
if ($InstalledVersion -match $_.VersionRegex) {
|
|
if ($Matches.Count -ne 2) {
|
|
Write-Error "$($_.Name) has a malformed version regex ($($_.VersionRegex)); it should have a single capture group
|
|
(it has $($Matches.Count - 1))"
|
|
throw
|
|
}
|
|
if ($Matches[1] -eq $_.Version) {
|
|
Write-Host "$($_.Name) already installed and at the correct version ($($Matches[1]))"
|
|
return
|
|
} else {
|
|
Write-Host "$($_.Name) already installed but with the incorrect version
|
|
installed version: '$($Matches[1])'
|
|
required version : '$($_.Version)'
|
|
upgrading now."
|
|
}
|
|
} else {
|
|
Write-Warning "$($_.Name)'s version command ($($VersionCommand -join ' ')) returned a value we did not expect:
|
|
$InstalledVersion
|
|
expected a version matching the regex: $($_.VersionRegex)
|
|
Installing anyways."
|
|
}
|
|
}
|
|
|
|
if ($null -ne (Get-Member -InputObject $_ -Name 'DmgUrl')) {
|
|
$pathToDmg = "~/Downloads/$($_.Name).dmg"
|
|
Get-RemoteFile -OutFile $pathToDmg -Uri $_.DmgUrl -Sha256 $_.Sha256
|
|
|
|
hdiutil attach $pathToDmg -mountpoint /Volumes/setup-installer
|
|
sudo installer -pkg "/Volumes/setup-installer/$($_.InstallerPath)" -target /
|
|
hdiutil detach /Volumes/setup-installer
|
|
} elseif ($null -ne (Get-Member -InputObject $_ -Name 'PkgUrl')) {
|
|
$pathToPkg = "~/Downloads/$($_.Name).pkg"
|
|
Get-RemoteFile -OutFile $pathToPkg -Uri $_.PkgUrl -Sha256 $_.Sha256
|
|
|
|
sudo installer -pkg $pathToPkg -target /
|
|
} else {
|
|
Write-Error "$($_.Name) does not have an installer in the configuration file."
|
|
throw
|
|
}
|
|
}
|
|
|
|
$Installables.Brew | ForEach-Object {
|
|
$installable = $_
|
|
if ($null -eq (Get-Member -InputObject $installable -Name 'Kind')) {
|
|
brew install $installable.Name
|
|
} else {
|
|
switch ($installable.Kind) {
|
|
'cask' { brew install --cask $installable.Name }
|
|
default {
|
|
Write-Error "Invalid kind: $_. Expected either empty, or 'cask'."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
brew upgrade
|
|
|
|
$installedVagrantPlugins = @{}
|
|
vagrant plugin list --machine-readable | ForEach-Object {
|
|
$timestamp, $target, $type, $data = $_ -split ','
|
|
switch ($type) {
|
|
# these are not important
|
|
'ui' { }
|
|
'plugin-version-constraint' { }
|
|
'plugin-name' {
|
|
$installedVagrantPlugins[$data] = $Null
|
|
}
|
|
'plugin-version' {
|
|
$version = $data -replace '%!\(VAGRANT_COMMA\)',','
|
|
if ($version -notmatch '^(.*), global') {
|
|
Write-Error "Invalid version string for plugin ${target}: $version"
|
|
throw
|
|
}
|
|
$installedVagrantPlugins[$target] = $Matches[1]
|
|
}
|
|
default {
|
|
Write-Warning "Unknown plugin list member type $type for plugin $target"
|
|
}
|
|
}
|
|
}
|
|
$Installables.VagrantPlugins | ForEach-Object {
|
|
if (-not $installedVagrantPlugins.Contains($_.Name)) {
|
|
Write-Host "$($_.Name) not installed; installing now"
|
|
} elseif ($installedVagrantPlugins[$_.Name] -ne $_.Version) {
|
|
Write-Host "$($_.Name) already installed but with the incorrect version
|
|
installed version: '$($installedVagrantPlugins[$_.Name])'
|
|
required version: '$($_.Version)'"
|
|
} else {
|
|
Write-Host "$($_.Name) already installed and at the correct version ($($_.Version))"
|
|
return
|
|
}
|
|
|
|
vagrant plugin install $_.Name --plugin-version $_.Version
|
|
}
|