Do not force Android packaging tasks to re-run on every build.
There where two issues. The most obvious is that the task name that merges JNI libraries has evolved; it's now `merge{...}JniLibFolders`. The second, which really caught me out, is that when both `main.jniLibs.srcDirs` and `debug.jniLibs.srcDirs` contain the same path, then the Android source set merger silently fails. I don't really understand what's happening here, I just know that using only `main.jniLibs.srcDirs` solves the issue. Fixes #2659.
This commit is contained in:
Родитель
8b716c34fe
Коммит
2921db3571
|
@ -109,7 +109,7 @@ afterEvaluate {
|
|||
productFlavor += "${it.name.capitalize()}"
|
||||
}
|
||||
def buildType = "${variant.buildType.name.capitalize()}"
|
||||
tasks["generate${productFlavor}${buildType}Assets"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
tasks["merge${productFlavor}${buildType}JniLibFolders"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
||||
// For unit tests.
|
||||
tasks["process${productFlavor}${buildType}UnitTestJavaRes"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
|
|
@ -125,7 +125,7 @@ afterEvaluate {
|
|||
productFlavor += "${it.name.capitalize()}"
|
||||
}
|
||||
def buildType = "${variant.buildType.name.capitalize()}"
|
||||
tasks["generate${productFlavor}${buildType}Assets"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
tasks["merge${productFlavor}${buildType}JniLibFolders"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
||||
// For unit tests.
|
||||
tasks["process${productFlavor}${buildType}UnitTestJavaRes"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
|
|
@ -110,7 +110,7 @@ afterEvaluate {
|
|||
productFlavor += "${it.name.capitalize()}"
|
||||
}
|
||||
def buildType = "${variant.buildType.name.capitalize()}"
|
||||
tasks["generate${productFlavor}${buildType}Assets"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
tasks["merge${productFlavor}${buildType}JniLibFolders"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
||||
// For unit tests.
|
||||
tasks["process${productFlavor}${buildType}UnitTestJavaRes"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
|
|
@ -81,7 +81,7 @@ afterEvaluate {
|
|||
productFlavor += "${it.name.capitalize()}"
|
||||
}
|
||||
def buildType = "${variant.buildType.name.capitalize()}"
|
||||
tasks["generate${productFlavor}${buildType}Assets"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
tasks["merge${productFlavor}${buildType}JniLibFolders"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
||||
// For unit tests.
|
||||
tasks["process${productFlavor}${buildType}UnitTestJavaRes"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
|
|
@ -109,7 +109,7 @@ afterEvaluate {
|
|||
productFlavor += "${it.name.capitalize()}"
|
||||
}
|
||||
def buildType = "${variant.buildType.name.capitalize()}"
|
||||
tasks["generate${productFlavor}${buildType}Assets"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
tasks["merge${productFlavor}${buildType}JniLibFolders"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
||||
// For unit tests.
|
||||
tasks["process${productFlavor}${buildType}UnitTestJavaRes"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
|
|
@ -108,7 +108,7 @@ afterEvaluate {
|
|||
productFlavor += "${it.name.capitalize()}"
|
||||
}
|
||||
def buildType = "${variant.buildType.name.capitalize()}"
|
||||
tasks["generate${productFlavor}${buildType}Assets"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
tasks["merge${productFlavor}${buildType}JniLibFolders"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
||||
// For unit tests.
|
||||
tasks["process${productFlavor}${buildType}UnitTestJavaRes"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
|
|
@ -111,7 +111,7 @@ afterEvaluate {
|
|||
productFlavor += "${it.name.capitalize()}"
|
||||
}
|
||||
def buildType = "${variant.buildType.name.capitalize()}"
|
||||
tasks["generate${productFlavor}${buildType}Assets"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
tasks["merge${productFlavor}${buildType}JniLibFolders"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
||||
// For unit tests.
|
||||
tasks["process${productFlavor}${buildType}UnitTestJavaRes"].dependsOn(project(':full-megazord').tasks["cargoBuild"])
|
||||
|
|
|
@ -30,11 +30,6 @@ android {
|
|||
// packagingOptions { doNotStrip "**/*.so" }
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
android.sourceSets.debug.jniLibs.srcDirs = android.sourceSets.main.jniLibs.srcDirs
|
||||
android.sourceSets.release.jniLibs.srcDirs = android.sourceSets.main.jniLibs.srcDirs
|
||||
}
|
||||
|
||||
configurations {
|
||||
// There's an interaction between Gradle's resolution of dependencies with different types
|
||||
// (@jar, @aar) for `implementation` and `testImplementation` and with Android Studio's built-in
|
||||
|
@ -95,7 +90,7 @@ afterEvaluate {
|
|||
productFlavor += "${it.name.capitalize()}"
|
||||
}
|
||||
def buildType = "${variant.buildType.name.capitalize()}"
|
||||
tasks["generate${productFlavor}${buildType}Assets"].dependsOn(tasks["cargoBuild"])
|
||||
tasks["merge${productFlavor}${buildType}JniLibFolders"].dependsOn(tasks["cargoBuild"])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,6 @@ android {
|
|||
// packagingOptions { doNotStrip "**/*.so" }
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
android.sourceSets.debug.jniLibs.srcDirs = android.sourceSets.main.jniLibs.srcDirs
|
||||
android.sourceSets.release.jniLibs.srcDirs = android.sourceSets.main.jniLibs.srcDirs
|
||||
}
|
||||
|
||||
configurations {
|
||||
// There's an interaction between Gradle's resolution of dependencies with different types
|
||||
// (@jar, @aar) for `implementation` and `testImplementation` and with Android Studio's built-in
|
||||
|
@ -91,7 +86,7 @@ afterEvaluate {
|
|||
productFlavor += "${it.name.capitalize()}"
|
||||
}
|
||||
def buildType = "${variant.buildType.name.capitalize()}"
|
||||
tasks["generate${productFlavor}${buildType}Assets"].dependsOn(tasks["cargoBuild"])
|
||||
tasks["merge${productFlavor}${buildType}JniLibFolders"].dependsOn(tasks["cargoBuild"])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,17 +68,6 @@ ext.configurePublish = { jnaForTestConfiguration = null ->
|
|||
project.afterEvaluate {
|
||||
forUnitTestsJarTask.dependsOn(tasks["cargoBuild"])
|
||||
}
|
||||
|
||||
// For inscrutable reasons, the various android packaging gradle tasks do
|
||||
// not get re-run when the underlying rust code changes. Something is not
|
||||
// correctly configuring gradle's up-to-date checks, but I've reached the
|
||||
// limit of how much time I'm willing to spend on figuring it out. Deleting
|
||||
// these intermediate files forces re-execution of the task.
|
||||
// Ref https://github.com/mozilla/application-services/issues/2659
|
||||
task forceGradleToRefreshPackagedLibsWhenTheRustCodeChanges(type: Delete) {
|
||||
delete "$buildDir/intermediates/merged_jni_libs"
|
||||
}
|
||||
preBuild.dependsOn(forceGradleToRefreshPackagedLibsWhenTheRustCodeChanges)
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче