From f7add3c825334f61734326d924ccd22c8e034a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Fri, 10 Jan 2025 09:53:21 +0100 Subject: [PATCH] Fix gradle rust android plugin --- .github/workflows/android-app.yml | 2 ++ android/app/build.gradle.kts | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml index a035439ead3e..14c7bc0e5ac8 100644 --- a/.github/workflows/android-app.yml +++ b/.github/workflows/android-app.yml @@ -402,6 +402,8 @@ jobs: ${{ matrix.assemble-command }} -x cargoBuild -x generateRelayList + -x mergeOssProdDebugJniLibFolders + -x mergePlayStagemoleDebugJniLibFolders 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 024a5fba7f96..9da8b23fe4c5 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -24,6 +24,7 @@ val repoRootPath = rootProject.projectDir.absoluteFile.parentFile.absolutePath val extraAssetsDirectory = layout.buildDirectory.dir("extraAssets").get() val relayListPath = extraAssetsDirectory.file("relays.json").asFile val defaultChangelogAssetsDirectory = "$repoRootPath/android/src/main/play/release-notes/" +val rustJniLibsDir = layout.buildDirectory.dir("rustJniLibs/android").get() val credentialsPath = "${rootProject.projectDir}/credentials" val keystorePropertiesFile = file("$credentialsPath/keystore.properties") @@ -239,7 +240,13 @@ android { tasks["merge${capitalizedVariantName}Assets"].dependsOn(tasks["generateRelayList"]) // Ensure that we have all the JNI libs before merging them. - tasks["merge${capitalizedVariantName}JniLibFolders"].dependsOn("cargoBuild") + tasks["merge${capitalizedVariantName}JniLibFolders"].apply { + // This is required for the merge task to run every time the .so files are updated. + // See this comment for more information: + // https://github.com/mozilla/rust-android-gradle/issues/118#issuecomment-1569407058 + inputs.dir(rustJniLibsDir) + dependsOn("cargoBuild") + } // Ensure all relevant assemble tasks depend on our ensure task. tasks["assemble$capitalizedVariantName"].dependsOn(tasks["ensureValidVersionCode"])