refactor(android): Move Sentry and Apk to publish task

This commit is contained in:
Darcy Wong 2024-09-11 09:03:34 +07:00
parent e933e4afd9
commit 040c9e44ff
6 changed files with 38 additions and 104 deletions

View file

@ -14,6 +14,8 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "$KEYMAN_ROOT/resources/build/build-help.inc.sh"
. "$KEYMAN_ROOT/resources/build/build-download-resources.sh"
. "$KEYMAN_ROOT/android/KMAPro/build-play-store-notes.inc.sh"
# This script runs from its own folder
cd "$THIS_SCRIPT_PATH"
@ -32,6 +34,7 @@ builder_describe "Builds Keyman for Android app." \
"configure" \
"build" \
"test Runs lint and unit tests." \
"publish Publishes symbols to Sentry and the APK to the Play Store." \
"--ci Don't start the Gradle daemon. For CI" \
"--upload-sentry Upload to sentry"
@ -116,3 +119,13 @@ if builder_start_action test; then
builder_finish_action success test
fi
if builder_start_action publish; then
# Copy Release Notes
generateReleaseNotes
# Publish symbols and Keyman for Android to Play Store
./gradlew $DAEMON_FLAG publishSentry publishReleaseApk
builder_finish_action success publish
fi

View file

@ -105,12 +105,17 @@ android {
}
// how to configure the sentry android gradle plugin
sentry {
// Disables or enables the automatic configuration of Native symbols
uploadNativeSymbols = true
task publishSentry {
doLast {
println 'Publishing Keyman symbols to Sentry'
sentry {
// Disables or enables the automatic configuration of Native symbols
uploadNativeSymbols = true
// Does or doesn't include the source code of native code for Sentry
includeNativeSources = true
// Does or doesn't include the source code of native code for Sentry
includeNativeSources = true
}
}
}
String env_keys_json_file = System.getenv("keys_json_file")

View file

@ -1,87 +0,0 @@
#!/usr/bin/env bash
# CI script to publish specified app APKs to the Play Store.
# The APKs should already have been built from a separate script
# set -x: Debugging use, print each statement
# set -x
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../resources/build/build-utils.sh"
## END STANDARD BUILD SCRIPT INCLUDE
. "$KEYMAN_ROOT/android/KMAPro/build-play-store-notes.inc.sh"
echo Publishing APKs to Play Store
#
# Prevents 'clear' on exit of mingw64 bash shell
#
SHLVL=0
display_usage ( ) {
echo "build-publish.sh [-no-daemon] [-kmapro] [-fv]"
echo
echo "Publish app to the Play Store"
echo " -no-daemon Don't start the Gradle daemon. Use for CI"
echo " -kmapro Keyman for Android"
echo " -fv First Voices"
exit 1
}
NO_DAEMON=false
DO_KMAPRO=false
DO_FV=false
# Parse args
while [[ $# -gt 0 ]] ; do
key="$1"
case $key in
-no-daemon)
NO_DAEMON=true
;;
-kmapro)
DO_KMAPRO=true
;;
-fv)
DO_FV=true
;;
-h|-\?)
display_usage
;;
esac
shift # past argument
done
# Override JAVA_HOME to OpenJDK 11
set_java_home
echo
echo "NO_DAEMON: $NO_DAEMON"
echo "DO_KMAPRO: $DO_KMAPRO"
echo "DO_FV: $DO_FV"
echo
if [ "$NO_DAEMON" = true ]; then
DAEMON_FLAG=--no-daemon
else
DAEMON_FLAG=
fi
BUILD_FLAGS="publishReleaseApk"
echo "BUILD_FLAGS $BUILD_FLAGS"
# Publish Keyman for Android
if [ "$DO_KMAPRO" = true ]; then
# Copy Release Notes
generateReleaseNotes
cd "$KEYMAN_ROOT/android/KMAPro/"
./gradlew $DAEMON_FLAG $BUILD_FLAGS
fi
# Publish FV app
if [ "$DO_FV" = true ]; then
cd "$KEYMAN_ROOT/oem/firstvoices/android/"
./gradlew $DAEMON_FLAG $BUILD_FLAGS
fi

View file

@ -25,7 +25,7 @@ builder_describe \
configure \
build \
test \
"publish Publishes the APKs to the Play Store." \
"publish Publishes symbols to Sentry and the APKs to the Play Store." \
--ci+ \
--upload-sentry+ \
":engine=KMEA Keyman Engine for Android" \

View file

@ -73,12 +73,17 @@ java {
}
// how to configure the sentry android gradle plugin
sentry {
// Disables or enables the automatic configuration of Native symbols
uploadNativeSymbols = true
task publishSentry {
doLast {
println 'Publishing FirstVoices symbols to Sentry'
sentry {
// Disables or enables the automatic configuration of Native symbols
uploadNativeSymbols = true
// Does or doesn't include the source code of native code for Sentry
includeNativeSources = true
// Does or doesn't include the source code of native code for Sentry
includeNativeSources = true
}
}
}
String env_keys_json_file = System.getenv("oem_firstvoices_keys_json_file")

View file

@ -32,6 +32,7 @@ builder_describe "Builds FirstVoices for Android app." \
"configure" \
"build" \
"test Runs lint and tests." \
"publish Publishes symbols to Sentry and the APK to the Play Store." \
"--ci Don't start the Gradle daemon. For CI" \
"--upload-sentry Upload to sentry"
@ -61,15 +62,10 @@ fi
#### Build action definitions ####
function makeLocalSentryRelease() {
echo "Placeholder for uploading symbols to Sentry"
}
#### Build action definitions ####
# Check about cleaning artifact paths
if builder_start_action clean; then
rm -rf "$KEYMAN_ROOT/oem/firstvoices/android/app/build/outputs"
rm -rf "$KEYMAN_ROOT/oem/firstvoices/android/app/build/tmp"
builder_finish_action success clean
fi
@ -102,3 +98,5 @@ if builder_start_action test; then
builder_finish_action success test
fi
builder_run_action publish ./gradlew $DAEMON_FLAG publishSentry publishReleaseApk