@@ -42,46 +42,6 @@ function Invoke-DownloadXcodeArchive {
4242 return $tempXipDirectory
4343}
4444
45- function Resolve-ExactXcodeVersion {
46- param (
47- [Parameter (Mandatory )]
48- [string ] $Version
49- )
50-
51- # if toolset string contains spaces, consider it as a full name of Xcode
52- if ($Version -match " \s" ) {
53- return $Version
54- }
55-
56- $semverVersion = [SemVer ]::Parse($Version )
57- $availableVersions = Get-AvailableXcodeVersions
58- $satisfiedVersions = $availableVersions | Where-Object { $semverVersion -eq $_.stableSemver }
59-
60- return $satisfiedVersions | Select-Object - Last 1 - ExpandProperty rawVersion
61- }
62-
63- function Get-AvailableXcodeVersions {
64- $rawVersionsList = Invoke-XCVersion - Arguments " list" | ForEach-Object { $_.Trim () } | Where-Object { $_ -match " ^\d" }
65- $availableVersions = $rawVersionsList | ForEach-Object {
66- $partStable , $partMajor = $_.Split (" " , 2 )
67- $semver = $stableSemver = [SemVer ]::Parse($partStable )
68-
69- if ($partMajor ) {
70- # Convert 'beta 3' -> 'beta.3', 'Release Candidate' -> 'releasecandidate', 'GM Seed 2' -> 'gmseed.2'
71- $normalizedLabel = $partMajor.toLower () -replace " (\d)" , ' .$1' -replace " ([a-z])" , ' $1'
72- $semver = [SemVer ]::new($stableSemver.Major , $stableSemver.Minor , $stableSemver.Patch , $normalizedLabel )
73- }
74-
75- return [PSCustomObject ]@ {
76- semver = $semver
77- rawVersion = $_
78- stableSemver = $stableSemver
79- }
80- }
81-
82- return $availableVersions | Sort-Object - Property semver
83- }
84-
8545function Expand-XcodeXipArchive {
8646 param (
8747 [Parameter (Mandatory )]
@@ -145,18 +105,16 @@ function Approve-XcodeLicense {
145105 }
146106}
147107
148- function Install-XcodeAdditionalPackages {
108+ function Install-XcodeAdditionalComponents {
149109 param (
150110 [Parameter (Mandatory )]
151111 [string ] $Version
152112 )
153113
154- Write-Host " Installing additional packages for Xcode $Version ..."
114+ Write-Host " Installing additional MetalToolchain component for Xcode $Version ..."
155115 $xcodeRootPath = Get-XcodeRootPath - Version $Version
156- $packages = Get-ChildItem - Path " $xcodeRootPath /Contents/Resources/Packages" - Filter " *.pkg" - File
157- $packages | ForEach-Object {
158- Invoke-ValidateCommand " sudo installer -pkg $ ( $_.FullName ) -target / -allowUntrusted"
159- }
116+ $xcodeBuildPath = Get-XcodeToolPath - XcodeRootPath $xcodeRootPath - ToolName " xcodebuild"
117+ Invoke-ValidateCommand " $xcodeBuildPath -downloadComponent MetalToolchain" | Out-Null
160118}
161119
162120function Invoke-XcodeRunFirstLaunch {
@@ -170,7 +128,7 @@ function Invoke-XcodeRunFirstLaunch {
170128 Invoke-ValidateCommand " sudo $xcodeRootPath -runFirstLaunch"
171129}
172130
173- function Install-AdditionalSimulatorRuntimes {
131+ function Install-XcodeAdditionalSimulatorRuntimes {
174132 param (
175133 [Parameter (Mandatory )]
176134 [string ] $Version ,
0 commit comments