Skip to content

Commit

Permalink
nice prints of run app script
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon committed Feb 15, 2024
1 parent 2363a4c commit 1dde78d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions scripts/ios/run-example-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ TARGET_IPHONE_NAME="iPhone 15 Pro Max"
echo "✨📱 Start of '$me' (see: '$DIR/$me')"
cd "$DIR"
cd "../../" # go to parent of parent, which is project root.
echo "✨ pwd: $PWD"

export SED_START="iOS $TARGET_IOS_VERSION"
export SED_END="tvOS"

export IOS_SIM_UDID=$(xcrun simctl list devices | sed -n "/$SED_START/,/$SED_END/p" | grep "$TARGET_IPHONE_NAME (" | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})");\

IPHONE_SIM_DEST="platform=iOS Simulator,id=$IOS_SIM_UDID"
echo "✨📱 IPHONE_SIM_DEST '$IPHONE_SIM_DEST'"
# echo "✨📱 IPHONE_SIM_DEST '$IPHONE_SIM_DEST'"
XCODEBUILD_CMD_BASE="xcodebuild build -project $APP_XCODEPROJP_PATH -scheme $APP_SCHEME_NAME"
BUILD_CMD="$XCODEBUILD_CMD_BASE -destination \"$IPHONE_SIM_DEST\" -configuration Debug -quiet CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO"
echo "✨📱🛠️ Building app: '$APP_SCHEME_NAME'..."
eval $BUILD_CMD
PRINT_API_DIR_CMD="$XCODEBUILD_CMD_BASE -showBuildSettings"
BUILD_ROOT=$($PRINT_API_DIR_CMD | grep -m 1 'BUILD_ROOT' | grep -oEi "\/.*")

APP_PATH="$BUILD_ROOT/Debug-iphonesimulator/$APP_SCHEME_NAME.app"

echo "APP_PATH: $APP_PATH"
echo "✨📱🛠️ Built app '$APP_SCHEME_NAME', folder: '$APP_PATH' ✅"

# Open the simulator
open -a 'Simulator' --args -CurrentDeviceUDID $IOS_SIM_UDID
Expand All @@ -51,8 +51,9 @@ do
sleep 1
done

echo "Installing app at path $APP_PATH"
echo "✨📱📦 Installing app '$APP_SCHEME_NAME'..."
xcrun simctl install booted $APP_PATH
echo "✨📱📦 Installed app '$APP_SCHEME_NAME' ✅"

if [[ $DEBUGGER_ENABLED == "1" ]]; then
LAUNCH_DEBUGGER_ENABLED_FLAG=--wait-for-debugger
Expand All @@ -63,12 +64,13 @@ else
fi

LOG_FILE=/tmp/run_ios_sim.log
echo "Starting Sim for $APP_PATH" > $LOG_FILE
echo "✨📱🚀 Launching app '$APP_SCHEME_NAME'..."

# Launch the app program into the booted sim
# - Pipe the output to a log file
# - Run in the background
`xcrun simctl launch $LAUNCH_DEBUGGER_ENABLED_FLAG $USE_CONSOLE_FLAG booted $BUNDLE_IDENTIFIER 2>&1 >> $LOG_FILE` &

echo "✨📱🚀 Launched app '$APP_SCHEME_NAME' ✅"

echo "✨📱 End of '$me' (see: '$DIR/$me')"
echo "✨📱 End of '$me'"

0 comments on commit 1dde78d

Please sign in to comment.