Skip to content

Instantly share code, notes, and snippets.

@thuai
Forked from tadelv/dSYM_to_storage.sh
Last active August 29, 2015 14:04
Show Gist options
  • Save thuai/4f8ed3a9684b9c3d43c3 to your computer and use it in GitHub Desktop.
Save thuai/4f8ed3a9684b9c3d43c3 to your computer and use it in GitHub Desktop.
#!/bin/sh
echo "======================"
echo "Auto backup archive file [start]"
echo "Configuration [$CONFIGURATION]"
if [ "$CONFIGURATION" == "Debug" ]; then
echo "Skipping configuration debug"
echo "======================"
exit 0;
fi
if [ "$EFFECTIVE_PLATFORM_NAME" == "-iphonesimulator" ]; then
echo "Skipping simulator build"
echo "======================"
exit 0;
fi
SRC_PATH=${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}
RELATIVE_DEST_PATH=dSYM/${EXECUTABLE_NAME}.$(date +%Y-%m-%d-%H%M%S).app.dSYM
DEST_PATH=${PROJECT_DIR}/${RELATIVE_DEST_PATH}
echo "moving ${SRC_PATH} to ${DEST_PATH}"
if [ ! -d "${DEST_PATH}" ]; then
mkdir -p "${DEST_PATH}"
fi
uuid=`xcrun dwarfdump --uuid ${SRC_PATH} | awk '{print $2}'`
cp -r "${SRC_PATH}" "${DEST_PATH}"
branch_name="dSYM"
exists=`git show-ref refs/heads/$branch_name`
if [ -f ".git/config" ]; then
if [ ! -n "$exists" ];then
git branch $branch_name
fi
current_branch=`git branch --list | awk '{print $2}'`
git checkout $branch_name
git add "${RELATIVE_DEST_PATH}"
message="Added dSYM file for ${BUILD_STYLE} build\n${uuid}"
git commit -m "$(echo -e "$message")" "${RELATIVE_DEST_PATH}"
git checkout $current_branch
fi
echo "Auto backup archive file [complete]"
echo "======================"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment