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

Fix "Task not found" failures when using DexGuard #452

Merged
merged 1 commit into from
Jan 7, 2022

Conversation

lemnik
Copy link
Contributor

@lemnik lemnik commented Jan 6, 2022

Goal

Fix #444 where builds with custom variants and DexGuard could fail with a "Task not found" error where limited build flavours where configured for DexGuard.

Design

Check for variant level DexGuard configurations and if they exist: check each variant is configured in DexGuard before attempting to create an upload task for that variant.

Testing

Manually tested with a known failing project.

Copy link
Contributor

@fractalwrench fractalwrench left a comment

Choose a reason for hiding this comment

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

LGTM pending review comments + manual testing

CHANGELOG.md Outdated
@@ -6,6 +6,9 @@
* Address task dependency warning when using APK splits
[#412](https://github.com/bugsnag/bugsnag-android-gradle-plugin/pull/412)

* Fix "Task with name *** not found" errors when using custom build variants and DexGuard
[]()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is missing a link

val taskName = getDexguardAabTaskName(variant)
project.tasks.named(taskName).configure { dexguardTask ->
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd make sense to keep this configure block as otherwise I think this change could trigger eager configuration of the task

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue is that makes the order of apply plugin significant - the Dexguard plugin must be applied before BAGP otherwise the Dexguard task doesn't exist when we look it up here - also resulting in a Task not found exception.

By specifying the task by name rather than by reference we only resolve it at the end of configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved this much more correctly by postponing the Dexguard task lookup using generateProguardTaskProvider.configure.

@lemnik lemnik marked this pull request as ready for review January 7, 2022 11:02
@lemnik lemnik merged commit 1bb089b into next Jan 7, 2022
@lemnik lemnik deleted the PLAT-7361/dexguard-fix branch January 7, 2022 11:56
@lemnik lemnik mentioned this pull request Jan 13, 2022
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.

None yet

2 participants