Include Android versionCode in APK and AAB artifact names
This commit is contained in:
@@ -253,6 +253,21 @@ print(f'Updated versionCode to {new_code} and versionName to {new_name}')
|
|||||||
PY
|
PY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
android_version_code() {
|
||||||
|
local gradle_file="$PROJECT_DIR/app/build.gradle.kts"
|
||||||
|
python - <<PY
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
|
||||||
|
path = Path(r'''$gradle_file''')
|
||||||
|
text = path.read_text()
|
||||||
|
match = re.search(r'versionCode\s*=\s*(\d+)', text)
|
||||||
|
if not match:
|
||||||
|
raise SystemExit('Could not find versionCode in app/build.gradle.kts')
|
||||||
|
print(match.group(1))
|
||||||
|
PY
|
||||||
|
}
|
||||||
|
|
||||||
setup_env() {
|
setup_env() {
|
||||||
setup_java_env
|
setup_java_env
|
||||||
export ANDROID_HOME="$SDK_DIR"
|
export ANDROID_HOME="$SDK_DIR"
|
||||||
@@ -521,6 +536,18 @@ maybe_run_operation() {
|
|||||||
if [ "$should_bump_version" = "true" ]; then
|
if [ "$should_bump_version" = "true" ]; then
|
||||||
bump_android_version
|
bump_android_version
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$artifact_source" ]; then
|
||||||
|
local version_code
|
||||||
|
version_code="$(android_version_code)"
|
||||||
|
case "$mode" in
|
||||||
|
--build)
|
||||||
|
artifact_target="$PROJECT_DIR/app/build/outputs/apk/debug/githug-android-debug-v${version_code}.apk"
|
||||||
|
;;
|
||||||
|
--build-release-aab)
|
||||||
|
artifact_target="$PROJECT_DIR/app/build/outputs/bundle/release/githug-android-release-v${version_code}.aab"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
if [ "$should_compile_host_git" = "true" ]; then
|
if [ "$should_compile_host_git" = "true" ]; then
|
||||||
build_host_git
|
build_host_git
|
||||||
export GITHUG_TEST_GIT_BINARY="$HOST_GIT_BINARY"
|
export GITHUG_TEST_GIT_BINARY="$HOST_GIT_BINARY"
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ Available commands:
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `bash ./AndroidProjectTooling.sh` | Provision or refresh the local Android/JDK toolchain only. | Toolchain under `./jdk` and `./android-sdk` |
|
| `bash ./AndroidProjectTooling.sh` | Provision or refresh the local Android/JDK toolchain only. | Toolchain under `./jdk` and `./android-sdk` |
|
||||||
| `bash ./AndroidProjectTooling.sh --test` | Compile host Git, set `GITHUG_TEST_GIT_BINARY`, and run JVM unit tests. | Test reports under `app/build/reports/` |
|
| `bash ./AndroidProjectTooling.sh --test` | Compile host Git, set `GITHUG_TEST_GIT_BINARY`, and run JVM unit tests. | Test reports under `app/build/reports/` |
|
||||||
| `bash ./AndroidProjectTooling.sh --build` | Build the debug APK. | `app/build/outputs/apk/debug/githug-android-debug.apk` |
|
| `bash ./AndroidProjectTooling.sh --build` | Build the debug APK. | `app/build/outputs/apk/debug/githug-android-debug-v<versionCode>.apk` |
|
||||||
| `bash ./AndroidProjectTooling.sh --build-release-aab` | Build the release Android App Bundle. | `app/build/outputs/bundle/release/githug-android-release.aab` |
|
| `bash ./AndroidProjectTooling.sh --build-release-aab` | Build the release Android App Bundle. | `app/build/outputs/bundle/release/githug-android-release-v<versionCode>.aab` |
|
||||||
| `bash ./AndroidProjectTooling.sh --compile-git` | Compile Git for the development host and all Android target ABIs. | Host and Android `libgit.so` binaries |
|
| `bash ./AndroidProjectTooling.sh --compile-git` | Compile Git for the development host and all Android target ABIs. | Host and Android `libgit.so` binaries |
|
||||||
|
|
||||||
To run the JVM unit test suite after ensuring the local toolchain is ready:
|
To run the JVM unit test suite after ensuring the local toolchain is ready:
|
||||||
@@ -82,7 +82,7 @@ When `--build` or `--build-release-aab` is used, the script also:
|
|||||||
- increments `versionCode` by 1
|
- increments `versionCode` by 1
|
||||||
- increments the patch component of `versionName`, for example `0.1.0` to `0.1.1`
|
- increments the patch component of `versionName`, for example `0.1.0` to `0.1.1`
|
||||||
- bundles full Git manpage source files from Git's `Documentation/` directory into app assets
|
- bundles full Git manpage source files from Git's `Documentation/` directory into app assets
|
||||||
- renames the generated artifact to a stable `githug-android-*` filename
|
- renames the generated artifact to a `githug-android-*` filename that includes the post-bump `versionCode`
|
||||||
- attempts to create a git commit after a successful build if there are source changes
|
- attempts to create a git commit after a successful build if there are source changes
|
||||||
|
|
||||||
The build commands currently run these Gradle tasks:
|
The build commands currently run these Gradle tasks:
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ android {
|
|||||||
applicationId = "solutions.tretter.githugandroid"
|
applicationId = "solutions.tretter.githugandroid"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 150
|
versionCode = 151
|
||||||
versionName = "0.1.149"
|
versionName = "0.1.150"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|||||||
Reference in New Issue
Block a user