Skip to content

Commit 2ccef4f

Browse files
[macos] fix XCode simulator install behaviour (#7878)
* [macos] fix XCode simulator install behaviour in 3929bc9 was introduced regression: simulators were installed only for latest XCode-14 instance. However, they should be installed for all XCode-14 instances. let us revert that behaviour * improve code readability by moving version comparison outside loop * rework brew installation for ARM64
1 parent b84c1be commit 2ccef4f

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

images/macos/helpers/Xcode.Installer.psm1

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,6 @@ function Install-AdditionalSimulatorRuntimes {
163163
[string]$Version
164164
)
165165

166-
if ($Version.Split(".")[0] -lt 14) {
167-
# Additional simulator runtimes are included by default for Xcode < 14
168-
return
169-
}
170-
171166
Write-Host "Installing Simulator Runtimes for Xcode $Version ..."
172167
$xcodebuildPath = Get-XcodeToolPath -Version $Version -ToolName "xcodebuild"
173168
Invoke-ValidateCommand "$xcodebuildPath -downloadAllPlatforms | xcpretty"

images/macos/provision/core/homebrew.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ echo "Installing Homebrew..."
88
HOMEBREW_INSTALL_URL="https://raw.githubusercontent.com/Homebrew/install/master/install.sh"
99
/bin/bash -c "$(curl -fsSL ${HOMEBREW_INSTALL_URL})"
1010

11-
git clone https://github.com/Homebrew/homebrew-cask $(brew --repository)/Library/Taps/homebrew/homebrew-cask --origin=origin --template= --config core.fsmonitor=false --depth 1
12-
git clone https://github.com/Homebrew/homebrew-core $(brew --repository)/Library/Taps/homebrew/homebrew-core --origin=origin --template= --config core.fsmonitor=false --depth 1
13-
14-
brew tap homebrew/cask
15-
brew tap homebrew/core
16-
1711
if [[ $arch == "arm64" ]]; then
1812
/opt/homebrew/bin/brew update
1913
/opt/homebrew/bin/brew upgrade
@@ -22,6 +16,12 @@ if [[ $arch == "arm64" ]]; then
2216
eval "$(/opt/homebrew/bin/brew shellenv)"
2317
fi
2418

19+
git clone https://github.com/Homebrew/homebrew-cask $(brew --repository)/Library/Taps/homebrew/homebrew-cask --origin=origin --template= --config core.fsmonitor=false --depth 1
20+
git clone https://github.com/Homebrew/homebrew-core $(brew --repository)/Library/Taps/homebrew/homebrew-core --origin=origin --template= --config core.fsmonitor=false --depth 1
21+
22+
brew tap homebrew/cask
23+
brew tap homebrew/core
24+
2525
echo "Disabling Homebrew analytics..."
2626
brew analytics off
2727

images/macos/provision/core/xcode.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ Write-Host "Configuring Xcode versions..."
3030
$xcodeVersions | ForEach-Object {
3131
Write-Host "Configuring Xcode $($_.link) ..."
3232
Invoke-XcodeRunFirstLaunch -Version $_.link
33-
}
3433

35-
$latestVersion = $xcodeVersions | Sort-Object -Property link -Descending | Select-Object -First 1 -ExpandProperty link
36-
Write-Host "Installing simulators for version $latestVersion..."
37-
Install-AdditionalSimulatorRuntimes -Version $latestVersion
34+
if ($_.link.Split(".")[0] -ge 14) {
35+
# Additional simulator runtimes are included by default for Xcode < 14
36+
Install-AdditionalSimulatorRuntimes -Version $_.link
37+
}
38+
39+
}
3840

3941
Invoke-XcodeRunFirstLaunch -Version $defaultXcode
4042

0 commit comments

Comments
 (0)