Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[system-dependencies] Only download the simulators for platforms we target. #20842

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions system-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ function install_mono () {
rm -f $MONO_PKG
}

function xcodebuild_download_selected_platforms ()
{
log "Executing '$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild -downloadPlatform iOS' $1"
"$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild" -downloadPlatform iOS
log "Executing '$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild -downloadPlatform tvOS' $1"
"$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild" -downloadPlatform tvOS
log "Executing '$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild -downloadPlatform watchOS' $1"
"$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild" -downloadPlatform watchOS
}

function download_xcode_platforms ()
{
if test -n "$IGNORE_SIMULATORS"; then return; fi
Expand All @@ -327,21 +337,25 @@ function download_xcode_platforms ()

log "Xcode has additional platforms that must be downloaded ($MUST_INSTALL_RUNTIMES), so installing those."

log "Executing '$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild -downloadAllPlatforms'"
if ! $SUDO "$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild" -downloadAllPlatforms; then
log "Executing '$SUDO pkill -9 -f CoreSimulator.framework'"
$SUDO pkill -9 -f "CoreSimulator.framework" || true
if ! xcodebuild_download_selected_platforms; then
log "Executing '$XCODE_DEVELOPER_ROOT/usr/bin/simctl runtime list -v"
"$XCODE_DEVELOPER_ROOT/usr/bin/simctl" runtime list -v
# Don't exit here, just hope for the best instead.
set +x
echo "##vso[task.logissue type=warning;sourcepath=system-dependencies.sh]Failed to download all simulator platforms, this may result in problems executing tests in the simulator."
set -x
else
log "Executing '$XCODE_DEVELOPER_ROOT/usr/bin/simctl runtime list -v"
"$XCODE_DEVELOPER_ROOT/usr/bin/simctl" runtime list -v
log "Executing '$XCODE_DEVELOPER_ROOT/usr/bin/simctl list -v"
"$XCODE_DEVELOPER_ROOT/usr/bin/simctl" list -v
fi
$SUDO "$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild" -downloadAllPlatforms
$SUDO "$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild" -downloadAllPlatforms
$SUDO "$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild" -downloadAllPlatforms

xcodebuild_download_selected_platforms "(second time)" || true
xcodebuild_download_selected_platforms "(third time)" || true
xcodebuild_download_selected_platforms "(fourth time)" || true

log "Executing '$SUDO $XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild -runFirstLaunch'"
$SUDO "$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild" -runFirstLaunch
Expand All @@ -359,7 +373,7 @@ function download_xcode_platforms ()
pkill -9 "Xcode" || log "Xcode was not running."
log "Executed 'open xcpref://Xcode.PreferencePane.Platforms'"

log "Executed '$XCODE_DEVELOPER_ROOT/usr/bin/xcodebuild -downloadAllPlatforms'"
log "Finished installing Xcode platforms"
}

function run_xcode_first_launch ()
Expand Down