Skip to content

Instantly share code, notes, and snippets.

@kwylez
Created July 8, 2016 00:28
Show Gist options
  • Save kwylez/2e98a8936a388ef7a2b46e434d82eb85 to your computer and use it in GitHub Desktop.
Save kwylez/2e98a8936a388ef7a2b46e434d82eb85 to your computer and use it in GitHub Desktop.
#!/bin/sh
PATH_TO_CONFIGURATIONS="$SRCROOT/../Configurations"
FIRServiceAccountDevelopment="$PATH_TO_CONFIGURATIONS/FIRServiceAccounts-Dev.json"
FIRServiceAccountRelease="$PATH_TO_CONFIGURATIONS/FIRServiceAccounts-Prod.json"
FIRConfigDevelopment="$PATH_TO_CONFIGURATIONS/GoogleService-Info-Dev.plist"
FIRConfigRelease="$PATH_TO_CONFIGURATIONS/GoogleService-Info-Prod.plist"
FIRConfig="GoogleService-Info.plist"
FIRServiceAccountConfig="ServiceAccount.json"
FIRAppID="1:my:app:id"
FIRSymbolUploadPlist="com.google.SymbolUpload.plist"
### DEVELOPMENT BUILDS
if [ "$CONFIGURATION" == "Debug" ]; then
echo "Processing $FIRConfig for $CONFIGURATION"
if [ -f "$FIRConfigDevelopment" ]; then
cp "$FIRConfigDevelopment" "$PATH_TO_CONFIGURATIONS/$FIRConfig"
if [ -f "$PATH_TO_CONFIGURATIONS/$FIRConfig" ]; then
echo "Processing $FIRConfig for $CONFIGURATION into $TARGET_BUILD_DIR/$EXECUTABLE_FOLDER_PATH/"
echo "Found $FIRConfig, and copying to $TARGET_BUILD_DIR/$EXECUTABLE_FOLDER_PATH"
cp "$PATH_TO_CONFIGURATIONS/$FIRConfig" "$TARGET_BUILD_DIR/$EXECUTABLE_FOLDER_PATH/"
else
echo "Did not find $FIRConfigDevelopment for $CONFIGURATION"
exit 1
fi # end copying file to bundle CONFIGURATION DEBUG
echo "Processing $FIRServiceAccountConfig for $CONFIGURATION"
FIRAppID="1:117234178988:ios:afc82af83bed4893"
if [ -f "$FIRServiceAccountDevelopment" ]; then
cp "$FIRServiceAccountDevelopment" "$PATH_TO_CONFIGURATIONS/$FIRServiceAccountConfig"
else
echo "Did not find $FIRServiceAccountDevelopment for $CONFIGURATION"
exit 1
fi # end copying service account CONFIGURATION DEBUG
fi
fi # end CONFIGURATION DEBUG
### PRODUCTION BUILDS
if [ "$CONFIGURATION" == "Release" ]; then
echo "Processing $FIRConfig for $CONFIGURATION"
if [ -f "$FIRConfigRelease" ]; then
cp "$FIRConfigRelease" "$PATH_TO_CONFIGURATIONS/$FIRConfig"
if [ -f "$PATH_TO_CONFIGURATIONS/$FIRConfig" ]; then
echo "Processing $FIRConfig for $CONFIGURATION into $TARGET_BUILD_DIR/$EXECUTABLE_FOLDER_PATH/"
echo "Found $FIRConfig, and copying to $TARGET_BUILD_DIR/$EXECUTABLE_FOLDER_PATH"
cp "$PATH_TO_CONFIGURATIONS/$FIRConfig" "$TARGET_BUILD_DIR/$EXECUTABLE_FOLDER_PATH/"
else
echo "Did not find $FIRConfigRelease for $CONFIGURATION"
exit 1
fi # end copying file to bundle CONFIGURATION RELEASE
echo "Processing $FIRServiceAccountConfig for $CONFIGURATION"
FIRAppID="1:110719055044:ios:afc82af83bed4893"
if [ -f "$FIRServiceAccountRelease" ]; then
cp "$FIRServiceAccountRelease" "$PATH_TO_CONFIGURATIONS/$FIRServiceAccountConfig"
else
echo "Did not find $FIRServiceAccountRelease for $CONFIGURATION"
exit 1
fi # end copying service account CONFIGURATION RELEASE
fi
fi # end CONFIGURATION RELEASE
# You have to do this since we are switching between dev and release builds
if [ -f "$FIRSymbolUploadPlist" ]; then
rm $HOME/Library/Preferences/com.google.SymbolUpload*
fi
# Replace this path with the path to the key you just downloaded
JSON_FILE="$PATH_TO_CONFIGURATIONS/$FIRServiceAccountConfig"
defaults write com.google.SymbolUpload version -integer 1 # creates file if it does not exist
JSON=$(cat "${JSON_FILE}")
/usr/bin/plutil -replace "app_${FIRAppID//:/_}" -json "${JSON}" "$HOME/Library/Preferences/com.google.SymbolUpload.plist"
"$SRCROOT/../FirebaseCrash/upload-sym"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment