From 1ef9c1906d31827f8614cf4c826053e3bcffb534 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 5 Jun 2019 14:32:03 +1000 Subject: [PATCH 1/4] [Android] Fixup failing unzip with overwrite prompt in keyboards build --- oem/firstvoices/android/build_keyboards.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oem/firstvoices/android/build_keyboards.sh b/oem/firstvoices/android/build_keyboards.sh index 6cbef5e646..1aad77d6d0 100755 --- a/oem/firstvoices/android/build_keyboards.sh +++ b/oem/firstvoices/android/build_keyboards.sh @@ -92,7 +92,7 @@ if [ $DO_BUILD = true ] || [ $DO_COPY = true ]; then if [ $DO_COPY = true ]; then echo "Copying $id ($name) to $KEYBOARDS_TARGET" mkdir -p "$SCRIPT_ROOT/$KEYBOARDS_TARGET/$id" - unzip release/$shortname/$id/build/$id.kmp $id.js kmp.json -d "$SCRIPT_ROOT/$KEYBOARDS_TARGET/$id/" + unzip -o release/$shortname/$id/build/$id.kmp $id.js kmp.json -d "$SCRIPT_ROOT/$KEYBOARDS_TARGET/$id/" # cp release/$shortname/$id/build/$id.keyboard_info "$SCRIPT_ROOT/$KEYBOARDS_TARGET/$id.keyboard_info" fi # die "done" From 11479f65c27fc284648cf0125df59c6a2234a867 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 12 Jun 2019 11:27:04 +1000 Subject: [PATCH 2/4] Update gitignore --- oem/firstvoices/android/.gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/oem/firstvoices/android/.gitignore b/oem/firstvoices/android/.gitignore index 1e31631dcb..0722107965 100644 --- a/oem/firstvoices/android/.gitignore +++ b/oem/firstvoices/android/.gitignore @@ -21,3 +21,9 @@ # Files generated as part of the build app/src/main/assets/packages app/src/main/assets/keyboards.csv + +# Legacy Eclipse IDE files +.classpath +.project +.cproject +.settings/ From ec858c3596a21460e8ece08ad4f2ff8da6bab984 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 12 Jun 2019 13:52:17 +1000 Subject: [PATCH 3/4] Rearrange build scripts for OEM to share keyboards build script --- oem/firstvoices/android/build.sh | 62 ++++++++++++++++++- oem/firstvoices/android/build_common.sh | 16 ++++- .../{android => common}/build_keyboards.sh | 5 +- 3 files changed, 77 insertions(+), 6 deletions(-) rename oem/firstvoices/{android => common}/build_keyboards.sh (98%) mode change 100755 => 100644 diff --git a/oem/firstvoices/android/build.sh b/oem/firstvoices/android/build.sh index 81fc379026..4c41ceff53 100755 --- a/oem/firstvoices/android/build.sh +++ b/oem/firstvoices/android/build.sh @@ -1,14 +1,72 @@ #!/bin/bash +# Set sensible script defaults: +# set -e: Terminate script if a command returns an error set -e +# set -u: Terminate script if an unset variable is used +set -u +# set -x: Debugging use, print each statement # set -x +display_usage ( ) { + echo "build.sh [-no-daemon] [-debug] [-no-update] [-lib-build|-no-lib-build] [-copy-keyboards] [-clean-keyboards] [-h|-?]" + echo "Build $TARGET" + echo " -no-daemon Don't start the Gradle daemon. Use for CI" + echo " -debug Compile only Debug variant" + echo " -no-update Don't copy or build the Keyman Engine library in (assumes already present)" + echo " -lib-build Force rebuild of the Keyman Engine library" + echo " -no-lib-build Only rebuild the Keyman Engine library if it doesn't exist in /android" + echo " -copy-keyboards: Only copy the keyboards; don't rebuild them" + echo " -clean-keyboards: Clean the keyboards from this repo" + exit 1 +} + export TARGET=FirstVoices export KEYBOARDS_TARGET=app/src/main/assets/packages export KEYBOARDS_CSV_TARGET=app/src/main/assets/keyboards.csv +export KEYBOARDS_ROOT=../../../../keyboards + +PARAM_COPY_KEYBOARDS= +PARAM_CLEAN_KEYBOARDS= +PARAM_DEBUG= +PARAM_NO_DAEMON= +PARAM_NO_UPDATE= +PARAM_LIB_BUILD= +PARAM_NO_LIB_BUILD= + +while [[ $# -gt 0 ]] ; do + key="$1" + case $key in + -copy-keyboards) + PARAM_COPY_KEYBOARDS=-copy-keyboards + ;; + -h|-?) + display_usage + ;; + -clean-keyboards) + PARAMS_CLEAN_KEYBOARDS=-clean-keyboards + ;; + -debug) + PARAM_DEBUG=-debug + ;; + -no-daemon) + PARAM_NO_DAEMON=-no-daemon + ;; + -no-update) + PARAM_NO_UDPATE=-no-update + ;; + -lib-build) + PARAM_LIB_BUILD=-lib-build + ;; + -no-lib-build|-lib-nobuild) + PARAM_NO_LIB_BUILD=-no-lib-build + ;; + esac + shift +done # TODO: support passing -copy-keyboards, -debug, -clean etc in to build_keyboards -./build_keyboards.sh +../common/build_keyboards.sh $PARAM_COPY_KEYBOARDS $PARAM_CLEAN_KEYBOARDS $PARAM_DEBUG # TODO: in the future build_common.sh should probably be shared with all oem products? -./build_common.sh "$@" +./build_common.sh $PARAM_DEBUG $PARAM_NO_DAEMON $PARAM_NO_UPDATE $PARAM_LIB_BUILD $PARAM_NO_LIB_BUILD diff --git a/oem/firstvoices/android/build_common.sh b/oem/firstvoices/android/build_common.sh index e3b67549e5..530966f2c5 100755 --- a/oem/firstvoices/android/build_common.sh +++ b/oem/firstvoices/android/build_common.sh @@ -1,15 +1,25 @@ #!/bin/bash +# Set sensible script defaults: +# set -e: Terminate script if a command returns an error +set -e +# set -u: Terminate script if an unset variable is used +set -u +# set -x: Debugging use, print each statement +# set -x + if [ -z "$TARGET" ]; then exit 1 fi display_usage ( ) { - echo "build.sh [-no-daemon] [-debug]" - echo + echo "build_common.sh [-no-daemon] [-debug] [-no-update] [-lib-build|-no-lib-build]" echo "Build $TARGET" echo " -no-daemon Don't start the Gradle daemon. Use for CI" echo " -debug Compile only Debug variant" + echo " -no-update Don't copy or build the Keyman Engine library in (assumes already present)" + echo " -lib-build Force rebuild of the Keyman Engine library" + echo " -no-lib-build Only rebuild the Keyman Engine library if it doesn't exist in /android" exit 1 } @@ -49,7 +59,7 @@ while [[ $# -gt 0 ]] ; do -lib-build) FORCE_KMEA_BUILD=true ;; - -lib-nobuild) + -lib-nobuild|-no-lib-build) ALLOW_KMEA_BUILD=false ;; -h|-?) diff --git a/oem/firstvoices/android/build_keyboards.sh b/oem/firstvoices/common/build_keyboards.sh old mode 100755 new mode 100644 similarity index 98% rename from oem/firstvoices/android/build_keyboards.sh rename to oem/firstvoices/common/build_keyboards.sh index 1aad77d6d0..47afba865b --- a/oem/firstvoices/android/build_keyboards.sh +++ b/oem/firstvoices/common/build_keyboards.sh @@ -15,7 +15,8 @@ set -u # This build script assumes that the https://github.com/keymanapp/keyboards repo is in # the same parent folder as this repo, with the default name 'keyboards' -KEYBOARDS_ROOT=../../../../keyboards + + function die { echo "FATAL: $1" @@ -101,3 +102,5 @@ if [ $DO_BUILD = true ] || [ $DO_COPY = true ]; then popd fi + +echo "Keyboards built successfully." \ No newline at end of file From fa8f834cf6d7934d40d28129dde523bcb69a11ec Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 12 Jun 2019 13:54:16 +1000 Subject: [PATCH 4/4] Remove old todo comment --- oem/firstvoices/android/build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/oem/firstvoices/android/build.sh b/oem/firstvoices/android/build.sh index 4c41ceff53..180967ce19 100755 --- a/oem/firstvoices/android/build.sh +++ b/oem/firstvoices/android/build.sh @@ -65,7 +65,6 @@ while [[ $# -gt 0 ]] ; do shift done -# TODO: support passing -copy-keyboards, -debug, -clean etc in to build_keyboards ../common/build_keyboards.sh $PARAM_COPY_KEYBOARDS $PARAM_CLEAN_KEYBOARDS $PARAM_DEBUG # TODO: in the future build_common.sh should probably be shared with all oem products?