From 86061d0523e08b7478ef01a028bd9609ddb53983 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Mon, 19 May 2025 14:37:47 +0700 Subject: [PATCH] maint(android): Add archive step to prep release artifacts --- android/.gitignore | 3 +++ android/build.sh | 46 +++++++++++++++++++++++++++++++++++++++++++++- android/exclude.in | 1 + 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 android/exclude.in diff --git a/android/.gitignore b/android/.gitignore index a5720bccc7..e822a25c2b 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -57,6 +57,9 @@ KMAPro/**/assets/*.kmp # Play Store release notes (copied from whatsnew.md) KMAPro/kMAPro/src/main/play/release-notes/**/*.txt +# Release artifacts +upload/ + # Eclipse files .project .settings/ diff --git a/android/build.sh b/android/build.sh index 27ba447b4c..e98d38d98d 100755 --- a/android/build.sh +++ b/android/build.sh @@ -15,6 +15,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" . "$KEYMAN_ROOT/resources/shellHelperFunctions.sh" . "$KEYMAN_ROOT/resources/build/build-utils-ci.inc.sh" +. "$KEYMAN_ROOT/resources/build/zip.inc.sh" ################################ Main script ################################ @@ -37,6 +38,7 @@ builder_describe \ build \ test \ "publish Publishes symbols to Sentry and the APKs to the Play Store." \ + "archive Copy release artifacts to upload/ and rsync to downloads.keyman" \ "--ci+ Deprecated build option. Remove in 20.0" \ --upload-sentry+ \ ":engine=KMEA Keyman Engine for Android" \ @@ -70,4 +72,46 @@ function do_test_help() { builder_run_action test:help do_test_help -builder_run_child_actions publish \ No newline at end of file +builder_run_child_actions publish + +# Copy release artifacts to upload/ and rsync to downloads.keyman.com +if builder_start_action archive; then + UPLOAD_PATH="$KEYMAN_ROOT/android/upload/${KEYMAN_VERSION}" + KEYMAN_ENGINE_ANDROID_ZIP="keyman-engine-android-${KEYMAN_VERSION}.zip" + KEYMAN_APK="keyman-${KEYMAN_VERSION}.apk" + FIRSTVOICES_APK="firstvoices-${KEYMAN_VERSION}.apk" + + mkdir -p "${UPLOAD_PATH}" + + # Create Keyman Engine for Android archive + # zip/7z flags to: (disable progress), output log level 0 + cp "${KEYMAN_ROOT}/android/KMAPro/kMAPro/libs/keyman-engine.aar" ./ + if [ "$BUILDER_OS" == "win" ]; then + # win uses 7zip flags + ZIP_FILE="${UPLOAD_PATH}/${KEYMAN_ENGINE_ANDROID_ZIP}" + zip_files "${ZIP_FILE[@]}" "-bd" "-bb0" "-x@exclude.in" "keyman-engine.aar" "Samples/" # need a? + else + ZIP_FILE="${UPLOAD_PATH}/${KEYMAN_ENGINE_ANDROID_ZIP}" + zip_files "${ZIP_FILE}" "-r" "-q" "-x@exclude.in" "keyman-engine.aar" "Samples/" + fi + + # Copy release APKs + cp "${KEYMAN_ROOT}/android/KMAPro/kMAPro/build/outputs/apk/release/${KEYMAN_APK}" \ + "${UPLOAD_PATH}/${KEYMAN_APK}" + cp "${KEYMAN_ROOT}/oem/firstvoices/android/app/build/outputs/apk/release/${FIRSTVOICES_APK}" \ + "${UPLOAD_PATH}/${FIRSTVOICES_APK}" + + # + # Write download info files + # + + cd "${UPLOAD_PATH}" + write_download_info "Keyman Engine for Android" "${KEYMAN_ENGINE_ANDROID_ZIP}" "${KEYMAN_VERSION}" "${KEYMAN_TIER}" "android" + write_download_info "Keyman for Android" "${KEYMAN_APK}" "${KEYMAN_VERSION}" "${KEYMAN_TIER}" "android" + + if [ "${RELEASE_OEM_FIRSTVOICES-false}" = true ]; then + write_download_info "FirstVoices Keyboards" "${FIRSTVOICES_APK}" "${KEYMAN_VERSION}" "${KEYMAN_TIER}" "android" + fi + + builder_finish_action success archive +fi \ No newline at end of file diff --git a/android/exclude.in b/android/exclude.in new file mode 100644 index 0000000000..1c2b62205d --- /dev/null +++ b/android/exclude.in @@ -0,0 +1 @@ +Samples/*/build.sh