22set -euo pipefail
33IFS=$' \n\t '
44
5+ # Ensure this script has no BOM even if it ever gets committed with one again
6+ # (the BOM only breaks the shebang at exec time, but this is a safety net).
7+ sed -i ' ' $' 1s/^\xEF\xBB\xBF //' " $0 "
8+
59
610if [ " $UITEST_TEST_MODE_NAME " == ' Automated' ];
711then
@@ -58,19 +62,35 @@ cp "$UITEST_IOSDEVICE_DATA_PATH/../device.plist" $UNO_UITEST_SCREENSHOT_PATH/_lo
5862
5963echo " Starting simulator: [$UITEST_IOSDEVICE_ID ] ($UNO_UITEST_SIMULATOR_VERSION / $UNO_UITEST_SIMULATOR_NAME )"
6064
61- # check for the presence of idb, and install it if it's not present
65+ # Check for the presence of idb, and install it if it's not present
66+ # NOTE: fb-idb currently breaks under Python 3.14 (asyncio get_event_loop change),
67+ # so we pin fb-idb to Python 3.12 to avoid "There is no current event loop in thread 'MainThread'".
68+ # Historical context: prior installs referenced an App Center issue/workaround.
69+ # https://github.com/microsoft/appcenter/issues/2605#issuecomment-1854414963
6270export PATH=$PATH :~ /.local/bin
6371
64- if ! command -v idb & > /dev/null
65- then
66- echo " Installing idb"
67- brew install pipx
68- # # https://github.com/microsoft/appcenter/issues/2605#issuecomment-1854414963
69- brew tap facebook/fb
70- brew install idb-companion
71- pipx install fb-idb
72+ if ! command -v idb > /dev/null 2>&1 ; then
73+ echo " Installing idb (fb-idb + idb-companion) pinned to Python 3.12"
74+
75+ # 1) Make sure we have a usable python3.12, but don't fail if Homebrew linking conflicts
76+ if ! command -v python3.12 > /dev/null 2>&1 ; then
77+ # Install, but ignore link-step failure; we'll use the keg path explicitly
78+ brew list --versions
[email protected] > /dev/null
2>&1 || brew install
[email protected] || true 79+ fi
80+ # Prefer an existing python3.12 on PATH; otherwise use the keg path
81+ PY312_BIN=
" $( command -v python3.12 || echo " $( brew --prefix) /opt/[email protected] /bin/python3.12" ) " 82+ export PIPX_DEFAULT_PYTHON=" $PY312_BIN "
83+ echo " Using Python for pipx: $PIPX_DEFAULT_PYTHON "
84+
85+ # 2) Install helpers
86+ brew list --versions pipx > /dev/null 2>&1 || brew install pipx
87+ brew tap facebook/fb > /dev/null 2>&1 || true
88+ brew list --versions idb-companion > /dev/null 2>&1 || brew install idb-companion
89+
90+ # 3) Install fb-idb under Python 3.12
91+ pipx install --force fb-idb
7292else
73- echo " Using idb from:" ` command -v idb`
93+ echo " Using idb from: $( command -v idb) "
7494fi
7595
7696xcrun simctl boot " $UITEST_IOSDEVICE_ID " || true
@@ -108,4 +128,4 @@ export TMP_LOG_FILEPATH=/tmp/DeviceLog-`date +"%Y%m%d%H%M%S"`.logarchive
108128export LOG_FILEPATH_FULL=$LOG_FILEPATH /DeviceLog-` date +" %Y%m%d%H%M%S" ` .txt
109129
110130xcrun simctl spawn booted log collect --output $TMP_LOG_FILEPATH
111- log show --style syslog $TMP_LOG_FILEPATH > $LOG_FILEPATH_FULL
131+ log show --style syslog $TMP_LOG_FILEPATH > $LOG_FILEPATH_FULL
0 commit comments