Files
runner-images/images/macos/scripts/build/configure-xcode.sh
Alexey-Ayupov ed3d2204db [macOS] refactor utils.sh and related scripts (#8998)
* Update Software Report to support azcopy output

* Update util.sh and related scripts

* Remove rosetta test from the script

* Update mono script

* clean up

* remove condition from install pipx script

* Update scripts according to comments

---------

Co-authored-by: Alexey Ayupov <“alexey.ayupov@akvelon.com”>
2023-12-21 14:48:28 +01:00

36 lines
1.4 KiB
Bash

#!/bin/bash -e -o pipefail
################################################################################
## File: configure-xcode.sh
## Desc: Configure Xcode after installation
################################################################################
source ~/utils/utils.sh
XCODE_LIST=($(get_toolset_value '.xcode.versions | reverse | .[].link'))
DEFAULT_XCODE_VERSION=$(get_toolset_value '.xcode.default')
# https://github.com/microsoft/appcenter/issues/847
# Assets.xcassets : error : CoreData: error: (6922) I/O error for database
# at $HOME/Library/Developer/Xcode/UserData/IB Support/Simulator Devices/{GUID}
echo "Erase a device's contents and settings:"
for XCODE_VERSION in "${XCODE_LIST[@]}"
do
echo " Xcode Version: ${XCODE_VERSION}"
launchctl remove com.apple.CoreSimulator.CoreSimulatorService || true
#add sleep to let CoreSimulatorService to exit
sleep 3
# Select xcode version by default
sudo xcode-select -s "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer"
# Erase a device's contents and settings
xcrun simctl erase all
#add sleep due to sometimes "xcrun simctl list" takes more than a few moments and script fails when trying to remove CoreSimulatorSerivce
sleep 10
done
# Select xcode version by default
echo "Setting Xcode ${DEFAULT_XCODE_VERSION} as default"
sudo xcode-select -s "/Applications/Xcode_${DEFAULT_XCODE_VERSION}.app/Contents/Developer"