Bug 1616704 - Make ./mach build binaries && ./mach run pick up binary changes to libxul.so. r=geckoview-reviewers,agi

The Android-Gradle build plugin has evolved, as has GeckoView (it now
expects libraries in `libs/` instead of `assets/`), so we need to
ensure the libraries are copied into place at the right time.

To test this, you can use an artifact build.  Run `./mach build`, and
then binary edit a string in `$TOPOBJDIR/dist/bin/libxul.so` (I used
Emacs and `bbe` to do that).  Run `./mach android
build-geckoview_example`, and then verify the updated string has been
packaged, for example with something like:
```
unzip -c $TOPOBJDIR/gradle/build/mobile/android/geckoview_example/outputs/apk/withGeckoBinaries/debug/geckoview_example-withGeckoBinaries-debug.apk lib/x86_64/libxul.so | strings | grep NEW 'STRING'
```

Coincidentally, this is essentially the same issue as
https://github.com/mozilla/application-services/issues/2659.

Differential Revision: https://phabricator.services.mozilla.com/D64430

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nick Alexander 2020-02-26 18:43:09 +00:00
parent 300005e4ee
commit 3c29ab9b09

View File

@ -72,10 +72,11 @@ ext.configureVariantWithGeckoBinaries = { variant ->
}
def assetGenTask = tasks.findByName("generate${variant.name.capitalize()}Assets")
def jniLibFoldersTask = tasks.findByName("merge${variant.name.capitalize()}JniLibFolders")
if ((variant.productFlavors*.name).contains('withGeckoBinaries')) {
assetGenTask.dependsOn syncOmnijarFromDistDir
assetGenTask.dependsOn syncLibsFromDistDir
assetGenTask.dependsOn syncAssetsFromDistDir
jniLibFoldersTask.dependsOn syncLibsFromDistDir
android.sourceSets."${variant.name}".assets.srcDir syncOmnijarFromDistDir.destinationDir
android.sourceSets."${variant.name}".assets.srcDir syncAssetsFromDistDir.destinationDir