Skip to content

Commit

Permalink
Fix gradle rust android plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Jan 10, 2025
1 parent b583cb8 commit f7add3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/android-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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"])
Expand Down

0 comments on commit f7add3c

Please sign in to comment.