Skip to content

Instantly share code, notes, and snippets.

@muukii
Created May 13, 2018 20:58
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 muukii/cc655b0cf0d7986421725a5493c7f3d8 to your computer and use it in GitHub Desktop.
Save muukii/cc655b0cf0d7986421725a5493c7f3d8 to your computer and use it in GitHub Desktop.
# !/bin/sh
set -e
target_dir="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
mkdir -p $target_dir
last_commit_log=`git --git-dir ${SRCROOT}/.git log HEAD --oneline -n 1`
current_branch=`git --git-dir ${SRCROOT}/.git rev-parse --abbrev-ref HEAD 2> /dev/null`
last_commit_hash=`git --git-dir ${SRCROOT}/.git rev-parse HEAD`
json_file="build_info.json"
json_path="${target_dir}/${json_file}"
echo "Generate to ${json_path}"
touch $json_path
cat << EOM > ${json_path}
{
"current_branch" : "$current_branch",
"last_commit_hash" : "$last_commit_hash",
"last_commit_log" : "$last_commit_log",
"build_configuration" : "$CONFIGURATION",
"built_at" : "`date '+%Y/%m/%d %r'`"
}
EOM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment