[macos] fix XCode simulator install behaviour (#7878)

* [macos] fix XCode simulator install behaviour

in 3929bc9f6e
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
This commit is contained in:
ilia-shipitsin
2023-07-07 16:24:33 +02:00
committed by GitHub
parent b84c1bed0d
commit 2ccef4f100
3 changed files with 12 additions and 15 deletions

View File

@@ -163,11 +163,6 @@ function Install-AdditionalSimulatorRuntimes {
[string]$Version [string]$Version
) )
if ($Version.Split(".")[0] -lt 14) {
# Additional simulator runtimes are included by default for Xcode < 14
return
}
Write-Host "Installing Simulator Runtimes for Xcode $Version ..." Write-Host "Installing Simulator Runtimes for Xcode $Version ..."
$xcodebuildPath = Get-XcodeToolPath -Version $Version -ToolName "xcodebuild" $xcodebuildPath = Get-XcodeToolPath -Version $Version -ToolName "xcodebuild"
Invoke-ValidateCommand "$xcodebuildPath -downloadAllPlatforms | xcpretty" Invoke-ValidateCommand "$xcodebuildPath -downloadAllPlatforms | xcpretty"

View File

@@ -8,12 +8,6 @@ echo "Installing Homebrew..."
HOMEBREW_INSTALL_URL="https://raw.githubusercontent.com/Homebrew/install/master/install.sh" HOMEBREW_INSTALL_URL="https://raw.githubusercontent.com/Homebrew/install/master/install.sh"
/bin/bash -c "$(curl -fsSL ${HOMEBREW_INSTALL_URL})" /bin/bash -c "$(curl -fsSL ${HOMEBREW_INSTALL_URL})"
git clone https://github.com/Homebrew/homebrew-cask $(brew --repository)/Library/Taps/homebrew/homebrew-cask --origin=origin --template= --config core.fsmonitor=false --depth 1
git clone https://github.com/Homebrew/homebrew-core $(brew --repository)/Library/Taps/homebrew/homebrew-core --origin=origin --template= --config core.fsmonitor=false --depth 1
brew tap homebrew/cask
brew tap homebrew/core
if [[ $arch == "arm64" ]]; then if [[ $arch == "arm64" ]]; then
/opt/homebrew/bin/brew update /opt/homebrew/bin/brew update
/opt/homebrew/bin/brew upgrade /opt/homebrew/bin/brew upgrade
@@ -22,6 +16,12 @@ if [[ $arch == "arm64" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)" eval "$(/opt/homebrew/bin/brew shellenv)"
fi fi
git clone https://github.com/Homebrew/homebrew-cask $(brew --repository)/Library/Taps/homebrew/homebrew-cask --origin=origin --template= --config core.fsmonitor=false --depth 1
git clone https://github.com/Homebrew/homebrew-core $(brew --repository)/Library/Taps/homebrew/homebrew-core --origin=origin --template= --config core.fsmonitor=false --depth 1
brew tap homebrew/cask
brew tap homebrew/core
echo "Disabling Homebrew analytics..." echo "Disabling Homebrew analytics..."
brew analytics off brew analytics off

View File

@@ -30,11 +30,13 @@ Write-Host "Configuring Xcode versions..."
$xcodeVersions | ForEach-Object { $xcodeVersions | ForEach-Object {
Write-Host "Configuring Xcode $($_.link) ..." Write-Host "Configuring Xcode $($_.link) ..."
Invoke-XcodeRunFirstLaunch -Version $_.link Invoke-XcodeRunFirstLaunch -Version $_.link
if ($_.link.Split(".")[0] -ge 14) {
# Additional simulator runtimes are included by default for Xcode < 14
Install-AdditionalSimulatorRuntimes -Version $_.link
} }
$latestVersion = $xcodeVersions | Sort-Object -Property link -Descending | Select-Object -First 1 -ExpandProperty link }
Write-Host "Installing simulators for version $latestVersion..."
Install-AdditionalSimulatorRuntimes -Version $latestVersion
Invoke-XcodeRunFirstLaunch -Version $defaultXcode Invoke-XcodeRunFirstLaunch -Version $defaultXcode