Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support automatic upload when building App Bundles #137

Merged
merged 5 commits into from
Dec 11, 2018

Conversation

fractalwrench
Copy link
Contributor

Goal

v3.2.0 of the Android Gradle Plugin (AGP) introduced App Bundles, a new upload format which delegates the generation of APKs to the Google Play store, and which allows dynamic delivery of feature module APKs.

The task used to generate the App Bundle does not trigger the Bugsnag plugin's mapping file upload or build API tasks automatically - this changeset fixes that.

Changeset

The changes are best viewed by looking at the individual commits:

  1. The mazerunner example app fixture was updated to use AGP v3.2.1 to enable building App Bundles. This upgrade also required updating the gradle wrapper for the fixture to 4.6 (the minimum supported), and explicitly stating that all ABIs should be built (mips, mips64, and armeabi were disabled by default in v3.2.0).

  2. Mazerunner scenarios were added for several App Bundle project setups:

  • A project which builds a single APK
  • A project which builds two APK productFlavors
  • A project where autouploading is disabled

These scenarios are broadly the same as the ones used to test assemble tasks.

  1. The method which calculates the names of assemble tasks was updated to also include bundle tasks. This in turn adds a task dependency between each bundle task and our upload tasks which ensures they automatically run.

For example, in our previous gradle plugin, the following tasks would be expected to trigger a mapping file upload, NDK upload, and Build API request:

[assemble, assembleJavaExampleRelease, assembleJavaExample, assembleRelease]

whereas with these changes, the following tasks would also trigger this behaviour:

[bundle, bundleJavaExampleRelease, bundleJavaExample, bundleRelease]

Tests

In addition to existing and new mazerunner scenarios, I confirmed that a crash from an APK generated from a bundle deobfuscates correctly on the dashboard. A guide on how to achieve this is available here: https://developer.android.com/guide/app-bundle/

Linked issues

Fixes #135

The task for generating an Android Bundle is distinct from the assemble task, meaning that mapping
files are not uploaded automatically. This alters the plugin to depend on the bundle task for
proguard/ndk/releases tasks.
@fractalwrench fractalwrench changed the title Support app bundles Support automatic upload when building App Bundles Dec 6, 2018
@Pezzah Pezzah self-requested a review December 11, 2018 09:27
*
* E.g. [bundle, bundleRelease, bundleFooRelease]
*/
private static Set<String> findTaskNamesForPrefix(BaseVariantOutput output, String prefix) {
String variantName = output.name.split("-")[0].capitalize()
String assembleTaskName = output.assemble.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a shame we can't get the "bundle" task from the build variant instead of using the assemble one and replacing the names.

@fractalwrench fractalwrench merged commit 2019a86 into next Dec 11, 2018
@fractalwrench fractalwrench deleted the support-app-bundles branch December 11, 2018 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants