fix(ios): download fv keyboards

Instead of building and copying from keyboards repo, just
download the final fv keyboards from download server. This
avoids a bunch of dependencies on macOS build agents.
This commit is contained in:
Marc Durdin 2020-04-29 10:37:32 +10:00
parent b344b1a56f
commit caa96dd9cb
2 changed files with 33 additions and 2 deletions

View file

@ -3,7 +3,7 @@
set -e
# TODO: support passing -copy-keyboards, -debug, -clean etc in to build_keyboards
./build_keyboards.sh
./build_keyboards.sh -download-keyboards
TARGET=FirstVoices
# TODO: in the future build_common.sh should probably be shared with all oem products?

View file

@ -26,9 +26,10 @@ function die {
}
function display_usage {
echo "Usage: build_keyboards.sh [-copy-keyboards] [-clean-keyboards] [-debug] [-h|-?]"
echo "Usage: build_keyboards.sh [-download-keyboards] [-copy-keyboards] [-clean-keyboards] [-debug] [-h|-?]"
echo "Builds all keyboards used by the app and copies them into the"
echo "target path."
echo " -download-keyboards: Download keyboards from downloads.keyman.com"
echo " -copy-keyboards: Only copy the keyboards; don't rebuild them"
echo " -clean-keyboards: Clean the keyboards from this repo"
echo " -debug: Build debug versions of the keyboards"
@ -38,10 +39,16 @@ function display_usage {
DO_CLEAN=true
DO_COPY=true
DO_BUILD=true
DO_DOWNLOAD=false
while [[ $# -gt 0 ]] ; do
key="$1"
case $key in
-download-keyboards)
DO_DOWNLOAD=true
DO_COPY=false
DO_BUILD=false
;;
-copy-keyboards)
DO_BUILD=false
;;
@ -102,3 +109,27 @@ if [ $DO_BUILD = true ] || [ $DO_COPY = true ]; then
popd
fi
if [ $DO_DOWNLOAD = true ]; then
echo "Downloading keyboards from downloads.keyman.com"
cp ../keyboards.csv "$TARGET/keyboards.csv"
SCRIPT_ROOT=`pwd`
URL_DOWNLOAD=https://downloads.keyman.com
URL_API_VERSION=${URL_DOWNLOAD}/api/keyboard/
{
# Skip header line
read
# Read CSV and build each referenced keyboard
while IFS=, read -r shortname id name region old_keyboard; do
echo "Downloading $id ($name)"
# Get latest version
URL_DOWNLOAD_FILE=`curl -s "$URL_API_VERSION/$id" | jq -r .js`
curl -s "$URL_DOWNLOAD_FILE" > "$SCRIPT_ROOT/$TARGET/files/$id.js"
curl -s "${URL_DOWNLOAD_FILE%.*}.keyboard_info" > "$SCRIPT_ROOT/$TARGET/files/$id.keyboard_info"
done
} < "$SCRIPT_ROOT/../keyboards.csv"
fi