-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
The Flutter Gradle plugin is (by necessity) built on top of AGP.
AGP today has exposed APIs designed for extending it https://developer.android.com/build/extend-agp#variant-api-artifacts-tasks.
This was not the case when the Flutter Gradle plugin was written. Instead, we discovered tasks that AGP added by guessing their name as a string and then doing things with them (typically making them depend on the Flutter tasks that we were adding). We should remove this string based guessing, and migrate to their intended API.
e.g.
flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy
Lines 474 to 485 in e971379
| Task packageAssets | |
| Task cleanPackageAssets | |
| try { | |
| packageAssets = project.tasks.named("package${variant.name.capitalize()}Assets").get() | |
| } catch (UnknownTaskException ignored) { | |
| packageAssets = null | |
| } | |
| try { | |
| cleanPackageAssets = project.tasks.named("cleanPackage${variant.name.capitalize()}Assets").get() | |
| } catch (UnknownTaskException ignored) { | |
| cleanPackageAssets = null | |
| } |
The good news is that I think these attempts to get tasks might already be failing? They seemed to be always null in my brief testing, which means it would be easy to remove them. But that is a guess.