You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b8cd39b
Browse filesBrowse the repository at this point in the historyBrowse files
Address review: clarify the variant gate and task registration comments
Explain why library variants skip the command-line gate, drop the
application/library list from the assets comment, drop the 'public
variant API' clause, and say what library variants lack in
configureApplicationOutputs.
Copy file name to clipboardExpand all lines: packages/flutter_tools/gradle/src/main/kotlin/FlutterPlugin.kt
+9-11Lines changed: 9 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -467,9 +467,11 @@ class FlutterPlugin : Plugin<Project> {
467
467
* tracked by https://github.com/flutter/flutter/issues/109560, which also documents the
468
468
* AGP behavior that made it necessary.
469
469
*
470
-
* Library (add-to-app module) variants are never gated: the command line names a host
471
-
* task, and `matchingFallbacks` can map it to a module variant of any name. The tasks are
472
-
* registered lazily, so only the module variant the host consumes runs.
470
+
* Library variants (an add-to-app module) skip this check. The command line names a host
471
+
* task such as `:app:assembleDemoStaging`, and the host's `matchingFallbacks` pick the
472
+
* module variant it consumes, so the task name can't identify that variant. Registering
473
+
* every library variant is safe because registration is lazy: Gradle only runs the module
474
+
* tasks that the host build depends on.
473
475
*/
474
476
privatefunshouldCompileFlutterForVariant(
475
477
project:Project,
@@ -512,8 +514,7 @@ class FlutterPlugin : Plugin<Project> {
512
514
)
513
515
)
514
516
}
515
-
// The assets source set is expected to exist for application and library variants;
516
-
// fail loudly rather than silently building an APK or AAR without Flutter assets.
517
+
// Fail at configuration rather than silently build an APK or AAR without Flutter assets.
517
518
val assetSources =
518
519
variant.sources.assets
519
520
?:throwGradleException(
@@ -558,10 +559,7 @@ class FlutterPlugin : Plugin<Project> {
558
559
)
559
560
}
560
561
561
-
/**
562
-
* Registers the [FlutterTask] (the `flutter assemble` invocation) for [variant],
563
-
* configured entirely from the public variant API.
564
-
*/
562
+
/** Registers the [FlutterTask] (the `flutter assemble` invocation) for [variant]. */
565
563
privatefunregisterFlutterCompileTask(
566
564
project:Project,
567
565
variant:Variant,
@@ -643,8 +641,8 @@ class FlutterPlugin : Plugin<Project> {
643
641
}
644
642
645
643
/**
646
-
* Per-ABI versionCodes and the copy into `build/outputs/flutter-apk/`. Library variants
647
-
* produce an AAR, so they need neither.
644
+
* Configures the per-ABI versionCodes and the copy into `build/outputs/flutter-apk/`. Both
645
+
* act on APK outputs, which library variants don't have.
0 commit comments