diff --git a/README.md b/README.md index febd0d2..3146f09 100644 --- a/README.md +++ b/README.md @@ -230,8 +230,8 @@ Pushing a version tag runs the GitHub release workflow, builds and verifies ever the artifacts to a GitHub Release. The tag must match `versionName` exactly: ```shell -git tag v0.0.1 -git push origin v0.0.1 +git tag v0.0.3 +git push origin v0.0.3 ``` ## Contributing diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7a43fbf..fa09f16 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -27,8 +27,8 @@ android { applicationId = "net.megaproxy487" minSdk = 26 targetSdk = 35 - versionCode = 1 - versionName = "0.0.1" + versionCode = 3 + versionName = "0.0.3" buildConfigField("String", "GIT_COMMIT_HASH", "\"$gitCommitHash\"") testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/scripts/build-release-apks.sh b/scripts/build-release-apks.sh index 4d84f8f..25ba8a4 100755 --- a/scripts/build-release-apks.sh +++ b/scripts/build-release-apks.sh @@ -91,12 +91,6 @@ echo "Running native tests" go test ./... ) -echo "Running Android unit tests" -( - cd "$project_dir" - ./gradlew testReleaseUnitTest -) - # gomobile architecture names and their corresponding Android ABI names. targets=( "arm64:arm64-v8a" @@ -105,27 +99,59 @@ targets=( "386:x86" ) +# A clean checkout has no app/libs/megaproxy.aar. Gradle resolves local AAR +# dependencies while configuring Android unit tests, so build the first ABI +# before invoking Gradle and reuse it for the first release APK below. +first_target="${targets[0]}" +first_go_arch="${first_target%%:*}" +first_android_abi="${first_target##*:}" +echo "Building initial native AAR for $first_android_abi" +( + cd "$project_dir/native" + gomobile bind \ + -target="android/$first_go_arch" \ + -androidapi 26 \ + -trimpath \ + -ldflags="-s -w -buildid=" \ + -o ../app/libs/megaproxy.aar \ + ./mobile +) + +echo "Running Android unit tests" +( + cd "$project_dir" + ./gradlew testReleaseUnitTest +) + for target in "${targets[@]}"; do go_arch="${target%%:*}" android_abi="${target##*:}" output_apk="$MEGAPROXY_RELEASE_DIR/mega-proxy-v${version_name}-${android_abi}.apk" - echo "Building optimized native AAR for $android_abi" - ( - cd "$project_dir/native" - gomobile bind \ - -target="android/$go_arch" \ - -androidapi 26 \ - -trimpath \ - -ldflags="-s -w -buildid=" \ - -o ../app/libs/megaproxy.aar \ - ./mobile - ) + if [[ "$android_abi" == "$first_android_abi" ]]; then + echo "Reusing initial native AAR for $android_abi" + else + echo "Building optimized native AAR for $android_abi" + ( + cd "$project_dir/native" + gomobile bind \ + -target="android/$go_arch" \ + -androidapi 26 \ + -trimpath \ + -ldflags="-s -w -buildid=" \ + -o ../app/libs/megaproxy.aar \ + ./mobile + ) + fi echo "Building and signing $android_abi APK" ( cd "$project_dir" - ./gradlew clean assembleRelease + # Keep clean and assemble in separate Gradle invocations. When both are + # requested in one task graph, Gradle does not guarantee that clean has + # finished before every generated-resource task starts. + ./gradlew clean + ./gradlew assembleRelease ) built_apk="$project_dir/app/build/outputs/apk/release/app-release.apk" if [[ ! -f "$built_apk" ]]; then