Migrate the flutter-apk copy and per-ABI versionCode to the variant API - #7
Open
reidbaker-agent wants to merge 1 commit into
Open
Migrate the flutter-apk copy and per-ABI versionCode to the variant API#7reidbaker-agent wants to merge 1 commit into
reidbaker-agent wants to merge 1 commit 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-apk-copy-versioncode
branch
from
July 22, 2026 15:54
c051ed0 to
1d44353
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-apk-copy-versioncode
branch
from
July 28, 2026 13:36
1d44353 to
f3d2a31
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-apk-copy-versioncode
branch
from
July 28, 2026 13:37
f3d2a31 to
91f0814
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-apk-copy-versioncode
branch
from
July 29, 2026 20:21
91f0814 to
45e5dea
Compare
reidbaker-agent
force-pushed
the
agp-assets-onvariants
branch
from
July 29, 2026 20:43
bd722f5 to
78c25d5
Compare
reidbaker-agent
force-pushed
the
agp-apk-copy-versioncode
branch
3 times, most recently
from
July 31, 2026 16:16
e34a92a to
b7a23f7
Compare
Phase P6 of the AGP public-API migration (flutter#180137, flutter#166550). The application path no longer uses the legacy variant API at all: - New CopyFlutterApksTask copies the variant's SingleArtifact.APK directory contents (via BuiltArtifactsLoader) into build/outputs/flutter-apk under the unchanged names app[-abi][-flavor]-<build-mode>.apk. It is attached as a finalizer of assemble<Variant> (matched by name, with a projectsEvaluated assertion that fails loudly if the assemble task was never created, instead of silently leaving flutter run/build without APKs). The task declares individual predictable @OutputFiles - computed from target platforms, flavor, and build mode - rather than the shared flutter-apk directory, so it is UP-TO-DATE-capable without overlapping outputs between variants; it replaces the old assemble.doLast copy. - Per-ABI versionCode for --split-per-abi builds is now a read-then-set on VariantOutput.versionCode inside onVariants (the output is seeded with AGP's merged value, which covers flavor-defined versionCodes), replacing versionCodeOverride on the legacy ApkVariantOutput. When the built APK's versionCode differs from what Flutter configured (e.g. an afterEvaluate mutation), CopyFlutterApksTask logs a warning pointing at androidComponents.onVariants. Note on onVariants FIFO callback ordering: Because FGP is applied at line 25 of build.gradle.kts, FGP's callback executes before app-level onVariants callbacks at line 70. Any custom app-level block reading output.versionCode.get() will observe the ABI-offset value. For standard apps, no change is needed; monotonic ABI ordering and Play Store uniqueness are preserved even if an app transforms versionCode. - The entire legacy applicationVariants.configureEach block and its helpers are deleted; AbstractAppExtension remains only in the add-to-app module path, which migrates next. Verification (CI): split-per-abi + apkanalyzer per-ABI versionCode assertions including the flavor-defined-versionCode case; flavor filename check; flutter run / hot restart / attach; Windows-runner smoke for the copy tasks; android_e2e_api_test; gradle unit tests on both AGP axes. Revert-safe until P7 lands (mutually tolerant with P7 until P10).
reidbaker
force-pushed
the
agp-apk-copy-versioncode
branch
from
July 31, 2026 18:07
b7a23f7 to
53bcc7f
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 7 of 11 of the AGP public-API migration; stacked on #6.
Phase P6 of the AGP public-API migration (flutter#180137,
flutter#166550). The application path no longer uses the legacy
variant API at all:
directory contents (via BuiltArtifactsLoader) into
build/outputs/flutter-apk under the unchanged names
app[-abi][-flavor]-<build-mode>.apk. It is attached as a finalizer of
assemble<Variant> (matched by name, with a projectsEvaluated
assertion that fails loudly if the assemble task was never created,
instead of silently leaving flutter run/build without APKs). The task
declares individual predictable @OutputFiles - computed from target
platforms, flavor, and build mode - rather than the shared
flutter-apk directory, so it is UP-TO-DATE-capable without
overlapping outputs between variants; it replaces the old
assemble.doLast copy.
on VariantOutput.versionCode inside onVariants (the output is seeded
with AGP's merged value, which covers flavor-defined versionCodes),
replacing versionCodeOverride on the legacy ApkVariantOutput. When
the built APK's versionCode differs from what Flutter configured
(e.g. an afterEvaluate mutation), CopyFlutterApksTask logs a warning
pointing at androidComponents.onVariants.
helpers are deleted; AbstractAppExtension remains only in the
add-to-app module path, which migrates next.
Verification (CI): split-per-abi + apkanalyzer per-ABI versionCode
assertions including the flavor-defined-versionCode case; flavor
filename check; flutter run / hot restart / attach; Windows-runner
smoke for the copy tasks; android_e2e_api_test; gradle unit tests on
both AGP axes.
Revert-safe until P7 lands (mutually tolerant with P7 until P10).
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).