Created
December 20, 2019 02:55
-
-
Save Shinolr/94c1093142356ad0c3f8a963b9027845 to your computer and use it in GitHub Desktop.
Use this script when project has multi environments by Configurations.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name of the resource to copy | |
INFO_PLIST_FILE=GoogleService-Info.plist | |
# Get references to debug and release versions of the plist file | |
DEV_INFO_PLIST_FILE=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Development/${INFO_PLIST_FILE} | |
PROD_INFO_PLIST_FILE=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Production/${INFO_PLIST_FILE} | |
# Make sure the debug version exists | |
echo "Looking for ${INFO_PLIST_FILE} in ${DEV_INFO_PLIST_FILE}" | |
if [ ! -f $DEV_INFO_PLIST_FILE ] ; then | |
echo "File GoogleService-Info.plist (debug) not found." | |
exit 1 | |
fi | |
# Make sure the release version exists | |
echo "Looking for ${INFO_PLIST_FILE} in ${PROD_INFO_PLIST_FILE}" | |
if [ ! -f $PROD_INFO_PLIST_FILE ] ; then | |
echo "File GoogleService-Info.plist (release) not found." | |
exit 1 | |
fi | |
# Get a reference to the destination location for the plist file | |
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/${INFO_PLIST_FILE} | |
echo "Copying ${INFO_PLIST_FILE} to final destination: ${PLIST_DESTINATION}" | |
# Copy the appropiate file to app bundle | |
if [ "${CONFIGURATION}" == "Debug (Development)" -o "${CONFIGURATION}" == "Release (Development)" ] ; then | |
echo "File ${DEV_INFO_PLIST_FILE} copied" | |
cp "${DEV_INFO_PLIST_FILE}" "${PLIST_DESTINATION}" | |
else | |
echo "File ${PROD_INFO_PLIST_FILE} copied" | |
cp "${PROD_INFO_PLIST_FILE}" "${PLIST_DESTINATION}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment