#! /bin/bash [ -d out ] && rm -fr out ARGS="desktop:run" ALIAS=jeyzu KEYSTORE="/home/jeyzu/etc/sync/jeyzu-key.keystore" APK="./android/build/apk/android-release-unsigned.apk" ZIPALIGN="/opt/android-sdk/build-tools/23.0.3/zipalign" APK_OUT="./RustAndDust-signed-aligned.apk" DB_FILES="./android/assets/data/*.sqlite" function gradlew_do() { echo "./gradlew $ARGS" && ./gradlew $ARGS || exit 1 } case "$1" in "c") shift; ARGS="clean assets:build $ARGS" gradlew_do ;; "a") shift; ARGS="android:installDebug android:run $@" echo "Build Tool : $(pacman -Qi android-sdk-build-tools | sed -n 's/Version\s\+:\s\+r\(.*\)/\1/p')" echo "SDK : $(pacman -Qi android-sdk-platform-tools | sed -n 's/Version\s\+:\s\+\(.*\)/\1/p')" cat android/build.gradle | grep buildToolsVersion cat android/build.gradle | grep compileSdkVersion gradlew_do echo "on failure: sudo adb kill-server; (sudo adb start-server;) sudo adb devices" echo " adb logcat RustAndDust:D *:S" ;; "r") shift; ARGS="android:assembleRelease$@" gradlew_do ;; "q") shift; ARGS="$ARGS $@" rm $DB_FILES 2>/dev/null gradlew_do ;; "s") shift; ARGS="android:assembleRelease$@" gradlew_do jarsigner -verbose -tsa http://timestamp.digicert.com -sigalg SHA1withRSA -digestalg SHA1 -keystore $KEYSTORE $APK $ALIAS jarsigner -verify $APK [ -f $APK_OUT ] && rm $APK_OUT $ZIPALIGN -v 4 $APK $APK_OUT ;; "t") shift; ARGS="core:test $@" gradlew_do ;; "j") shift; ARGS="core:javadocs ctags $@" gradlew_do ;; "d") shift; ARGS="desktop:dist $@" gradlew_do ;; "f") # java -cp gdx.jar:gdx-natives.jar:gdx-backend-lwjgl.jar:gdx-backend-lwjgl-natives.jar:extensions/gdx-tools/gdx-tools.jar:hiero.jar com.badlogic.gdx.tools.hiero.Hiero java -cp ./data/misc/hiero.jar com.badlogic.gdx.tools.hiero.Hiero $@ exit ;; *) ARGS="$ARGS $@" gradlew_do ;; esac