mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 19:46:46 +00:00
[macOS] Update Xcode installer script - type optimization (#11459)
This commit is contained in:
@@ -33,17 +33,7 @@ Write-Host "Configuring Xcode versions..."
|
||||
$xcodeVersions | ForEach-Object {
|
||||
Write-Host "Configuring Xcode $($_.link) ..."
|
||||
Invoke-XcodeRunFirstLaunch -Version $_.link
|
||||
|
||||
if ($_.install_runtimes -eq 'true') {
|
||||
# Additional simulator runtimes are included by default for Xcode < 14
|
||||
Install-AdditionalSimulatorRuntimes -Version $_.link
|
||||
}
|
||||
|
||||
ForEach($runtime in $_.runtimes) {
|
||||
Write-Host "Installing Additional runtimes for Xcode '$runtime' ..."
|
||||
$xcodebuildPath = Get-XcodeToolPath -Version $_.link -ToolName 'xcodebuild'
|
||||
Invoke-ValidateCommand "sudo $xcodebuildPath -downloadPlatform $runtime" | Out-Null
|
||||
}
|
||||
Install-AdditionalSimulatorRuntimes -Version $_.link -Runtimes $_.install_runtimes
|
||||
}
|
||||
|
||||
Invoke-XcodeRunFirstLaunch -Version $defaultXcode
|
||||
|
||||
@@ -165,10 +165,6 @@ function Invoke-XcodeRunFirstLaunch {
|
||||
[string] $Version
|
||||
)
|
||||
|
||||
if ($Version.StartsWith("8") -or $Version.StartsWith("9")) {
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "Running 'runFirstLaunch' for Xcode $Version..."
|
||||
$xcodeRootPath = Get-XcodeToolPath -Version $Version -ToolName "xcodebuild"
|
||||
Invoke-ValidateCommand "sudo $xcodeRootPath -runFirstLaunch"
|
||||
@@ -177,12 +173,36 @@ function Invoke-XcodeRunFirstLaunch {
|
||||
function Install-AdditionalSimulatorRuntimes {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[string] $Version
|
||||
[string] $Version,
|
||||
[Parameter(Mandatory)]
|
||||
[array] $Runtimes
|
||||
)
|
||||
|
||||
Write-Host "Installing Simulator Runtimes for Xcode $Version ..."
|
||||
$xcodebuildPath = Get-XcodeToolPath -Version $Version -ToolName "xcodebuild"
|
||||
Invoke-ValidateCommand "$xcodebuildPath -downloadAllPlatforms" | Out-Null
|
||||
$xcodebuildPath = Get-XcodeToolPath -Version $Version -ToolName 'xcodebuild'
|
||||
$validRuntimes = @("iOS", "watchOS", "tvOS", "visionOS")
|
||||
# Install all runtimes / skip all runtimes installation
|
||||
if ($Runtimes.Count -eq 1) {
|
||||
if ($Runtimes[0] -eq "true") {
|
||||
Write-Host "Installing all runtimes for Xcode $Version ..."
|
||||
Invoke-ValidateCommand "sudo $xcodebuildPath -downloadAllPlatforms" | Out-Null
|
||||
return
|
||||
} elseif ($Runtimes[0] -eq "false") {
|
||||
Write-Host "Skipping runtimes installation for Xcode $Version ..."
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
# Validate and install specified runtimes
|
||||
$invalidRuntimes = $Runtimes | Where-Object { $_ -notin $validRuntimes }
|
||||
if ($invalidRuntimes) {
|
||||
throw "Error: Invalid runtimes detected: $($invalidRuntimes -join ', '). Valid values are: $validRuntimes."
|
||||
}
|
||||
|
||||
foreach ($runtime in $Runtimes) {
|
||||
Write-Host "Installing runtime $runtime ..."
|
||||
Invoke-ValidateCommand "sudo $xcodebuildPath -downloadPlatform $runtime" | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
function Build-XcodeSymlinks {
|
||||
|
||||
Reference in New Issue
Block a user