Skip to content

Instantly share code, notes, and snippets.

@haikieu
Last active March 1, 2023 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haikieu/ddb7b9839a95f763fdc9869e2e1cd433 to your computer and use it in GitHub Desktop.
Save haikieu/ddb7b9839a95f763fdc9869e2e1cd433 to your computer and use it in GitHub Desktop.
This script is help to attach the watch app into host app for Debug configuration only
#/bin/sh
#The script is used to embed Watch App into the mobile app.
#Prepare some directory paths
WATCH_APP_NAME="WatchApp.app" # <--- put your watch app name here
WATCH_APP_DIR="${TARGET_BUILD_DIR}/${WATCH_APP_NAME}"
APP_BUILD_DIR="${CODESIGNING_FOLDER_PATH}"
DESTINATION_DIR="${APP_BUILD_DIR}/Watch"
#By checking this condition, the script is valid for Debug configuration only
if [ $CONFIGURATION == "Debug" ]
then
#Check if the directories are valid
if [ -d "${WATCH_APP_DIR}" ] && [ -d "${APP_BUILD_DIR}" ]
then
#Create a dir if it does not exist
mkdir -p "${DESTINATION_DIR}"
#Attach file to host app
cp -a "${WATCH_APP_DIR}" "${DESTINATION_DIR}"
echo "hk >>> Attach ${WATCH_APP_NAME} successfully"
else
echo "hk >>> Cannot attach the content to host app, because not find ${WATCH_APP_DIR} or ${APP_BUILD_DIR}"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment