Skip to content

Commit

Permalink
update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
rafd committed Mar 23, 2015
1 parent 972a6a2 commit 81d334b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Ejecta.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
shellScript = "#!/bin/zsh\n\ncd ${SRCROOT:-$(dirname $0)}\necho \"Build script running at $(pwd)\"\n\n# TODO: Parameterize this somehow for XCode?\nLANG=${1:-'zh'}\nAPP_SRC=${2:-'../src'}\nAPP_DEST=${3:-'./App'}\nAUDIO_FORMAT=${4:-'caf'}\nexport GIT_DIR=\"${APP_SRC}/../.git\"\nexport GIT_WORK_TREE=\"${APP_SRC}/..\"\n\nif [[ -z $LANG ]]; then\necho \"Usage: $0 lang [src] [dest]\" >2\nexit 1\nfi\n\nmkdir -p \"$APP_DEST\"\n\n\n\"${APP_SRC}/../convert_audio.py\" \"${LANG}\" \"${APP_SRC}\" \"${APP_DEST}\" \"${AUDIO_FORMAT}\"\nerr=$?\nif [[ $err != 0 ]]; then\necho 'Error converting audio'\nexit $err\nfi\n\nfor d in $(find \"$APP_SRC\" -type d -not -path \"$APP_SRC\" -not -path \"$APP_SRC/assets*\"); do\nmkdir -p \"$APP_DEST/${d#$APP_SRC/}\"\ndone\n\nfor f in $(find \"$APP_SRC\" -type f -not -name '*.coffee' -not -path \"$APP_SRC/assets/*\" -not -path \"$APP_SRC/audio/*\"); do\ncp \"$f\" \"$APP_DEST/${f#$APP_SRC/}\"\ndone\n\n\n# TP FUNCTION\n\nPACK () {\n SRC_DIR=$1\n DEST_FILE=$2\n QUALITY=$3\n DITHER=$4\n\n echo \"TP ${SRC_DIR} -> ${DEST_FILE}\"\n\n if [[ ! -d \"$(dirname ${DEST_FILE})\" ]]; then\n mkdir -p \"$(dirname ${DEST_FILE})\"\n fi\n\n if [[ ! -d \"${SRC_DIR}\" ]]; then\n echo \"No directory\"\n else\n SHA_FILE=\"${DEST_FILE}.sha\"\n touch ${SHA_FILE}\n # check if git sha1 of directory == the one used to pack previously\n git log -1 --format=format:\"%H\" -- ${SRC_DIR} | diff --brief ${SHA_FILE} - >/dev/null\n comp_value=$?\n if [ $comp_value -eq 1 -o ! -z \"$(git ls-files -om --exclude-standard \"${SRC_DIR}\")\" ]; then\n # store git sha1 of the src directory in the compiled directory\n git log -1 --format=format:\"%H\" -- ${SRC_DIR} > ${SHA_FILE}\n\n for SIZE in 256 512 1024; do\n SCALE=$(echo \"scale=2;${SIZE}/${SRC_SIZE}\" | bc)\n TEXTURE_SIZE=$(echo \"${SIZE}*4\" | bc)\n\n echo \" ${SIZE}\"\n\n TEXTUREPACKER_OUT=$(TexturePacker \"${SRC_DIR}\" \\\n --data \"${DEST_FILE}_${SIZE}.json\" \\\n --sheet \"${DEST_FILE}_${SIZE}.png\" \\\n --scale ${SCALE} --max-size ${TEXTURE_SIZE} \\\n --smart-update --padding 2 --format json --opt \"RGBA${QUALITY}\" \\\n --dither-${DITHER} --disable-rotation --trim-sprite-names --trim-mode Trim --extrude 4 )\n\n err=$?\n if [[ $err != 0 ]]; then\n exit $err\n fi\n\n if [[ $TEXTUREPACKER_OUT == 'Nothing to do - sprite sheet not changed' ]]; then\n echo ' sprite sheet unchanged, no need to texture pack'\n break\n fi\n done\n fi\n fi\n}\n\n\n# TexturePacker\nSRC_SIZE=1024\n\n# PACK picker\nPACK \"${APP_SRC}/assets/app\" \"${APP_DEST}/assets/tx/app\" \"5555\" \"fs-alpha\"\n\nif [[ $(/usr/local/bin/coffee --version) != \"CoffeeScript version 1.4.0\" ]]; then\necho \"Bad version of coffeescript! This is only known to work with 1.4.0\"\nexit 1\nfi\n\n exec /usr/local/bin/coffee -c -o \"$APP_DEST\" \"$APP_SRC\"\n\n if [ !-z \"$SRCROOT\" -a -e \"${SRCROOT}/index.js\" ]; then\n cp \"${SRCROOT}/index.js\" \"$APP_SRC\"\n fi\n";
shellScript = "#!/bin/zsh\n\ncd ${SRCROOT:-$(dirname $0)}\necho \"Build script running at $(pwd)\"\n\n# TODO: Parameterize this somehow for XCode?\nLANG=${1:-'zh'}\nAPP_SRC=${2:-'../src'}\nAPP_DEST=${3:-'./App'}\nAUDIO_FORMAT=${4:-'caf'}\nexport GIT_DIR=\"${APP_SRC}/../.git\"\nexport GIT_WORK_TREE=\"${APP_SRC}/..\"\n\nif [[ -z $LANG ]]; then\necho \"Usage: $0 lang [src] [dest]\" >2\nexit 1\nfi\n\nmkdir -p \"$APP_DEST\"\n\n\n\"${APP_SRC}/../convert_audio.py\" \"${LANG}\" \"${APP_SRC}\" \"${APP_DEST}\" \"${AUDIO_FORMAT}\"\nerr=$?\nif [[ $err != 0 ]]; then\necho 'Error converting audio'\nexit $err\nfi\n\nfor d in $(find \"$APP_SRC\" -type d -not -path \"$APP_SRC\" -not -path \"$APP_SRC/assets*\"); do\nmkdir -p \"$APP_DEST/${d#$APP_SRC/}\"\ndone\n\nfor f in $(find \"$APP_SRC\" -type f -not -name '*.coffee' -not -path \"$APP_SRC/assets/*\" -not -path \"$APP_SRC/audio/*\"); do\ncp \"$f\" \"$APP_DEST/${f#$APP_SRC/}\"\ndone\n\n\n# TP FUNCTION\n\nPACK () {\n SRC_DIR=$1\n DEST_FILE=$2\n QUALITY=$3\n DITHER=$4\n\n echo \"TP ${SRC_DIR} -> ${DEST_FILE}\"\n\n if [[ ! -d \"$(dirname ${DEST_FILE})\" ]]; then\n mkdir -p \"$(dirname ${DEST_FILE})\"\n fi\n\n if [[ ! -d \"${SRC_DIR}\" ]]; then\n echo \"No directory\"\n else\n SHA_FILE=\"${DEST_FILE}.sha\"\n touch ${SHA_FILE}\n # check if git sha1 of directory == the one used to pack previously\n git log -1 --format=format:\"%H\" -- ${SRC_DIR} | diff --brief ${SHA_FILE} - >/dev/null\n comp_value=$?\n if [ $comp_value -eq 1 -o ! -z \"$(git ls-files -om --exclude-standard \"${SRC_DIR}\")\" ]; then\n # store git sha1 of the src directory in the compiled directory\n git log -1 --format=format:\"%H\" -- ${SRC_DIR} > ${SHA_FILE}\n\n for SIZE in 256 512 1024; do\n SCALE=$(echo \"scale=2;${SIZE}/${SRC_SIZE}\" | bc)\n TEXTURE_SIZE=$(echo \"${SIZE}*4\" | bc)\n\n echo \" ${SIZE}\"\n\n TEXTUREPACKER_OUT=$(TexturePacker \"${SRC_DIR}\" \\\n --data \"${DEST_FILE}_${SIZE}.json\" \\\n --sheet \"${DEST_FILE}_${SIZE}.png\" \\\n --scale ${SCALE} --max-size ${TEXTURE_SIZE} \\\n --smart-update --padding 2 --format json --opt \"RGBA${QUALITY}\" \\\n --dither-${DITHER} --disable-rotation --trim-sprite-names --trim-mode Trim --extrude 4 )\n\n err=$?\n if [[ $err != 0 ]]; then\n exit $err\n fi\n\n if [[ $TEXTUREPACKER_OUT == 'Nothing to do - sprite sheet not changed' ]]; then\n echo ' sprite sheet unchanged, no need to texture pack'\n break\n fi\n done\n fi\n fi\n}\n\n\n# TexturePacker\nSRC_SIZE=1024\n\n# PACK picker\nPACK \"${APP_SRC}/assets/app\" \"${APP_DEST}/assets/tx/app\" \"5555\" \"fs-alpha\"\nPACK \"${APP_SRC}/assets/core\" \"${APP_DEST}/assets/tx/core\" \"5555\" \"fs-alpha\"\n\nif [[ $(/usr/local/bin/coffee --version) != \"CoffeeScript version 1.4.0\" ]]; then\necho \"Bad version of coffeescript! This is only known to work with 1.4.0\"\nexit 1\nfi\n\n exec /usr/local/bin/coffee -c -o \"$APP_DEST\" \"$APP_SRC\"\n\n if [ !-z \"$SRCROOT\" -a -e \"${SRCROOT}/index.js\" ]; then\n cp \"${SRCROOT}/index.js\" \"$APP_SRC\"\n fi\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down

0 comments on commit 81d334b

Please sign in to comment.