diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml index 9d1d4fdf23a4..74e1fd3ee7de 100644 --- a/.github/workflows/android-app.yml +++ b/.github/workflows/android-app.yml @@ -159,16 +159,16 @@ jobs: include: - arch: "x86_64" abi: "x86_64" - taskVariant: "X86_64" + task-variant: "X86_64" - arch: "i686" abi: "x86" - taskVariant: "X86" + task-variant: "X86" - arch: "aarch64" abi: "arm64-v8a" - taskVariant: "Arm64" + task-variant: "Arm64" - arch: "armv7" abi: "armeabi-v7a" - taskVariant: "Arm" + task-variant: "Arm" steps: # Fix for HOME path overridden by GH runners when building in containers, see: # https://github.com/actions/runner/issues/863 @@ -210,7 +210,7 @@ jobs: uses: burrunan/gradle-cache-action@v1 with: job-id: jdk17 - arguments: cargoBuild${{ matrix.taskVariant }} + arguments: cargoBuild${{ matrix.task-variant }} gradle-version: wrapper build-root-directory: android execution-only-caches: false diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 8ba2a272bf2a..0eb5511f0a88 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -295,7 +295,6 @@ cargo { add("--locked") } } - exec = { spec, _ -> println(spec.commandLine) } } tasks.register("generateRelayList") { @@ -313,13 +312,8 @@ tasks.register("generateRelayList") { val output = standardOutput as ByteArrayOutputStream // Create file if needed File("$extraAssetsDirectory").mkdirs() - File("$extraAssetsDirectory/relays.json").createNewFile() - FileOutputStream("$extraAssetsDirectory/relays.json").use { it.write(output.toByteArray()) } - - // Old ensure exists tasks - if (!relayListPath.exists()) { - throw GradleException("Failed to generate relay list") - } + relayListPath.createNewFile() + FileOutputStream(relayListPath).use { it.write(output.toByteArray()) } } } @@ -333,14 +327,16 @@ if(gradleLocalProperties(rootProject.projectDir, providers) tasks["clean"].dependsOn("cargoClean") } +// This is a hack and will not work correctly under all scenarios. +// See DROID-1696 for how we can improve this. fun isReleaseBuild() = gradle.startParameter.getTaskNames().any { it.contains("release", ignoreCase = true) } fun isAlphaOrDevBuild() : Boolean { val localProperties = gradleLocalProperties(rootProject.projectDir, providers) val versionName = generateVersionName(localProperties) - return versionName.contains("dev", ignoreCase = true) || - versionName.contains("alpha", ignoreCase = true) + return versionName.contains("dev") || + versionName.contains("alpha") } androidComponents { diff --git a/android/build-apk.sh b/android/build-apk.sh index 770aa2d80622..43dc034ff81c 100755 --- a/android/build-apk.sh +++ b/android/build-apk.sh @@ -52,17 +52,12 @@ if [[ "$BUILD_TYPE" == "release" ]]; then BUNDLE_TASKS+=(createPlayDevmoleReleaseDistBundle createPlayStagemoleReleaseDistBundle) elif [[ "$PRODUCT_VERSION" == *"-alpha"* ]]; then echo "Removing old Rust build artifacts" - cargo clean GRADLE_TASKS+=(createPlayStagemoleReleaseDistApk) BUNDLE_TASKS+=(createPlayStagemoleReleaseDistBundle) PLAY_PUBLISH_TASKS=(publishPlayStagemoleReleaseBundle) - else - cargo clean fi fi -pushd "$SCRIPT_DIR" - # Fallback to the system-wide gradle command if the gradlew script is removed. # It is removed by the F-Droid build process before the build starts. if [ -f "gradlew" ]; then @@ -76,7 +71,6 @@ else fi $GRADLE_CMD --console plain clean -popd $GRADLE_CMD --console plain "${GRADLE_TASKS[@]}" diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 522e4cd7042d..b43f4fec860d 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -18,7 +18,6 @@ plugins { alias(libs.plugins.detekt) apply true alias(libs.plugins.dependency.versions) apply true - } buildscript { diff --git a/wireguard-go-rs/build.rs b/wireguard-go-rs/build.rs index d4d6a73415f9..515f2579b8f8 100644 --- a/wireguard-go-rs/build.rs +++ b/wireguard-go-rs/build.rs @@ -172,6 +172,7 @@ fn build_android_dynamic_lib(daita: bool) -> anyhow::Result<()> { // or if the libwg.so file has been changed. The latter is required since the // libwg.so file could be deleted. It however means that this build will need // to run two times before it is properly cached. + // FIXME: Figure out a way to do this better. This is tracked in DROID-1697. println!( "cargo::rerun-if-changed={}", android_output_path(target)?.join("libwg.so").display() @@ -232,7 +233,8 @@ fn android_move_binary(binary: &Path, output: &Path) -> anyhow::Result<()> { std::fs::create_dir_all(parent_of_output)?; let mut copy_command = Command::new("cp"); - // P command is required to not rebuild this module everytime + // -p command is required to preserve ownership and timestamp of the file to prevent a + // rebuild of this module everytime. copy_command .arg("-p") .arg(binary.to_str().unwrap())