Skip to content

Replace the plugin build-type copy with initWith on the public DSL - #4

Closed
reidbaker-agent wants to merge 47 commits into
agp-buildmode-depsfrom
agp-plugin-buildtypes
Closed

Replace the plugin build-type copy with initWith on the public DSL#4
reidbaker-agent wants to merge 47 commits into
agp-buildmode-depsfrom
agp-plugin-buildtypes

Conversation

@reidbaker-agent

@reidbaker-agent reidbaker-agent commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Phase 4 of 11 of the AGP public-API migration; stacked on #3.

Phase P3 of the AGP public-API migration (flutter#180137,
flutter#166550):

  • PluginHandler no longer imports com.android.build.gradle.internal.dsl.BuildType.
    The build-type copy block that shared live legacy BuildType instances
    (addAll) for app-type plugin projects and hand-copied two properties
    for library plugin projects is replaced by a single initWith-based
    copy on the new-DSL containers: missing build types are created on
    the plugin project with initWith(appBuildType) (which carries
    matchingFallbacks), and isDebuggable is additionally copied when both
    sides are application build types. Library build types cannot receive
    app-specific properties through the public DSL - this is a documented
    behavior change of the migration (BuildConfig.DEBUG / JNI
    debuggability of plugins built for custom debuggable build types).
  • Production sources are now free of com.android.build.gradle.internal
    imports; InternalAgpApiImportTest locks that in (test sources may
    still use internals until the gradle-api dependency swap).
  • PluginHandlerTest: the two mock-only copy tests (which never invoked
    configurePlugins) are replaced with tests that run configurePlugins
    and assert the initWith copy for both a library plugin project and an
    app plugin project, including the custom-debuggable-build-type ->
    debug engine artifact mapping.
  • The planned pre-spike (afterEvaluate DSL mutation under newDsl=true)
    could not run in this sandbox; recorded in the migration doc with the
    finalizeDsl fallback. android_plugin_example_app_build and a custom
    build-type scratch build must confirm in CI.

Verification note: FGP unit tests could not be executed in this sandbox
(network policy blocks dl.google.com); run 'gradle test' (both AGP
axes) in packages/flutter_tools/gradle in CI.

Revert-safe until P4 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).

@reidbaker-agent
reidbaker-agent force-pushed the agp-plugin-buildtypes branch from fd41f02 to dc99bbd Compare July 22, 2026 15:54
@reidbaker-agent
reidbaker-agent force-pushed the agp-buildmode-deps branch 2 times, most recently from 0e7b3ee to d177502 Compare July 28, 2026 13:35
@reidbaker-agent
reidbaker-agent force-pushed the agp-plugin-buildtypes branch from dc99bbd to 6e9a5d6 Compare July 28, 2026 13:35
@reidbaker-agent
reidbaker-agent force-pushed the agp-plugin-buildtypes branch from 6e9a5d6 to 8650166 Compare July 28, 2026 13:37
@reidbaker-agent
reidbaker-agent force-pushed the agp-plugin-buildtypes branch from 8650166 to 46063e6 Compare July 29, 2026 20:17
@reidbaker-agent
reidbaker-agent force-pushed the agp-plugin-buildtypes branch from 46063e6 to bece987 Compare July 29, 2026 20:42
@reidbaker
reidbaker force-pushed the agp-plugin-buildtypes branch from bece987 to ffbce64 Compare July 31, 2026 18:07
@reidbaker
reidbaker force-pushed the agp-buildmode-deps branch from 3996bce to 5a528c3 Compare July 31, 2026 18:07
@reidbaker
reidbaker force-pushed the agp-plugin-buildtypes branch from ffbce64 to a68c691 Compare August 6, 2026 14:37
@reidbaker
reidbaker force-pushed the agp-buildmode-deps branch from 5a528c3 to 8373302 Compare August 6, 2026 14:37
pull Bot pushed a commit to Little-Star888/flutter that referenced this pull request Aug 12, 2026
…on documentation (flutter#190842)

There are 2 files in this pr. One is a document the ai used to keep
track of work. More importantly it acts kind of like issues so it
references the items in future prs. The second is user facing website
documentation. I do not know if we will use it verbatim but for the set
of prs lets treat that md doc as human understandable documentation that
we must understand before landing the next pr.

Reviewers: When the pr is out of draft and your comments are fully
addressed please prioritize this pr over other work. The review bar is
higher, the number of reviews has more people and the work for the next
pr is already done.
 - @reidbaker 
---
Standard review context for this pr stack

This is PR is part of an 11 pr stack to migrate the "newdsl"
`gradle-api` specifically in agp 9.1.0.
The complete stack has pass pre submits, post submits and customer
tests.
https://flutter-dashboard.appspot.com/#/build?repo=flutter&branch=experimental/agp-gradle-api

All of the code was LLM authored. A mix of manual prompting, automatic
prompting, several models and adversarial review. The combined sessions
are enough that I cannot include relevant prompts like I have been doing
on other prs.

If you want to review the pr stack you can find it here. These prs will
be abandoned/closed as prs land into flutter/flutter.
1. reidbaker-agent#1 (branch:
agp-api-doc)
2. reidbaker-agent#2 (branch:
agp-internal-utils)
3. reidbaker-agent#3 (branch:
agp-buildmode-deps)
4. reidbaker-agent#4 (branch:
agp-plugin-buildtypes)
5. reidbaker-agent#5 (branch:
agp-ndk-fallback)
6. reidbaker-agent#6 (branch:
agp-assets-onvariants)
7. reidbaker-agent#7 (branch:
agp-apk-copy-versioncode)
8. reidbaker-agent#8 (branch:
agp-add-to-app)
9. reidbaker-agent#9 (branch:
agp-aar-script)
10. reidbaker-agent#10 (branch:
agp-newdsl-flip)
11. reidbaker-agent#11 (branch:
agp-gradle-api)

Follow up work is tracked in
flutter#190964

This work is urgent in the sense that we are worried that android will
publish agp 10 with no opt out but not so urgent that we are willing to
break flutter users because we didn't review or understand the code
because we were in a rush.

Breaking changes are expected as part of this work. There are patterns
the android team explicitly does not want apps to use and apis that have
no equivalent.

As part of the effort to ensure this work does not slip into ai slop,
prs from this stack will be reviewed by me (@reidbaker) before asking
for review. Then we will have 2 android expert reviewers also review the
every pr.

---
Agent authored pr description
This is PR 1 of 11 in the AGP 9.1.0 / public `gradle-api` migration
stack.

It adds the contributor-facing and website draft documentation for the
Flutter Gradle Plugin's migration to the Android Gradle Plugin public
Variant API, which unblocks building Flutter Android apps with AGP's
`newDsl=true` enabled.

Part of flutter#180137 and flutter#166550.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: reidbaker-agent <reidbaker@google.com>
okorohelijah pushed a commit to okorohelijah/flutter that referenced this pull request Aug 17, 2026
…90957)

This is PR 2 of 11 in the AGP 9.1.0 / public `gradle-api`/ newdls
migration stack.

This PR extracts some common utilities used in the Flutter Gradle Plugin
to internal functions, to be used in upcoming PRs in this stack. It also
introduces a typesafe CompileSdkVersion that handles comparisons between
api versions and preview versions which are strings.

First attempt was here flutter#190949
this pr includes my feedback from that first review. The first attempt
did not follow the pattern of having the agent account open the pr
because of rebase shenanigans that ended up touching freeze.yml.

---
Standard review context for this pr stack

This is PR is part of an 11 pr stack to migrate the "newdsl"
`gradle-api` specifically in agp 9.1.0.
The complete stack has pass pre submits, post submits and customer
tests.
https://flutter-dashboard.appspot.com/#/build?repo=flutter&branch=experimental/agp-gradle-api

All of the code was LLM authored. A mix of manual prompting, automatic
prompting, several models and adversarial review. The combined sessions
are enough that I cannot include relevant prompts like I have been doing
on other prs.

If you want to review the pr stack you can find it here. These prs will
be abandoned/closed as prs land into flutter/flutter.
1. reidbaker-agent#1 (branch:
agp-api-doc)
2. reidbaker-agent#2 (branch:
agp-internal-utils)
3. reidbaker-agent#3 (branch:
agp-buildmode-deps)
4. reidbaker-agent#4 (branch:
agp-plugin-buildtypes)
5. reidbaker-agent#5 (branch:
agp-ndk-fallback)
6. reidbaker-agent#6 (branch:
agp-assets-onvariants)
7. reidbaker-agent#7 (branch:
agp-apk-copy-versioncode)
8. reidbaker-agent#8 (branch:
agp-add-to-app)
9. reidbaker-agent#9 (branch:
agp-aar-script)
10. reidbaker-agent#10 (branch:
agp-newdsl-flip)
11. reidbaker-agent#11 (branch:
agp-gradle-api)

This work is urgent in the sense that we are worried that android will
publish agp 10 with no opt out but not so urgent that we are willing to
break flutter users because we didn't review or understand the code
because we were in a rush.

Breaking changes are expected as part of this work. There are patterns
the android team explicitly does not want apps to use and apis that have
no equivalent.

As part of the effort to ensure this work does not slip into ai slop,
prs from this stack will be reviewed by me (@reidbaker) before asking
for review. Then we will have 2 android expert reviewers also review the
every pr.

--- 
Agent authored description. 
This is PR 2 of 11 in the AGP 9.1.0 / public `gradle-api` migration
stack.

This PR extracts some common utilities used in the Flutter Gradle Plugin
to internal functions, to be used in upcoming PRs in this stack.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: reidbaker-agent <reidbaker@google.com>
Co-authored-by: Reid Baker <1063596+reidbaker@users.noreply.github.com>
…r#191480)

flutter/packages@1785501...252bb33

2026-08-20 pateltirth454@gmail.com [material_ui] A typo in the README
file of the package. (flutter/packages#12526)
2026-08-20 jmccandless@google.com [material_ui] Animated theme test from
flutter/flutter (flutter/packages#12487)
2026-08-20 fluttergithubbot@gmail.com Sync release-material_ui-1.0.1 to
main (flutter/packages#12513)
2026-08-20 pateltirth454@gmail.com [material_ui] [cupertino_ui] Add
missing Widget of the Week videos to widget API docs
(flutter/packages#12468)
2026-08-20 43054281+camsim99@users.noreply.github.com
[camera_android_camerax] Add agentic guidance for adding native unit
tests (flutter/packages#12369)
2026-08-20 21270878+elliette@users.noreply.github.com [material_ui]
SearchAnchor overlay expands to full screen when viewport size changes
(flutter/packages#12466)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…1481)

https://skia.googlesource.com/skia.git/+log/70988bed1b3b..f6900c5b8439

2026-08-21 thomsmit@google.com [graphite] Add sparse strips coverage
oracle
2026-08-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll
vulkan-deps from 71c3f1723099 to 3cc0a5d1905e (3 revisions)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/skia-flutter-autoroll
Please CC
awolff@google.com,kjlubick@google.com,robertphillips@google.com on the
revert to ensure that a human
is aware of the problem.

To file a bug in Skia: https://bugs.chromium.org/p/skia/issues/entry
To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…flutter#191358)

## Description

This PR formally deprecates the \`--build\` and \`--no-build\` flags on
\`flutter run\` in favor of \`--use-application-binary\`, aligning
\`flutter run\` with \`flutter drive\` (which previously deprecated
\`--build\`).

### Context & Changes
* In 2019 ([flutter#37735](flutter#37735)),
\`flutter run\` stopped handling the \`build\` flag when
\`--use-application-binary\` was added, but the flag definition was
unintentionally left on \`argParser\`, causing it to remain in
\`--help\` as a silent no-op.
* Rather than restoring implicit build-skipping behavior (which
introduces ambiguity regarding which derived artifact to run across
build flavors, split APKs, and schemes), we deprecate \`--[no-]build\`
and direct users to \`--use-application-binary\`.
* Hides \`--build\` from standard \`flutter run -h\` output (\`hide:
!verboseHelp\`).
* Emits a deprecation warning when \`--build\` or \`--no-build\` is
passed.
* Adds hermetic unit tests in \`run_test.dart\` for the deprecation
warnings.

## Related Issues
Fixes flutter#68529

## Tests
- Added hermetic unit tests in
\`packages/flutter_tools/test/commands.shard/hermetic/run_test.dart\`
verifying warning triggers and default execution.
- Verified \`packages/flutter_tools/test/general.shard/args_test.dart\`
passes.
…pansion tile (flutter#191378)

## Description

When a preview group is collapsed and re-expanded in the Widget
Previewer, descendant scrollables (which search ancestor elements for a
`PageStorageKey` when restoring scroll offset) inherit the
`PageStorageKey` from the `ExpansionTile`. They then attempt to read the
`ExpansionTile`'s boolean expansion state as a double, throwing a
`TypeError: true: type 'bool' is not a subtype of type 'double?'`.

This PR wraps the `ExpansionTile` children in a `PageStorage` widget
with a new `PageStorageBucket`, preventing descendant scrollable widgets
from inheriting the `ExpansionTile`'s `PageStorageKey`.

## Related Issues
Fixes flutter#191242

## Tests
- Tested in widget preview scaffold template.
…... (flutter#191485)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/fuchsia-linux-sdk-flutter
Please CC awolff@google.com,zra@google.com on the revert to ensure that
a human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…ader.dart (flutter#191451)

Moves `CkFragmentProgram`, `CkFragmentShader`, and uniform slot classes
from `canvaskit/painting.dart` to `canvaskit/fragment_shader.dart` to
decouple fragment shader compilation from paint descriptor logic in
preparation for `ui.Paint` unification.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…tion (flutter#191263)

Extract the downloaded Dart SDK zip/tar into a temporary staging
directory first, and only move/rename it to `bin/cache/dart-sdk` once
extraction succeeds.

This prevents the cache directory from being left in a partially
populated or corrupted state if download or extraction is interrupted.

Fixes flutter#15552

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
walley892 and others added 13 commits August 24, 2026 11:23
Move all non-squarelike non-symmetric RoundSuperellipse rendering to
complex_rse.frag. See discussion in
flutter#190874
)

https://skia.googlesource.com/skia.git/+log/50452b13f05b..57968d087d18

2026-08-24 skia-autoroll@skia-public.iam.gserviceaccount.com Manual roll
Dawn from 01af1ad339cb to 55d132a23849 (7 revisions)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/skia-flutter-autoroll
Please CC awolff@google.com,fmalita@google.com,kjlubick@google.com on
the revert to ensure that a human
is aware of the problem.

To file a bug in Skia: https://bugs.chromium.org/p/skia/issues/entry
To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…er#191574)

https://dart.googlesource.com/sdk.git/+log/cb056da580b6..78bbc37b6ff6

2026-08-24 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-160.0.dev
2026-08-22 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-159.0.dev
2026-08-22 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-158.0.dev
2026-08-21 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-157.0.dev
2026-08-21 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-156.0.dev
2026-08-21 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-155.0.dev
2026-08-21 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-154.0.dev
2026-08-21 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-153.0.dev
2026-08-20 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-152.0.dev
2026-08-20 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-151.0.dev
2026-08-20 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-150.0.dev
2026-08-20 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-149.0.dev
2026-08-20 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com
Version 3.14.0-148.0.dev

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dart-sdk-flutter
Please CC awolff@google.com,dart-vm-team@google.com on the revert to
ensure that a human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#191578)

flutter/packages@252bb33...df2ba94

2026-08-24 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump org.json:json from 20260719 to 20260814 in
/packages/in_app_purchase/in_app_purchase_android/example/android/app
(flutter/packages#12570)
2026-08-22 engine-flutter-autoroll@skia.org Roll Flutter from
c243752 to 65c9a8d (195 revisions) (flutter/packages#12554)
2026-08-21 tarrinneal@gmail.com [pigeon] add modern concurrency support
(flutter/packages#12382)
2026-08-21 32538273+ValentinVignal@users.noreply.github.com
[material_ui] Remove no-shuffle in scrollbar test
(flutter/packages#12527)
2026-08-21 32538273+ValentinVignal@users.noreply.github.com
[material_ui] Remove no-shuffle from dropdown test
(flutter/packages#12528)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
)

https://skia.googlesource.com/skia.git/+log/57968d087d18..698c60bf58f1

2026-08-24 jmbetancourt@google.com [Dawn] Isolate DRMUtils to its own
file list that doesn't get built

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/skia-flutter-autoroll
Please CC awolff@google.com,fmalita@google.com,kjlubick@google.com on
the revert to ensure that a human
is aware of the problem.

To file a bug in Skia: https://bugs.chromium.org/p/skia/issues/entry
To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Adds a `--force` (`-f`) flag to `flutter channel` to allow switching
channels even when local SDK modifications or untracked changes exist,
matching `flutter upgrade` behavior.

Fixes flutter#191262

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]: https://discord.gg/rflutter
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
Rolls Dart native asset packages (`code_assets`, `hooks`,
`hooks_runner`, `native_toolchain_c`, `record_use`) to their latest
published releases.

### Package Rolls
| Package | Old Version | New Version |
| :--- | :--- | :--- |
| `package:code_assets` | `1.2.1` | `2.0.0` |
| `package:hooks` | `2.1.0` | `2.2.0` |
| `package:hooks_runner` | `1.6.1` | `1.6.2` |
| `package:native_toolchain_c` | `0.19.3` | `0.19.4` |
| `package:record_use` | `1.1.0` | `1.1.1` |
| `package:objective_c` (transitively) | `9.4.1` | `9.6.0` |

Migration changes:

* **`package:code_assets` v2.0.0**: Overrides `==` and `hashCode` in
`OS`, `Architecture`, and `Sanitizer` to support custom targets. Because
these objects no longer have primitive equality, they cannot be used as
keys or elements in `const` collections. Migrated `const _osTargets` in
[`native_assets.dart`](file:///Users/dacoharkes/src/flutter/flutter/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart#L1009)
to a `final Map` with runtime set literals.
* **`package:hooks` v2.2.0 (`HookInput` eager directory creation & test
context updates)**: In `package:hooks` v2.2.0, reading
`HookInput.outputDirectory` eagerly calls `.createSync(recursive: true)`
on the target directory. When `FakeFlutterNativeAssetsBuildRunner`
instantiates `BuildInput` in isolated unit tests, this now touches disk
during hook checks:
* **Filesystem Safety Guard Symlink Resolution (`fs_safety.dart`)**: On
macOS, creating subdirectories under `/var/folders/...` triggered
false-positive filesystem guard violations (`FileSystemException`).
Flutter's `fs_safety.dart` failed to recognize allowed temp paths
because calling `.resolveSymbolicLinksSync()` on paths whose leaf
directories did not exist yet threw `PathNotFoundException`, leaving
`/var` unresolved to `/private/var`. Added `_canonicalizeWithSymlinks`
in
[`fs_safety.dart`](file:///Users/dacoharkes/src/flutter/flutter/packages/flutter_tools/test/src/fs_safety.dart#L40-L55)
to walk up parent directories and resolve symlinks for non-existent
target paths.
* **Test Context Overrides**: Added missing `FeatureFlags: () =>
TestFeatureFlags(...)` context overrides and `fakes.dart` imports to
isolated native asset unit tests (`android`, `ios`, `macos`, `windows`).
Without in-memory feature flag mocks, checking `featureFlags` in
`_hookRunRequired` initializes `globals.config`, which attempts to
create `.flutter_settings` folders on disk and collides with
`testUsingContext`'s filesystem guard.
…om member package (flutter#190952)

When `flutter widget-preview start` is run from a member package in a
pub workspace, redirect `getRootProject()` to the workspace root
`FlutterProject`. This ensures that the widget preview scaffold is
generated at the workspace root and has dependency overrides for all
member packages in the workspace.

Fixes flutter#190692
…ogger initialization (flutter#191442)

## Description

`executable.dart` checked `args.contains('daemon')` and
`args.contains(WidgetPreviewCommand.kWidgetPreview)` to configure the
logger. When running commands where 'daemon' was supplied as an argument
(such as `flutter create daemon`), this caused `NotifyingLogger` to be
initialized instead of standard loggers, silencing command output.

Use `commandName` from `findCommandName(args)` to accurately detect if
the command is `daemon` or `widget-preview`.

## Related Issues
Fixes flutter#75876

## Tests
- Added unit test to
`packages/flutter_tools/test/general.shard/executable_test.dart`
- Added integration test to
`packages/flutter_tools/test/integration.shard/command_output_test.dart`
…MaterialFonts (flutter#191494)

When artifact version files (such as
`bin/internal/material_fonts.version`) are missing or cannot be
resolved, `CachedArtifact.version` evaluates to `null`. Previously,
`CachedArtifact.update` invoked `updateInner` before checking if
`version` was `null`, causing `MaterialFonts.updateInner` (and other
artifact subclasses) to evaluate `version!` and throw an unhandled
`TypeError` / `_CastError` with `Null check operator used on a null
value`.

This change:
1. Returns early with a warning in `CachedArtifact.update` before
attempting `updateInner` or writing stamps when `version == null`.
2. Guards against `version == null` in `MaterialFonts`, `GradleWrapper`,
and `FlutterRunnerDebugSymbols`.
3. Adds an automated regression test in `cache_test.dart`.

Fixes flutter#90092
…acOS (flutter#191180)

Fixes flutter#191176

### Problem
In Flutter 3.47.0 telemetry, an unhandled `ProcessException` when
invoking `xcodebuild` emerged as a top crash signature. When running
`flutter build macos` on a machine where Xcode is not installed,
incomplete, or misconfigured, `flutter_tools` crashes with an unhandled
`ProcessException` instead of providing a graceful `ToolExit` error
message.

### Root Cause
1. `buildMacOS` in
`packages/flutter_tools/lib/src/macos/build_macos.dart` lacked
pre-flight toolchain validation
(`globals.xcodeProjectInterpreter?.isInstalled != true`) before querying
Xcode project information.
2. In `XcodeProjectInterpreter.getInfo`
(`packages/flutter_tools/lib/src/ios/xcodeproj.dart`), `xcodebuild
-list` is executed with `throwOnError: true` while only allowing exit
codes 66 and 74. When `xcrun` returns exit code 72 (unable to find
utility "xcodebuild"), `_processUtils.run` throws an uncaught
`ProcessException`.
3. `buildMacOS` improperly used non-null assertions on `projectInfo!`
when resolving build schemes.

### Fix
- Added pre-flight Xcode toolchain check in `buildMacOS` to exit early
with `globals.userMessages.xcodeMissing`.
- Wrapped `XcodeProjectInterpreter.getInfo` in a `try ... on
ProcessException` block to convert unexpected process failures to
user-friendly `ToolExit` messages.
- Added safe null checks on `projectInfo` in `buildMacOS`.
On iOS 27+ devices, `lldb` sometimes doesn't stop on breakpoints when
auto-continue is enabled. To workaround this, we disable auto-continue
and manually process stops. If a stop is caused by a breakpoint, we tell
the process to continue. Otherwise, we print the backtrace and detach.

Fixes flutter#190307.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
@reidbaker
reidbaker force-pushed the agp-plugin-buildtypes branch from a68c691 to 4aa474b Compare August 24, 2026 19:52
reidbaker pushed a commit that referenced this pull request Aug 24, 2026
…With on the public DSL

- PluginHandler no longer imports com.android.build.gradle.internal.dsl.BuildType.
  The build-type copy block that shared live legacy BuildType instances
  (addAll) for app-type plugin projects and hand-copied two properties
  for library plugin projects is replaced by a single initWith-based
  copy on the public DSL containers: missing build types are created on
  the plugin project with initWith(appBuildType) (which carries
  matchingFallbacks), and isDebuggable is additionally copied when both
  sides are application build types. Library build types cannot receive
  app-specific properties through the public DSL - this is a documented
  behavior change of the migration.
- Production sources are now free of com.android.build.gradle.internal
  imports; InternalAgpApiImportTest locks that in.
- PluginHandlerTest: replaced legacy mock-only copy tests with tests
  that run configurePlugins and assert the initWith copy for both library
  and app plugin projects, including the custom-debuggable-build-type ->
  debug engine artifact mapping and skipping pre-existing build types.
- Updated documentation with P3 pre-spike and finalizeDsl fallback details.
…With on the public DSL

- PluginHandler no longer imports com.android.build.gradle.internal.dsl.BuildType.
  The build-type copy block that shared live legacy BuildType instances
  (addAll) for app-type plugin projects and hand-copied two properties
  for library plugin projects is replaced by a single initWith-based
  copy on the public DSL containers: missing build types are created on
  the plugin project with initWith(appBuildType) (which carries
  matchingFallbacks), and isDebuggable is additionally copied when both
  sides are application build types. Library build types cannot receive
  app-specific properties through the public DSL - this is a documented
  behavior change of the migration.
- Production sources are now free of com.android.build.gradle.internal
  imports; InternalAgpApiImportTest locks that in.
- PluginHandlerTest: replaced legacy mock-only copy tests with tests
  that run configurePlugins and assert the initWith copy for both library
  and app plugin projects, including the custom-debuggable-build-type ->
  debug engine artifact mapping and skipping pre-existing build types.
- Updated documentation with P3 pre-spike and finalizeDsl fallback details.
@reidbaker
reidbaker force-pushed the agp-plugin-buildtypes branch from 4aa474b to 9ad1211 Compare August 24, 2026 19:56
@reidbaker

Copy link
Copy Markdown
Collaborator

closed in favor of flutter#191606

@reidbaker reidbaker closed this Aug 24, 2026
reidbaker pushed a commit that referenced this pull request Aug 24, 2026
…With on the public DSL

- PluginHandler no longer imports com.android.build.gradle.internal.dsl.BuildType.
  The build-type copy block that shared live legacy BuildType instances
  (addAll) for app-type plugin projects and hand-copied two properties
  for library plugin projects is replaced by a single initWith-based
  copy on the public DSL containers: missing build types are created on
  the plugin project with initWith(appBuildType) (which carries
  matchingFallbacks), and isDebuggable is additionally copied when both
  sides are application build types. Library build types cannot receive
  app-specific properties through the public DSL - this is a documented
  behavior change of the migration.
- Production sources are now free of com.android.build.gradle.internal
  imports; InternalAgpApiImportTest locks that in.
- PluginHandlerTest: replaced legacy mock-only copy tests with tests
  that run configurePlugins and assert the initWith copy for both library
  and app plugin projects, including the custom-debuggable-build-type ->
  debug engine artifact mapping and skipping pre-existing build types.
- Updated documentation with P3 pre-spike and finalizeDsl fallback details.
reidbaker pushed a commit that referenced this pull request Aug 24, 2026
…With on the public DSL

- PluginHandler no longer imports com.android.build.gradle.internal.dsl.BuildType.
  The build-type copy block that shared live legacy BuildType instances
  (addAll) for app-type plugin projects and hand-copied two properties
  for library plugin projects is replaced by a single initWith-based
  copy on the public DSL containers: missing build types are created on
  the plugin project with initWith(appBuildType) (which carries
  matchingFallbacks), and isDebuggable is additionally copied when both
  sides are application build types. Library build types cannot receive
  app-specific properties through the public DSL - this is a documented
  behavior change of the migration.
- Production sources are now free of com.android.build.gradle.internal
  imports; InternalAgpApiImportTest locks that in.
- PluginHandlerTest: replaced legacy mock-only copy tests with tests
  that run configurePlugins and assert the initWith copy for both library
  and app plugin projects, including the custom-debuggable-build-type ->
  debug engine artifact mapping and skipping pre-existing build types.
- Updated documentation with P3 pre-spike and finalizeDsl fallback details.
pull Bot pushed a commit to TheRakeshPurohit/flutter that referenced this pull request Aug 24, 2026
…dependencies through the new DSL (flutter#191218)

This is PR 3 of 11 in the AGP 9.1.0 / public `gradle-api`/ newdsl
migration stack.

* It migrates many (but not all) usages of getLegacyAndroidExtension. 
* Introduces consistency in renaming of imports. 
* Adds a test to ensure we are not adding internal apis (thanks
@mboetger from pr1)
* builds the ability to run our gradle tests with multiple AGP versions
(see packages/flutter_tools/gradle/build.gradle.kts)

Between PR 3 and PR 8, an Add-to-app host app embedding a Flutter module
with a custom build type (for example "staging") gets release engine
artifacts. That means hot reload, debugger attach, and DevTools do not
operate in that build.
We can't move the work in PR 8 up but I would not want to cut a release
between this pr and 8 landing. If we keep reviewing one pr a day then
that is not a risk.

Apps impacted by this change can use matchingFallbacks to avoid this
problem (see code below).

In pr 8 we change when we look for "isDebuggable" to much later in the
gradle lifeycle when all the variants have been created which then lets
us use a new api to understand if the variant is intended to be
debuggable.

Kotlin 
```kotlin
// host app build.gradle.kts
android {
    buildTypes {
        create("staging") {
            isDebuggable = true
            applicationIdSuffix = ".staging"
            matchingFallbacks += "debug" /// This line. 
        }
    }
}
```
Groovy 
```groovy
// host app build.gradle
android {
    buildTypes {
        staging {
            debuggable true
            applicationIdSuffix ".staging"
            matchingFallbacks = ['debug'] /// This line. 
        }
    }
}
```

Depends on flutter#190957 (PR 2).
- @reidbaker 


---
Standard review context for this pr stack

This is PR is part of an 11 pr stack to migrate the "newdsl"
`gradle-api` specifically in agp 9.1.0.
The complete stack has passed presubmits, postsubmits, and customer
tests:
https://flutter-dashboard.appspot.com/#/build?repo=flutter&branch=experimental/agp-gradle-api

All of the code was LLM authored. A mix of manual prompting, automatic
prompting, several models and adversarial review. The combined sessions
are enough that I cannot include relevant prompts like I have been doing
on other prs.

If you want to review the pr stack you can find it here. These prs will
be abandoned/closed as prs land into flutter/flutter.
1. reidbaker-agent#1 (branch:
agp-api-doc)
2. reidbaker-agent#2 (branch:
agp-internal-utils)
3. reidbaker-agent#3 (branch:
agp-buildmode-deps)
4. reidbaker-agent#4 (branch:
agp-plugin-buildtypes)
5. reidbaker-agent#5 (branch:
agp-ndk-fallback)
6. reidbaker-agent#6 (branch:
agp-assets-onvariants)
7. reidbaker-agent#7 (branch:
agp-apk-copy-versioncode)
8. reidbaker-agent#8 (branch:
agp-add-to-app)
9. reidbaker-agent#9 (branch:
agp-aar-script)
10. reidbaker-agent#10 (branch:
agp-newdsl-flip)
11. reidbaker-agent#11 (branch:
agp-gradle-api)

This work is urgent in the sense that we are worried that android will
publish agp 10 with no opt out but not so urgent that we are willing to
break flutter users because we didn't review or understand the code
because we were in a rush.

Breaking changes are expected as part of this work. There are patterns
the android team explicitly does not want apps to use and apis that have
no equivalent.

As part of the effort to ensure this work does not slip into ai slop,
prs from this stack will be reviewed by me (@reidbaker) before asking
for review. Then we will have 2 android expert reviewers also review
every pr.

--- 
Agent authored description. 
This is PR 3 of 11 in the AGP 9.1.0 / public `gradle-api` migration
stack (flutter#180137, flutter#166550).

### Key Changes
- **DSL Build Mode Overloads**: Adds `buildModeFor` overloads accepting
`ApplicationBuildType`, `DynamicFeatureBuildType`, and
`LibraryBuildType` DSL types alongside the `(buildTypeName,
isDebuggable)` core overload.
- **Robust CompileSdkVersion Domain Model**: Extracts
`CompileSdkVersion` with constructor invariant validation (`init {
require(...) }`) enforcing mutual exclusivity between `apiLevel` and
`previewCodename`.
- **Namespaced Multi-AGP Build Property**: Namespaces the AGP version
property in `packages/flutter_tools/gradle/build.gradle.kts` as
`flutter.internal.agpVersion` (defaulting to `8.11.1`) to prevent user
app properties from leaking into the included build during app
compilation.
- **Standardized Type Aliasing**: Applies non-temporal type aliasing
(`import com.android.build.api.dsl.BuildType as DslBuildType`) across
`FlutterPlugin.kt` and `PluginHandler.kt`.
- **Public DSL Extension Access**: Updates `addFlutterDependencies` and
`PluginHandler` to iterate `AgpCommonExtensionWrapper.buildTypes`.
- **Build & Bytecode Validation**: Adds the
`:validateNoCommonExtensionInBytecode` task in `build.gradle.kts` to
prevent compiled main classes from referencing binary-incompatible
`CommonExtension`, and adds `BytecodeValidatorTest.kt` verifying the
binary pattern-matching and class scanning logic.
- **Comprehensive Unit Tests**: Adds full 4-way dispatch test coverage
in `AgpCommonExtensionWrapperTest`, dependency wiring tests in
`FlutterPluginTest`, and decomposes `PluginHandlerTest` mock fixtures
into focused helpers with positive assertions.

### Add-to-App & DSL Scope Context
`LibraryBuildType` does not expose `isDebuggable` at DSL scope. In PR 3,
custom build types on library projects (e.g. host app 'staging') fall
back to `"release"` at DSL scope. In PR 8 ("Unify add-to-app module
wiring on the variant API"), module wiring will be unified on
`Component.debuggable` at variant scope.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: reidbaker-agent <reidbaker@google.com>
Co-authored-by: Reid Baker <1063596+reidbaker@users.noreply.github.com>
reidbaker pushed a commit that referenced this pull request Aug 25, 2026
…With on the public DSL

- PluginHandler no longer imports com.android.build.gradle.internal.dsl.BuildType.
  The build-type copy block that shared live legacy BuildType instances
  (addAll) for app-type plugin projects and hand-copied two properties
  for library plugin projects is replaced by a single initWith-based
  copy on the public DSL containers: missing build types are created on
  the plugin project with initWith(appBuildType) (which carries
  matchingFallbacks), and isDebuggable is additionally copied when both
  sides are application build types. Library build types cannot receive
  app-specific properties through the public DSL - this is a documented
  behavior change of the migration.
- Production sources are now free of com.android.build.gradle.internal
  imports; InternalAgpApiImportTest locks that in.
- PluginHandlerTest: replaced legacy mock-only copy tests with tests
  that run configurePlugins and assert the initWith copy for both library
  and app plugin projects, including the custom-debuggable-build-type ->
  debug engine artifact mapping and skipping pre-existing build types.
- Updated documentation with P3 pre-spike and finalizeDsl fallback details.
reidbaker pushed a commit that referenced this pull request Aug 25, 2026
…With on the public DSL

- PluginHandler no longer imports com.android.build.gradle.internal.dsl.BuildType.
  The build-type copy block that shared live legacy BuildType instances
  (addAll) for app-type plugin projects and hand-copied two properties
  for library plugin projects is replaced by a single initWith-based
  copy on the public DSL containers: missing build types are created on
  the plugin project with initWith(appBuildType) (which carries
  matchingFallbacks), and isDebuggable is additionally copied when both
  sides are application build types. Library build types cannot receive
  app-specific properties through the public DSL - this is a documented
  behavior change of the migration.
- Production sources are now free of com.android.build.gradle.internal
  imports; InternalAgpApiImportTest locks that in.
- PluginHandlerTest: replaced legacy mock-only copy tests with tests
  that run configurePlugins and assert the initWith copy for both library
  and app plugin projects, including the custom-debuggable-build-type ->
  debug engine artifact mapping and skipping pre-existing build types.
- Updated documentation with P3 pre-spike and finalizeDsl fallback details.
reidbaker pushed a commit that referenced this pull request Aug 25, 2026
…With on the public DSL

- PluginHandler no longer imports com.android.build.gradle.internal.dsl.BuildType.
  The build-type copy block that shared live legacy BuildType instances
  (addAll) for app-type plugin projects and hand-copied two properties
  for library plugin projects is replaced by a single initWith-based
  copy on the public DSL containers: missing build types are created on
  the plugin project with initWith(appBuildType) (which carries
  matchingFallbacks), and isDebuggable is additionally copied when both
  sides are application build types. Library build types cannot receive
  app-specific properties through the public DSL - this is a documented
  behavior change of the migration.
- Production sources are now free of com.android.build.gradle.internal
  imports; InternalAgpApiImportTest locks that in.
- PluginHandlerTest: replaced legacy mock-only copy tests with tests
  that run configurePlugins and assert the initWith copy for both library
  and app plugin projects, including the custom-debuggable-build-type ->
  debug engine artifact mapping and skipping pre-existing build types.
- Updated documentation with P3 pre-spike and finalizeDsl fallback details.
reidbaker pushed a commit that referenced this pull request Aug 25, 2026
…With on the public DSL

- PluginHandler no longer imports com.android.build.gradle.internal.dsl.BuildType.
  The build-type copy block that shared live legacy BuildType instances
  (addAll) for app-type plugin projects and hand-copied two properties
  for library plugin projects is replaced by a single initWith-based
  copy on the public DSL containers: missing build types are created on
  the plugin project with initWith(appBuildType) (which carries
  matchingFallbacks), and isDebuggable is additionally copied when both
  sides are application build types. Library build types cannot receive
  app-specific properties through the public DSL - this is a documented
  behavior change of the migration.
- Production sources are now free of com.android.build.gradle.internal
  imports; InternalAgpApiImportTest locks that in.
- PluginHandlerTest: replaced legacy mock-only copy tests with tests
  that run configurePlugins and assert the initWith copy for both library
  and app plugin projects, including the custom-debuggable-build-type ->
  debug engine artifact mapping and skipping pre-existing build types.
- Updated documentation with P3 pre-spike and finalizeDsl fallback details.
reidbaker pushed a commit that referenced this pull request Aug 25, 2026
…With on the public DSL

- PluginHandler no longer imports com.android.build.gradle.internal.dsl.BuildType.
  The build-type copy block that shared live legacy BuildType instances
  (addAll) for app-type plugin projects and hand-copied two properties
  for library plugin projects is replaced by a single initWith-based
  copy on the public DSL containers: missing build types are created on
  the plugin project with initWith(appBuildType) (which carries
  matchingFallbacks), and isDebuggable is additionally copied when both
  sides are application build types. Library build types cannot receive
  app-specific properties through the public DSL - this is a documented
  behavior change of the migration.
- Production sources are now free of com.android.build.gradle.internal
  imports; InternalAgpApiImportTest locks that in.
- PluginHandlerTest: replaced legacy mock-only copy tests with tests
  that run configurePlugins and assert the initWith copy for both library
  and app plugin projects, including the custom-debuggable-build-type ->
  debug engine artifact mapping and skipping pre-existing build types.
- Updated documentation with P3 pre-spike and finalizeDsl fallback details.
@reidbaker

Copy link
Copy Markdown
Collaborator

Closed in favor of flutter#191606

NikhilKukreja26 pushed a commit to NikhilKukreja26/flutter that referenced this pull request Aug 28, 2026
…nitWith on public DSL (flutter#191606)

This is PR 4 of 11 in the AGP 9.1.0 / public `gradle-api` / newdsl
migration stack.

There are no breaking changes expected in this pr. Only internal logic
is impacted.

I will be honest I also found the tests hard to review. I had the agent
pull out shared mocking logic but I am not sure that actually made
review easier.

Depends on flutter#191218 (PR 3).
- @reidbaker

---
Standard review context for this pr stack

This is PR is part of an 11 pr stack to migrate the "newdsl"
`gradle-api` specifically in agp 9.1.0.

All of the code was LLM authored. A mix of manual prompting, automatic
prompting, several models and adversarial review. The combined sessions
are enough that I cannot include relevant prompts like I have been doing
on other prs.

If you want to review the pr stack you can find it here. These prs will
be abandoned/closed as prs land into flutter/flutter.
1. reidbaker-agent#1 (branch:
agp-api-doc)
2. reidbaker-agent#2 (branch:
agp-internal-utils)
3. reidbaker-agent#3 (branch:
agp-buildmode-deps)
4. reidbaker-agent#4 (branch:
agp-plugin-buildtypes)
5. reidbaker-agent#5 (branch:
agp-ndk-fallback)
6. reidbaker-agent#6 (branch:
agp-assets-onvariants)
7. reidbaker-agent#7 (branch:
agp-apk-copy-versioncode)
8. reidbaker-agent#8 (branch:
agp-add-to-app)
9. reidbaker-agent#9 (branch:
agp-aar-script)
10. reidbaker-agent#10 (branch:
agp-newdsl-flip)
11. reidbaker-agent#11 (branch:
agp-gradle-api)

This work is urgent in the sense that we are worried that android will
publish agp 10 with no opt out but not so urgent that we are willing to
break flutter users because we didn't review or understand the code
because we were in a rush.

Breaking changes are expected as part of this work. There are patterns
the android team explicitly does not want apps to use and apis that have
no equivalent.

As part of the effort to ensure this work does not slip into ai slop,
prs from this stack will be reviewed by me (@reidbaker) before asking
for review. Then we will have 2 android expert reviewers also review
every pr.

---
Agent authored description.
This is PR 4 of 11 in the AGP 9.1.0 / public `gradle-api` migration
stack (flutter#180137, flutter#166550).

### Key Changes
- **Public DSL `initWith` Copy**: Replaces the legacy
`getLegacyAndroidExtension` build-type copy in `PluginHandler` with
`initWith` on the public DSL (`AgpCommonExtensionWrapper.buildTypes`).
Missing build types on the plugin project are created with
`initWith(appBuildType)`, and `isDebuggable` is copied when both sides
are `ApplicationBuildType`.
- **Zero AGP Internals in Production Sources**: Removes the last
remaining `com.android.build.gradle.internal` imports from production
code (`src/main`).
- **Internal AGP Import Guard**: Adds `InternalAgpApiImportTest` to
continuously enforce that production sources do not introduce
`com.android.build.gradle.internal.*` imports.
- **Decomposed & Robust Unit Tests**: Replaces legacy mock-only tests in
`PluginHandlerTest` with tests that execute `configurePlugins` and
verify `initWith` copying for both library and application plugin
projects, mapping custom debuggable build types to debug engine
artifacts, and verifying that pre-existing plugin build types are
skipped.
- **Migration Documentation Update**: Adds details for the P3 pre-spike
and `finalizeDsl` fallback in
`Migrating-Flutter-Gradle-Plugin-to-AGP-public-API.md`.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.