mirror of
https://github.com/actions/runner-images.git
synced 2025-12-12 03:57:32 +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 {
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
- `link` property points to the place where Xcode will be located on image. `/Applications/Xcode_<link>.app`
|
||||
- `version` points to Xcode version that will be downloaded and installed
|
||||
- `symlinks` describes the list of aliases where symlinks will be created to
|
||||
- `install_runtimes` is boolean function to control over the related simulator runtimes
|
||||
- `install_runtimes` is an array or boolean function to control over the related simulator runtimes, set of possible values: [ `iOS`, `watchOS`, `visionOS`, `tvOS` ], use `true` if you want to install all runtimes, use `false` if you want to skip runtimes installation
|
||||
- `sha256` used to check integrity of the Xcode installer file
|
||||
- `default` - version of Xcode to set as default (should be metched with any `link` in `versions` property)
|
||||
**Example:** `"11.2"`
|
||||
|
||||
**Note:**
|
||||
|
||||
- If `version` is specified with spaces, it is considered as exact Xcode name like `12.1.1 Release Candidate`.
|
||||
- If `version` doesn't contain spaces, the latest version will be resolved with the following priority:
|
||||
- stable version like `12.1`
|
||||
- release candidate version like `12.1 Release Candidate N` (the latest N will be chosen)
|
||||
- GM version like `12.1 GM Seed N` (the latest N will be chosen)
|
||||
- beta version like `12.1 beta N` (the latest N will be chosen)
|
||||
- `version` is specified with `+` or `-`, exact Xcode name should be like `16.2.0-Beta.3+16C5023f` or `16.2_Release_Candidate+16C5031c` and will be matching `.xip` file name.
|
||||
- `link` is specified with `_` and doesn't contain spaces, example: `16.2_Release_Candidate` or `16.1`; pattern description:
|
||||
- DOWNLOAD_URL="https://download.developer.apple.com/Developer_Tools/$SOURCE_FILE_LOCATION/$SOURCE_FILE_NAME.$FILE_EXTENSION"
|
||||
- SOURCE_FILE_NAME: "Xcode_$link"
|
||||
- SOURCE_FILE_LOCATION: "Xcode_$link"
|
||||
- FILE_EXTENSION: xip
|
||||
|
||||
**Example:**
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"default": "15.4",
|
||||
"x64": {
|
||||
"versions": [
|
||||
{ "link": "16.2", "version": "16.2+16C5032a", "runtimes": ["iOS", "watchOS", "tvOS"], "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de"},
|
||||
{ "link": "16.1", "version": "16.1+16B40", "runtimes": ["iOS", "watchOS", "tvOS"], "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720"},
|
||||
{ "link": "16.2", "version": "16.2+16C5032a", "install_runtimes": ["iOS", "watchOS", "tvOS"], "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de"},
|
||||
{ "link": "16.1", "version": "16.1+16B40", "install_runtimes": ["iOS", "watchOS", "tvOS"], "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720"},
|
||||
{ "link": "15.4", "version": "15.4.0+15F31d", "install_runtimes": "true", "sha256": "82d3d61804ff3f4c7c82085e91dc701037ddaa770e542848b2477e22f4e8aa7a"},
|
||||
{ "link": "15.3", "version": "15.3.0+15E204a", "install_runtimes": "true", "sha256": "f13f6a2e2df432c3008e394640b8549a18c285acd7fd148d6c4bac8c3a5af234"},
|
||||
{ "link": "15.2", "version": "15.2.0+15C500b", "install_runtimes": "true", "sha256": "04E93680C6DDBEC84666531BE412DE778AFC8EAC6AB2037F4C2BE7290818B59B"},
|
||||
@@ -14,8 +14,8 @@
|
||||
},
|
||||
"arm64":{
|
||||
"versions": [
|
||||
{ "link": "16.2", "version": "16.2+16C5032a", "runtimes": ["iOS", "watchOS", "tvOS"], "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de"},
|
||||
{ "link": "16.1", "version": "16.1+16B40", "runtimes": ["iOS", "watchOS", "tvOS"], "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720"},
|
||||
{ "link": "16.2", "version": "16.2+16C5032a", "install_runtimes": ["iOS", "watchOS", "tvOS"], "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de"},
|
||||
{ "link": "16.1", "version": "16.1+16B40", "install_runtimes": ["iOS", "watchOS", "tvOS"], "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720"},
|
||||
{ "link": "15.4", "version": "15.4.0+15F31d", "install_runtimes": "true", "sha256": "82d3d61804ff3f4c7c82085e91dc701037ddaa770e542848b2477e22f4e8aa7a"},
|
||||
{ "link": "15.3", "version": "15.3.0+15E204a", "install_runtimes": "true", "sha256": "f13f6a2e2df432c3008e394640b8549a18c285acd7fd148d6c4bac8c3a5af234"},
|
||||
{ "link": "15.2", "version": "15.2.0+15C500b", "install_runtimes": "true", "sha256": "04E93680C6DDBEC84666531BE412DE778AFC8EAC6AB2037F4C2BE7290818B59B"},
|
||||
|
||||
Reference in New Issue
Block a user