Register the Flutter compile task lazily from the variant API for app projects - #6
Open
reidbaker-agent wants to merge 2 commits into
Open
Register the Flutter compile task lazily from the variant API for app projects#6reidbaker-agent wants to merge 2 commits into
reidbaker-agent wants to merge 2 commits into
Conversation
reidbaker-agent
force-pushed
the
agp-assets-onvariants
branch
from
July 22, 2026 15:54
1c1b7f1 to
8dbebbb
Compare
reidbaker-agent
force-pushed
the
agp-ndk-fallback
branch
2 times, most recently
from
July 28, 2026 13:35
7e60b17 to
106779a
Compare
reidbaker-agent
force-pushed
the
agp-assets-onvariants
branch
from
July 28, 2026 13:35
8dbebbb to
b7ca673
Compare
reidbaker-agent
force-pushed
the
agp-ndk-fallback
branch
from
July 28, 2026 13:37
106779a to
f247915
Compare
reidbaker-agent
force-pushed
the
agp-assets-onvariants
branch
from
July 28, 2026 13:37
b7ca673 to
34cd183
Compare
reidbaker-agent
force-pushed
the
agp-ndk-fallback
branch
from
July 29, 2026 20:18
f247915 to
308ba7e
Compare
reidbaker-agent
force-pushed
the
agp-assets-onvariants
branch
from
July 29, 2026 20:21
34cd183 to
bd722f5
Compare
reidbaker-agent
force-pushed
the
agp-ndk-fallback
branch
from
July 29, 2026 20:43
308ba7e to
c459db2
Compare
reidbaker-agent
force-pushed
the
agp-assets-onvariants
branch
2 times, most recently
from
July 30, 2026 21:59
78c25d5 to
ad24137
Compare
… projects Phase P5, commit 1 of 2 (P5a), of the AGP public-API migration (flutter#180137, flutter#166550): - For application projects, compileFlutterBuild<Variant> (FlutterTask) is now registered inside the consolidated androidComponents.onVariants block as a lazy TaskProvider, configured entirely from the public variant API: minSdk from Variant.minSdk.apiLevel, flavor from Variant.flavorName, and the Flutter build mode from buildModeFor(variant.buildType, variant.debuggable) so custom debuggable build types keep mapping to debug engine artifacts. Registration is gated by shouldConfigureFlutterTask on the computed assemble task name (new name-based overload), mirroring the legacy callback's gating. - addFlutterDeps is split: addFlutterDepsForApp (per-ABI versionCode, legacy assets copy into the merged-assets dir, processResources hook) looks the compile task up by name instead of registering it; addFlutterDepsForModule keeps the full legacy path for add-to-app module projects until that path migrates. The always-null packageAssets/isUsedAsSubproject dead code and the duplicated processResources hook in the application variant callback are removed. No behavior change intended for what gets built; the assets delivery mechanism changes in the next commit (P5b). Verification note: FGP unit tests could not run in this sandbox (network policy blocks dl.google.com); run 'gradle test' (both AGP axes) in CI. Revert-safe (with P5b) until P6 lands.
…app path Phase P5, commit 2 of 2 (P5b), of the AGP public-API migration (flutter#180137, flutter#166550): - New CopyFlutterAssetsTask stages flutter_assets/** from the Flutter build output into its own output directory (modeled on CopyFlutterJniLibsTask, including the overlapping-outputs rationale), applying the user read+write file permissions the old Copy task set. - For application projects, copyFlutterAssets<Variant> is registered in the consolidated onVariants block as a lazy TaskProvider and wired via variant.sources.assets.addGeneratedSourceDirectory. AGP now merges Flutter's assets like any other assets source; collisions with user assets resolve by source-set priority instead of the old post-merge overwrite (documented behavior change). A missing assets source set fails loudly instead of silently building an APK without Flutter assets. - The legacy app-path assets copy (into mergeAssets.outputDir), its processResources/cleanMergeAssets task-graph surgery, and the manual compress<V>Assets dependsOn wiring are deleted for app projects; AGP owns those edges now. The application variant callback is reduced to the per-ABI versionCode override and the flutter-apk copy, both of which migrate in the next phase. The add-to-app module path is unchanged (still the full legacy copy) until it migrates. - copyFlutterAssets<Variant> changes type from org.gradle.api.tasks.Copy to CopyFlutterAssetsTask and is now registered lazily (documented breaking change for build scripts that referenced it by type). - Tests: new CopyFlutterAssetsTaskTest executes the task against real files (staging layout, permission bits, non-asset exclusion, stale output cleanup). The FlutterPluginTest filePermissions test built on capturing the legacy Copy registration is superseded by it. Verification (CI): gradle unit tests both AGP axes; integration builddir/obfuscate/jni/print_build_variants/deferred_components_assets; add-to-app source smoke + flutter build aar; asset-staleness rebuild check; config-cache per baseline. Revert-safe until P6 lands.
reidbaker
force-pushed
the
agp-ndk-fallback
branch
from
July 31, 2026 18:07
c459db2 to
e257098
Compare
reidbaker
force-pushed
the
agp-assets-onvariants
branch
from
July 31, 2026 18:07
ad24137 to
2654136
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 6 of 11 of the AGP public-API migration; stacked on #5.
Phase P5, commit 1 of 2 (P5a), of the AGP public-API migration
(flutter#180137, flutter#166550):
is now registered inside the consolidated androidComponents.onVariants
block as a lazy TaskProvider, configured entirely from the public
variant API: minSdk from Variant.minSdk.apiLevel, flavor from
Variant.flavorName, and the Flutter build mode from
buildModeFor(variant.buildType, variant.debuggable) so custom
debuggable build types keep mapping to debug engine artifacts.
Registration is gated by shouldConfigureFlutterTask on the computed
assemble task name (new name-based overload), mirroring the legacy
callback's gating.
legacy assets copy into the merged-assets dir, processResources hook)
looks the compile task up by name instead of registering it;
addFlutterDepsForModule keeps the full legacy path for add-to-app
module projects until that path migrates. The always-null
packageAssets/isUsedAsSubproject dead code and the duplicated
processResources hook in the application variant callback are
removed.
No behavior change intended for what gets built; the assets delivery
mechanism changes in the next commit (P5b).
Verification note: FGP unit tests could not run in this sandbox (network
policy blocks dl.google.com); run 'gradle test' (both AGP axes) in CI.
Revert-safe (with P5b) until P6 lands.
CI must run the FGP unit tests (the Kotlin suite in packages/flutter_tools/gradle could not run in the delivery sandbox: dl.google.com returns 403, so AGP artifacts do not resolve).