Merge branch 'android-ios-firstvoices-keyboards-script' into windows-firstvoices

This commit is contained in:
Marc Durdin 2019-06-12 13:55:52 +10:00
commit 4bd0d73312
4 changed files with 84 additions and 8 deletions

View file

@ -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/

View file

@ -1,14 +1,71 @@
#!/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
# TODO: support passing -copy-keyboards, -debug, -clean etc in to build_keyboards
./build_keyboards.sh
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
../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

View file

@ -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|-?)

View file

@ -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"
@ -92,7 +93,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"
@ -101,3 +102,5 @@ if [ $DO_BUILD = true ] || [ $DO_COPY = true ]; then
popd
fi
echo "Keyboards built successfully."