Skip to content

[material_ui] gen_defaults should follow new versioning strategy - #12627

Merged
auto-submit[bot] merged 2 commits into
flutter:mainfrom
elliette:port-pr-11918
Aug 26, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:mainfrom
elliette:port-pr-11918

Conversation

@elliette

Copy link
Copy Markdown
Member

Work towards flutter/flutter#191088

Ports over #11918 which landed on the m3e_migration feature branch.

Original PR description

Work towards flutter/flutter#186906
Work towards flutter/flutter#187899

Previously, the gen_defaults script generated the files in different directories based on whether or not the template was an M3 or M3E template. Since we are planning on using an variant enum instead of different libraries to separate M3 and M3E implementations, the gen_defaults script needs to be accordingly updated.

Pre-Review Checklist

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. 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.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

Work towards flutter/flutter#186906
Work towards flutter/flutter#187899

Previously, the `gen_defaults` script generated the files in different
directories based on whether or not the template was an M3 or M3E
template. Since we are planning on using an variant enum instead of
different libraries to separate M3 and M3E implementations, the
`gen_defaults` script needs to be accordingly updated.

**Before:**

```
lib/src/
├── button.dart                      ← Editable M3 parent file
├── material_3_expressive/
│   └── button.dart                  ← Editable M3E parent file
└── generated/
    ├── button_defaults.g.dart       ← Generated M3 part file
    └── material_3_expressive/
        └── button_defaults.g.dart   ← Generated M3E part file
```

**After:**

```
lib/src/
├── button.dart                              ← Editable M3/M3E parent file
└── generated/
    ├── button_m3_defaults.g.dart            ← Generated M3 part file
    └── button_m3e_defaults.g.dart           ← Generated M3E part file
```


The template now creates the generated class name as well, either
`M3NameDefaults` or `M3ENameDefaults` (e.g. `M3EButtonDefaults`).


## Pre-Review 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] page, which explains my
responsibilities.
- [x] I read and followed the [relevant style guides] and ran [the
auto-formatter].
- [x] I signed the [CLA].
- [x] The title of the PR starts with the name of the package surrounded
by square brackets, e.g. `[shared_preferences]`
- [x] I [linked to at least one issue that this PR fixes] in the
description above.
- [x] I followed [the version and CHANGELOG instructions], using
[semantic versioning] and the [repository CHANGELOG style], or I have
commented below to indicate which documented exception this PR falls
under[^1].
- [x] I updated/added any relevant documentation (doc comments with
`///`).
- [x] I added new tests to check the change I am making, or I have
commented below to indicate which [test exemption] this PR falls
under[^1].
- [ ] All existing and new tests are passing.


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

**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.

[^1]: Regular contributors who have demonstrated familiarity with the
repository guidelines only need to comment if the PR is not
auto-exempted by repo tooling.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/packages/blob/main/CONTRIBUTING.md
[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/master/docs/contributing/Tree-hygiene.md
[relevant style guides]:
https://github.com/flutter/packages/blob/main/CONTRIBUTING.md#style
[the auto-formatter]:
https://github.com/flutter/packages/blob/main/script/tool/README.md#format-code
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[linked to at least one issue that this PR fixes]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview
[the version and CHANGELOG instructions]:
https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#version-and-changelog-updates
[semantic versioning]:
https://dart.dev/tools/pub/versioning#semantic-versions
[repository CHANGELOG style]:
https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changelog-style
[test exemption]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#tests
@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Aug 25, 2026
@elliette elliette added the CICD Run CI/CD label Aug 25, 2026
@elliette
elliette marked this pull request as ready for review August 26, 2026 17:31
@elliette
elliette requested a review from QuncCccccc August 26, 2026 17:31
@elliette elliette changed the title gen_defaults should follow new versioning strategy [material_ui] gen_defaults should follow new versioning strategy Aug 26, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Material 3 and Material 3 Expressive defaults generator template structure, introducing dynamic class name generation, validation assertions, and updated file naming conventions. Tests are updated to cover both template types and new validation checks. A review comment suggests improving the robustness of resolving the Dart executable for formatting on Windows by checking Platform.resolvedExecutable before falling back to dart.bat or dart.

Comment thread packages/material_ui/tool/gen_defaults/templates/template.dart

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@elliette elliette added emergency Override tree-status signal (land even with closed tree), combine with the autosubmit label. autosubmit Merge PR when tree becomes green via auto submit App labels Aug 26, 2026
@flutter-dashboard

Copy link
Copy Markdown

Detected the emergency label.

If you add the autosubmit label, the bot will wait until all presubmits pass but ignore the tree status, allowing fixes for tree breakages while still validating that they don't break any existing presubmits.

The "Merge" button is also unlocked. To bypass presubmits as well as the tree status, press the GitHub "Add to Merge Queue".

@jtmcdole

Copy link
Copy Markdown
Member

Why was the emergency tag added to this PR?

@elliette

Copy link
Copy Markdown
Member Author

Why was the emergency tag added to this PR?

It contains a fix for a tree breakage caused by #12469 (discussed in offline chat with @bparrishMines who is the current gardener):

Shell: Generating file: /var/folders/f6/jg28msls2hs25knbvkwzbpqm00g9pd/T/gen_defaultsywOAUT/button_defaults.g.dart
Shell: Target parent file name: button.dart
Shell: File does not exist, creating it.
Shell: Generating contents...
Shell: Writing generated contents to /var/folders/f6/jg28msls2hs25knbvkwzbpqm00g9pd/T/gen_defaultsywOAUT/button_defaults.g.dart...
Shell: Formatting /var/folders/f6/jg28msls2hs25knbvkwzbpqm00g9pd/T/gen_defaultsywOAUT/button_defaults.g.dart...

Fix is the change to how we invoke the formatter in this PR: a50e83b

(For some reason, we are seeing post-submit failures for #12469 that weren't caught in the pre-submit checks. But that is a separate issue I'm looking into!)

danielleon-cmd pushed a commit to victogomez-cs/packages-fork that referenced this pull request Aug 27, 2026
…lutter#12627)

Work towards flutter/flutter#191088

**Ports over flutter#11918 which landed on the `m3e_migration` feature branch.**

### Original PR description

Work towards flutter/flutter#186906
Work towards flutter/flutter#187899

Previously, the `gen_defaults` script generated the files in different directories based on whether or not the template was an M3 or M3E template. Since we are planning on using an variant enum instead of different libraries to separate M3 and M3E implementations, the `gen_defaults` script needs to be accordingly updated.

## Pre-Review Checklist

**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.

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
bkonyi pushed a commit to bkonyi/flutter that referenced this pull request Aug 27, 2026
…r#191886)

flutter/packages@740f093...bd3cbc1

2026-08-26 [email protected] Roll Flutter from
9a82789 to 15d8908 (37 revisions) (flutter/packages#12619)
2026-08-26 [email protected] [google_maps_flutter] Convert simple
object controllers to Swift (flutter/packages#12618)
2026-08-26 [email protected] [material_ui]
`gen_defaults` should follow new versioning strategy
(flutter/packages#12627)
2026-08-25 [email protected] [material_ui]
Fixes analysis_options migration from calling `flutter pub get` on
pacakage (flutter/packages#12626)
2026-08-25 [email protected] [material_ui] Declare
Flutter SDK dependencies in the pubspec.yaml for tool/gen_defaults
(flutter/packages#12623)
2026-08-25 [email protected] [material_ui]
Set-up `tool/gen_defaults` sub-directory (flutter/packages#12469)
2026-08-25 [email protected] [google_maps_flutter] Convert
top-level classes to Swift in `_sdk*` packages (flutter/packages#12307)

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 [email protected] 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
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…lutter#12627)

Work towards flutter/flutter#191088

**Ports over flutter#11918 which landed on the `m3e_migration` feature branch.**

### Original PR description

Work towards flutter/flutter#186906
Work towards flutter/flutter#187899

Previously, the `gen_defaults` script generated the files in different directories based on whether or not the template was an M3 or M3E template. Since we are planning on using an variant enum instead of different libraries to separate M3 and M3E implementations, the `gen_defaults` script needs to be accordingly updated.

## Pre-Review Checklist

**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.

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
victorsanni added a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…lutter#12627)

Work towards flutter/flutter#191088

**Ports over flutter#11918 which landed on the `m3e_migration` feature branch.**

### Original PR description

Work towards flutter/flutter#186906
Work towards flutter/flutter#187899

Previously, the `gen_defaults` script generated the files in different directories based on whether or not the template was an M3 or M3E template. Since we are planning on using an variant enum instead of different libraries to separate M3 and M3E implementations, the `gen_defaults` script needs to be accordingly updated.

## Pre-Review Checklist

**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.

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD emergency Override tree-status signal (land even with closed tree), combine with the autosubmit label. p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants