flutter/packages/flutter_tools/gradle
Gray Mackall f964f15dcb
Fix flutter build aar for modules that use a plugin (#154757)
https://github.com/flutter/flutter/pull/151675 bumped module templates to AGP 8.1.

In doing so, I tried to work around a behavior change [that was new in AGP 8.0](https://developer.android.com/build/releases/past-releases/agp-8-0-0-release-notes):
> AGP 8.0 creates no SoftwareComponent by default. Instead AGP creates SoftwareComponents only for variants that are configured to be published using the publishing DSL.

by using AGP's publishing DSL to define which variants to publish in the module's ephemeral gradle files:
```
android.buildTypes.all {buildType ->
    if (!android.productFlavors.isEmpty()) {
        android.productFlavors.all{productFlavor ->
            android.publishing.singleVariant(productFlavor.name + buildType.name.capitalize()) {
                withSourcesJar()
                withJavadocJar()
            }
        }
    } else {
        android.publishing.singleVariant(buildType.name) {
            withSourcesJar()
            withJavadocJar()
        }
    }
}
```

The problem is that this doesn't get applied to the plugin projects used by the module, so if a module uses any plugin it breaks. This PR fixes that by applying similar logic, but to each project (not just the module's project).

Tested manually with https://github.com/gmackall/GrayAddToApp, and also re-enabled an old test that tested this use case as a part of the PR.

Fixes: https://github.com/flutter/flutter/issues/154371
2024-09-10 16:42:22 +00:00
..
src/main Make the Flutter Gradle Plugin apply FlutterExtension to (flutter) plugins (#151861) 2024-09-04 17:47:59 +00:00
.dartignore License update (#45373) 2019-11-27 15:04:02 -08:00
aar_init_script.gradle Fix flutter build aar for modules that use a plugin (#154757) 2024-09-10 16:42:22 +00:00
app_plugin_loader.gradle Switch to more reliable flutter.dev link destinations in the tool (#150587) 2024-06-26 23:30:39 +00:00
build.gradle.kts Format all kotlin according to ktlint (#143390) 2024-02-14 17:58:18 +00:00
flutter_proguard_rules.pro Remove allowoptimization modifier from FlutterPlugin proguard rules (#154715) 2024-09-06 20:37:23 +00:00
flutter.gradle Switch to more reliable flutter.dev link destinations in the tool (#150587) 2024-06-26 23:30:39 +00:00
manual_migration_settings.gradle.md Don't import plugins that don't support android in settings.gradle (#54407) 2020-04-12 08:55:03 -07:00
module_plugin_loader.gradle Reland (2): "Fix how Gradle resolves Android plugin" (#142498) 2024-02-19 18:07:33 +00:00
resolve_dependencies.gradle Allows adding a storage 'realm' to the storage base URL (#131951) 2023-08-09 23:26:05 +00:00
settings_aar.gradle.tmpl
settings.gradle.kts Format all kotlin according to ktlint (#143390) 2024-02-14 17:58:18 +00:00
settings.gradle.legacy_versions Remove license statements in template files. (#57268) 2020-06-15 09:30:05 -07:00