From 0f237f9e0ba1b2afca68d90fb1db47751fc82e5b Mon Sep 17 00:00:00 2001 From: Erik Bershel Date: Sun, 9 Mar 2025 15:38:32 +0100 Subject: [PATCH 1/2] [macOS] Update Xcode runtimes installer helper and toolset format --- images/macos/scripts/build/Install-Xcode.ps1 | 2 +- .../scripts/helpers/Xcode.Installer.psm1 | 88 +++++++++++--- images/macos/toolsets/Readme.md | 13 ++- images/macos/toolsets/toolset-13.json | 24 ++-- images/macos/toolsets/toolset-14.json | 109 +++++++++++++++--- images/macos/toolsets/toolset-15.json | 67 +++++++++-- 6 files changed, 247 insertions(+), 56 deletions(-) diff --git a/images/macos/scripts/build/Install-Xcode.ps1 b/images/macos/scripts/build/Install-Xcode.ps1 index 1ac2347886..d8f3ac7b97 100644 --- a/images/macos/scripts/build/Install-Xcode.ps1 +++ b/images/macos/scripts/build/Install-Xcode.ps1 @@ -33,7 +33,7 @@ Write-Host "Configuring Xcode versions..." $xcodeVersions | ForEach-Object { Write-Host "Configuring Xcode $($_.link) ..." Invoke-XcodeRunFirstLaunch -Version $_.link - Install-AdditionalSimulatorRuntimes -Version $_.link -Runtimes $_.install_runtimes + Install-AdditionalSimulatorRuntimes -Version $_.link -Arch $arch -Runtimes $_.install_runtimes } Invoke-XcodeRunFirstLaunch -Version $defaultXcode diff --git a/images/macos/scripts/helpers/Xcode.Installer.psm1 b/images/macos/scripts/helpers/Xcode.Installer.psm1 index fd1b00bffc..1efbae133b 100644 --- a/images/macos/scripts/helpers/Xcode.Installer.psm1 +++ b/images/macos/scripts/helpers/Xcode.Installer.psm1 @@ -175,33 +175,83 @@ function Install-AdditionalSimulatorRuntimes { [Parameter(Mandatory)] [string] $Version, [Parameter(Mandatory)] - [array] $Runtimes + [string] $Arch, + [Parameter(Mandatory)] + [object] $Runtimes ) Write-Host "Installing Simulator Runtimes for Xcode $Version ..." $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 + $validRuntimes = @("iOS", "watchOS", "tvOS") + + # visionOS is only available on arm64 + if ($Arch -eq "arm64") { + $validRuntimes += "visionOS" + } + + # Install all runtimes + if ($Runtimes -eq "all") { + Write-Host "Installing all runtimes for Xcode $Version ..." + Invoke-ValidateCommand "sudo $xcodebuildPath -downloadAllPlatforms" | Out-Null + return + } elseif ($Runtimes -eq "false") { + Write-Host "Skipping runtimes installation for Xcode $Version ..." + return + } + + # Convert $Runtimes to hashtable + if ($Runtimes -is [System.Object[]]) { + $convertedRuntimes = @{} + + foreach ($entry in $Runtimes) { + if ($entry -is [PSCustomObject]) { + $entry = $entry | ConvertTo-Json -Compress | ConvertFrom-Json -AsHashtable + } + + # Copy all keys and values from the entry to the converted runtimes + foreach ($key in $entry.Keys) { + if ($convertedRuntimes.ContainsKey($key)) { + $convertedRuntimes[$key] += $entry[$key] + } else { + $convertedRuntimes[$key] = $entry[$key] + } + } } + $Runtimes = $convertedRuntimes } - # Validate and install specified runtimes - $invalidRuntimes = $Runtimes | Where-Object { $_ -notmatch "^($( $validRuntimes -join '|' ))(\s.*|$)" } - if ($invalidRuntimes) { - throw "Error: Invalid runtimes detected: $($invalidRuntimes -join ', '). Valid values are: $validRuntimes." + # Validate runtimes format + if ($Runtimes -isnot [System.Collections.Hashtable]) { + throw "Invalid runtime format for Xcode $(Version): Expected hashtable, got [$($Runtimes.GetType())]" } - - foreach ($runtime in $Runtimes) { - Write-Host "Installing runtime $runtime ..." - Invoke-ValidateCommand "sudo $xcodebuildPath -downloadPlatform $runtime" | Out-Null + + # Install runtimes for specified platforms + foreach ($platform in $validRuntimes) { + if (-not $Runtimes.ContainsKey($platform)) { + Write-Host "No runtimes specified for $platform in the toolset for Xcode $Version, please check the toolset." + return + } + foreach ($platformVersion in $Runtimes[$platform]) { + switch ($platformVersion) { + "skip" { + Write-Host "Skipping $platform runtimes installation for Xcode $Version ..." + continue + } + "default" { + Write-Host "Installing default $platform runtime for Xcode $Version ..." + Invoke-ValidateCommand "sudo $xcodebuildPath -downloadPlatform $platform" | Out-Null + continue + } + default { + if ($platformVersion -match "^\d{1,2}\.\d(\.\d)?$") { + Write-Host "Installing $platform $platformVersion runtime for Xcode $Version ..." + Invoke-ValidateCommand "sudo $xcodebuildPath -downloadPlatform $platform -buildVersion $platformVersion" | Out-Null + continue + } + throw "$platformVersion is not a valid value for $platform version. Valid values are 'latest' or 'skip' or a semver from 0.0 to 99.9.(9)." + } + } + } } } diff --git a/images/macos/toolsets/Readme.md b/images/macos/toolsets/Readme.md index 3714d91783..f7a1cd7280 100644 --- a/images/macos/toolsets/Readme.md +++ b/images/macos/toolsets/Readme.md @@ -6,8 +6,17 @@ - `link` property points to the place where Xcode will be located on image. `/Applications/Xcode_.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 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 + - `install_runtimes` – controls the installation of simulator runtimes: + - `"all"` – installs all default runtimes. + - `false` – skips runtime installation. + - **Hashtable** – allows manual selection: + - Mandatory keys: `[ "iOS", "watchOS", "tvOS" ]`, plus `visionOS` for arm64 images. + - Values [string]: + - `"default"` – installs the default runtime. + - `"skip"` – skips installation. + - Specific version numbers, e.g., `"18.2"`, `"2.2"`, `"18.3.1"`. + - `default` - version of Xcode to set as default (should be metched with any `link` in `versions` property) **Example:** `"11.2"` @@ -25,7 +34,7 @@ ```json "versions": [ { "link": "16_beta_4", "version": "16.0.0-Beta.4+16A5211f", "symlinks": ["16.0"], "install_runtimes": "false", "sha256": "4270cd8021b2f7f512ce91bfc4423b25bccab36cdab21834709d798c8daade72"}, - { "link": "15.4", "version": "15.4.0+15F31d", "install_runtimes": "true", "sha256": "82d3d61804ff3f4c7c82085e91dc701037ddaa770e542848b2477e22f4e8aa7a"} + { "link": "15.4", "version": "15.4.0+15F31d", "install_runtimes": "all", "sha256": "82d3d61804ff3f4c7c82085e91dc701037ddaa770e542848b2477e22f4e8aa7a"} ] ``` diff --git a/images/macos/toolsets/toolset-13.json b/images/macos/toolsets/toolset-13.json index 2143e18976..03613c7f94 100644 --- a/images/macos/toolsets/toolset-13.json +++ b/images/macos/toolsets/toolset-13.json @@ -3,22 +3,22 @@ "default": "15.2", "x64": { "versions": [ - { "link": "15.2", "version": "15.2.0+15C500b", "install_runtimes": "true", "sha256": "04E93680C6DDBEC84666531BE412DE778AFC8EAC6AB2037F4C2BE7290818B59B"}, - { "link": "15.1", "version": "15.1.0+15C65", "install_runtimes": "true", "sha256": "857D8DB537BAC82BF99DE0E1D3895D214D4D02101C1340CEF3DAF6E821BA1D05"}, - { "link": "15.0.1", "version": "15.0.1+15A507", "symlinks": ["15.0"], "install_runtimes": "true", "sha256": "5AC17AE6060CAFC3C7112C6DA0B153450BE21F1DE6632777FBA9FBC9D999C9E8"}, - { "link": "14.3.1", "version": "14.3.1+14E300c","symlinks": ["14.3"], "install_runtimes": "true", "sha256": "B5CC7BF37447C32A971B37D71C7DA1AF7ABB45CEE4B96FE126A1D3B0D2C260AF"}, - { "link": "14.2", "version": "14.2.0+14C18", "install_runtimes": "true", "sha256": "686B9D53CA49E50D563BC0104B1E8B4F7CCFE80064A6D689965FB819BF8EFE72"}, - { "link": "14.1", "version": "14.1.0+14B47b", "install_runtimes": "true", "sha256": "12F8A3AEF78BF354470AD8B351ADDD925C8EDAD888137D138CA50A8130EB9F2F"} + { "link": "15.2", "version": "15.2.0+15C500b", "install_runtimes": "all", "sha256": "04E93680C6DDBEC84666531BE412DE778AFC8EAC6AB2037F4C2BE7290818B59B"}, + { "link": "15.1", "version": "15.1.0+15C65", "install_runtimes": "all", "sha256": "857D8DB537BAC82BF99DE0E1D3895D214D4D02101C1340CEF3DAF6E821BA1D05"}, + { "link": "15.0.1", "version": "15.0.1+15A507", "symlinks": ["15.0"], "install_runtimes": "all", "sha256": "5AC17AE6060CAFC3C7112C6DA0B153450BE21F1DE6632777FBA9FBC9D999C9E8"}, + { "link": "14.3.1", "version": "14.3.1+14E300c","symlinks": ["14.3"], "install_runtimes": "all", "sha256": "B5CC7BF37447C32A971B37D71C7DA1AF7ABB45CEE4B96FE126A1D3B0D2C260AF"}, + { "link": "14.2", "version": "14.2.0+14C18", "install_runtimes": "all", "sha256": "686B9D53CA49E50D563BC0104B1E8B4F7CCFE80064A6D689965FB819BF8EFE72"}, + { "link": "14.1", "version": "14.1.0+14B47b", "install_runtimes": "all", "sha256": "12F8A3AEF78BF354470AD8B351ADDD925C8EDAD888137D138CA50A8130EB9F2F"} ] }, "arm64":{ "versions": [ - { "link": "15.2", "version": "15.2.0+15C500b", "install_runtimes": "true", "sha256": "04E93680C6DDBEC84666531BE412DE778AFC8EAC6AB2037F4C2BE7290818B59B"}, - { "link": "15.1", "version": "15.1.0+15C65", "install_runtimes": "true", "sha256": "857D8DB537BAC82BF99DE0E1D3895D214D4D02101C1340CEF3DAF6E821BA1D05"}, - { "link": "15.0.1", "version": "15.0.1+15A507", "symlinks": ["15.0"], "install_runtimes": "true", "sha256": "5AC17AE6060CAFC3C7112C6DA0B153450BE21F1DE6632777FBA9FBC9D999C9E8"}, - { "link": "14.3.1", "version": "14.3.1+14E300c","symlinks": ["14.3"], "install_runtimes": "true", "sha256": "B5CC7BF37447C32A971B37D71C7DA1AF7ABB45CEE4B96FE126A1D3B0D2C260AF"}, - { "link": "14.2", "version": "14.2.0+14C18", "install_runtimes": "true", "sha256": "686B9D53CA49E50D563BC0104B1E8B4F7CCFE80064A6D689965FB819BF8EFE72"}, - { "link": "14.1", "version": "14.1.0+14B47b", "install_runtimes": "true", "sha256": "12F8A3AEF78BF354470AD8B351ADDD925C8EDAD888137D138CA50A8130EB9F2F"} + { "link": "15.2", "version": "15.2.0+15C500b", "install_runtimes": "all", "sha256": "04E93680C6DDBEC84666531BE412DE778AFC8EAC6AB2037F4C2BE7290818B59B"}, + { "link": "15.1", "version": "15.1.0+15C65", "install_runtimes": "all", "sha256": "857D8DB537BAC82BF99DE0E1D3895D214D4D02101C1340CEF3DAF6E821BA1D05"}, + { "link": "15.0.1", "version": "15.0.1+15A507", "symlinks": ["15.0"], "install_runtimes": "all", "sha256": "5AC17AE6060CAFC3C7112C6DA0B153450BE21F1DE6632777FBA9FBC9D999C9E8"}, + { "link": "14.3.1", "version": "14.3.1+14E300c","symlinks": ["14.3"], "install_runtimes": "all", "sha256": "B5CC7BF37447C32A971B37D71C7DA1AF7ABB45CEE4B96FE126A1D3B0D2C260AF"}, + { "link": "14.2", "version": "14.2.0+14C18", "install_runtimes": "all", "sha256": "686B9D53CA49E50D563BC0104B1E8B4F7CCFE80064A6D689965FB819BF8EFE72"}, + { "link": "14.1", "version": "14.1.0+14B47b", "install_runtimes": "all", "sha256": "12F8A3AEF78BF354470AD8B351ADDD925C8EDAD888137D138CA50A8130EB9F2F"} ] } }, diff --git a/images/macos/toolsets/toolset-14.json b/images/macos/toolsets/toolset-14.json index 4772d25b4f..d13bdc3adf 100644 --- a/images/macos/toolsets/toolset-14.json +++ b/images/macos/toolsets/toolset-14.json @@ -3,24 +3,105 @@ "default": "15.4", "x64": { "versions": [ - { "link": "16.2", "version": "16.2+16C5032a", "install_runtimes": ["iOS -buildVersion 18.2", "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"}, - { "link": "15.1", "version": "15.1.0+15C65", "install_runtimes": "true", "sha256": "857D8DB537BAC82BF99DE0E1D3895D214D4D02101C1340CEF3DAF6E821BA1D05"}, - { "link": "15.0.1", "version": "15.0.1+15A507", "symlinks": ["15.0"], "install_runtimes": "true", "sha256": "5AC17AE6060CAFC3C7112C6DA0B153450BE21F1DE6632777FBA9FBC9D999C9E8"} + { + "link": "16.2", + "version": "16.2+16C5032a", + "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de", + "install_runtimes": [ + { "iOS": "18.2" }, + { "watchOS": "default" }, + { "tvOS": "default" } + ] + }, + { + "link": "16.1", + "version": "16.1+16B40", + "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720", + "install_runtimes": "all" + }, + { + "link": "15.4", + "version": "15.4.0+15F31d", + "sha256": "82d3d61804ff3f4c7c82085e91dc701037ddaa770e542848b2477e22f4e8aa7a", + "install_runtimes": "all" + }, + { + "link": "15.3", + "version": "15.3.0+15E204a", + "sha256": "f13f6a2e2df432c3008e394640b8549a18c285acd7fd148d6c4bac8c3a5af234", + "install_runtimes": "all" + }, + { + "link": "15.2", + "version": "15.2.0+15C500b", + "sha256": "04E93680C6DDBEC84666531BE412DE778AFC8EAC6AB2037F4C2BE7290818B59B", + "install_runtimes": "all" + }, + { + "link": "15.1", + "version": "15.1.0+15C65", + "sha256": "857D8DB537BAC82BF99DE0E1D3895D214D4D02101C1340CEF3DAF6E821BA1D05", + "install_runtimes": "all" + }, + { + "link": "15.0.1", + "version": "15.0.1+15A507", + "sha256": "5AC17AE6060CAFC3C7112C6DA0B153450BE21F1DE6632777FBA9FBC9D999C9E8", + "symlinks": ["15.0"], + "install_runtimes": "all" + } ] }, "arm64":{ "versions": [ - { "link": "16.2", "version": "16.2+16C5032a", "install_runtimes": ["iOS -buildVersion 18.2", "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"}, - { "link": "15.1", "version": "15.1.0+15C65", "install_runtimes": "true", "sha256": "857D8DB537BAC82BF99DE0E1D3895D214D4D02101C1340CEF3DAF6E821BA1D05"}, - { "link": "15.0.1", "version": "15.0.1+15A507", "symlinks": ["15.0"], "install_runtimes": "true", "sha256": "5AC17AE6060CAFC3C7112C6DA0B153450BE21F1DE6632777FBA9FBC9D999C9E8"} + { + "link": "16.2", + "version": "16.2+16C5032a", + "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de", + "install_runtimes": [ + { "iOS": "18.2" }, + { "watchOS": "default" }, + { "tvOS": "default" }, + { "visionOS": "2.2" } + ] + }, + { + "link": "16.1", + "version": "16.1+16B40", + "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720", + "install_runtimes": "all" + }, + { + "link": "15.4", + "version": "15.4.0+15F31d", + "sha256": "82d3d61804ff3f4c7c82085e91dc701037ddaa770e542848b2477e22f4e8aa7a", + "install_runtimes": "all" + }, + { + "link": "15.3", + "version": "15.3.0+15E204a", + "sha256": "f13f6a2e2df432c3008e394640b8549a18c285acd7fd148d6c4bac8c3a5af234", + "install_runtimes": "all" + }, + { + "link": "15.2", + "version": "15.2.0+15C500b", + "sha256": "04E93680C6DDBEC84666531BE412DE778AFC8EAC6AB2037F4C2BE7290818B59B", + "install_runtimes": "all" + }, + { + "link": "15.1", + "version": "15.1.0+15C65", + "sha256": "857D8DB537BAC82BF99DE0E1D3895D214D4D02101C1340CEF3DAF6E821BA1D05", + "install_runtimes": "all" + }, + { + "link": "15.0.1", + "version": "15.0.1+15A507", + "sha256": "5AC17AE6060CAFC3C7112C6DA0B153450BE21F1DE6632777FBA9FBC9D999C9E8", + "symlinks": ["15.0"], + "install_runtimes": "all" + } ] } }, diff --git a/images/macos/toolsets/toolset-15.json b/images/macos/toolsets/toolset-15.json index db8f855973..8ff4316bdb 100644 --- a/images/macos/toolsets/toolset-15.json +++ b/images/macos/toolsets/toolset-15.json @@ -3,18 +3,69 @@ "default": "16", "x64": { "versions": [ - { "link": "16.2", "version": "16.2+16C5032a", "install_runtimes": ["iOS -buildVersion 18.2", "watchOS", "tvOS" ], "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de"}, - { "link": "16.1", "version": "16.1+16B40", "install_runtimes": "true", "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720"}, - { "link": "16", "version": "16.0.0+16A242d", "symlinks": ["16.0"], "install_runtimes": "true", "sha256": "4a26c3d102a55c7222fb145e0ee1503249c9c26c6e02dc64d783c8810b37b1e3"}, - { "link": "15.4", "version": "15.4.0+15F31d", "install_runtimes": "true", "sha256": "82d3d61804ff3f4c7c82085e91dc701037ddaa770e542848b2477e22f4e8aa7a"} + { + "link": "16.2", + "version": "16.2+16C5032a", + "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de", + "install_runtimes": [ + { "iOS": "18.2" }, + { "watchOS": "default" }, + { "tvOS": "default" } + ] + }, + { + "link": "16.1", + "version": "16.1+16B40", + "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720", + "install_runtimes": "all" + }, + { + "link": "16", + "version": "16.0.0+16A242d", + "sha256": "4a26c3d102a55c7222fb145e0ee1503249c9c26c6e02dc64d783c8810b37b1e3", + "symlinks": ["16.0"], + "install_runtimes": "all" + }, + { + "link": "15.4", + "version": "15.4.0+15F31d", + "sha256": "82d3d61804ff3f4c7c82085e91dc701037ddaa770e542848b2477e22f4e8aa7a", + "install_runtimes": "all" + } ] }, "arm64":{ "versions": [ - { "link": "16.2", "version": "16.2+16C5032a", "install_runtimes": ["iOS -buildVersion 18.2", "watchOS", "tvOS", "visionOS -buildVersion 2.2"], "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de"}, - { "link": "16.1", "version": "16.1+16B40", "install_runtimes": "true", "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720"}, - { "link": "16", "version": "16.0.0+16A242d", "symlinks": ["16.0"], "install_runtimes": "true", "sha256": "4a26c3d102a55c7222fb145e0ee1503249c9c26c6e02dc64d783c8810b37b1e3"}, - { "link": "15.4", "version": "15.4.0+15F31d", "install_runtimes": "true", "sha256": "82d3d61804ff3f4c7c82085e91dc701037ddaa770e542848b2477e22f4e8aa7a"} + { + "link": "16.2", + "version": "16.2+16C5032a", + "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de", + "install_runtimes": [ + { "iOS": "18.2" }, + { "watchOS": "default" }, + { "tvOS": "default" }, + { "visionOS": "2.2" } + ] + }, + { + "link": "16.1", + "version": "16.1+16B40", + "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720", + "install_runtimes": "all" + }, + { + "link": "16", + "version": "16.0.0+16A242d", + "sha256": "4a26c3d102a55c7222fb145e0ee1503249c9c26c6e02dc64d783c8810b37b1e3", + "symlinks": ["16.0"], + "install_runtimes": "all" + }, + { + "link": "15.4", + "version": "15.4.0+15F31d", + "sha256": "82d3d61804ff3f4c7c82085e91dc701037ddaa770e542848b2477e22f4e8aa7a", + "install_runtimes": "all" + } ] } }, From 49593cf93f6088003d8dc924eb6146f8a00dc417 Mon Sep 17 00:00:00 2001 From: Erik Bershel Date: Mon, 10 Mar 2025 18:26:30 +0100 Subject: [PATCH 2/2] Add Apple release numbers option --- .../scripts/helpers/Xcode.Installer.psm1 | 3 ++- images/macos/toolsets/Readme.md | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/images/macos/scripts/helpers/Xcode.Installer.psm1 b/images/macos/scripts/helpers/Xcode.Installer.psm1 index 1efbae133b..b55ea7e54a 100644 --- a/images/macos/scripts/helpers/Xcode.Installer.psm1 +++ b/images/macos/scripts/helpers/Xcode.Installer.psm1 @@ -243,7 +243,8 @@ function Install-AdditionalSimulatorRuntimes { continue } default { - if ($platformVersion -match "^\d{1,2}\.\d(\.\d)?$") { + # Version might be a semver or a build number + if (($platformVersion -match "^\d{1,2}\.\d(\.\d)?$") -or ($platformVersion -match "^[a-zA-Z0-9]{6,8}$")) { Write-Host "Installing $platform $platformVersion runtime for Xcode $Version ..." Invoke-ValidateCommand "sudo $xcodebuildPath -downloadPlatform $platform -buildVersion $platformVersion" | Out-Null continue diff --git a/images/macos/toolsets/Readme.md b/images/macos/toolsets/Readme.md index f7a1cd7280..eeb6fdd321 100644 --- a/images/macos/toolsets/Readme.md +++ b/images/macos/toolsets/Readme.md @@ -16,6 +16,7 @@ - `"default"` – installs the default runtime. - `"skip"` – skips installation. - Specific version numbers, e.g., `"18.2"`, `"2.2"`, `"18.3.1"`. + - Apple release version, e.g., `"22E5216h"`, `"17A577"`. - `default` - version of Xcode to set as default (should be metched with any `link` in `versions` property) **Example:** `"11.2"` @@ -31,6 +32,8 @@ **Example:** +String format: + ```json "versions": [ { "link": "16_beta_4", "version": "16.0.0-Beta.4+16A5211f", "symlinks": ["16.0"], "install_runtimes": "false", "sha256": "4270cd8021b2f7f512ce91bfc4423b25bccab36cdab21834709d798c8daade72"}, @@ -38,6 +41,30 @@ ] ``` +Block format: + +```json +"versions": [ + { + "link": "16.2", + "version": "16.2+16C5032a", + "sha256": "0e367d06eb7c334ea143bada5e4422f56688aabff571bedf0d2ad9434b7290de", + "install_runtimes": [ + { "iOS": "18.2" }, + { "watchOS": "default" }, + { "tvOS": "default" }, + { "visionOS": "2.2" } + ] + }, + { + "link": "16.1", + "version": "16.1+16B40", + "sha256": "8ca961d55981f983d21b99a95a6b0ac04905b837f6e11346ee86d28f12afe720", + "install_runtimes": "all" + } +] +``` + ## Android - `platform-list` - the array of android platforms to install.