Skip to content

gen_defaults should follow new versioning strategy#11918

Merged
elliette merged 6 commits into
flutter:m3e_migrationfrom
elliette:gen-defaults-followup
Jun 17, 2026
Merged

gen_defaults should follow new versioning strategy#11918
elliette merged 6 commits into
flutter:m3e_migrationfrom
elliette:gen-defaults-followup

Conversation

@elliette

@elliette elliette commented Jun 16, 2026

Copy link
Copy Markdown
Member

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

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

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 16, 2026
@elliette elliette requested a review from QuncCccccc June 16, 2026 22:42

@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 token template generation tool to support both Material 3 and Material 3 Expressive defaults. It introduces a public TokenTemplate class, dynamically generates class names based on the Material version, and adds assertions to ensure the generated contents define the expected class. The tests have been updated to cover both template types. Feedback suggests handling underscores in template names when generating class names to ensure they strictly adhere to the Dart UpperCamelCase style guide.

Comment thread packages/material_ui/tool/gen_defaults/templates/template.dart
@github-actions github-actions Bot added triage-framework Should be looked at in framework triage p: material_ui labels Jun 16, 2026
@elliette elliette marked this pull request as draft June 16, 2026 22:55
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 16, 2026
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 16, 2026
@elliette elliette marked this pull request as ready for review June 16, 2026 23:16

@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 TokenTemplate class to standardize template naming conventions using spaced, capitalized words, and automatically derives output filenames and class names for Material 3 and Material 3 Expressive defaults. It also adds assertions to validate the generated class names and template name formats, and updates the corresponding tests and test fixtures. Feedback on the pull request points out that using parentName in the part of directive will generate an invalid filename containing spaces and capitalization, and suggests using $snakeName.dart instead.

Comment thread packages/material_ui/tool/gen_defaults/templates/template.dart Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 16, 2026

@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! Thanks!

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 17, 2026
@elliette elliette merged commit 82410bd into flutter:m3e_migration Jun 17, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: material_ui triage-framework Should be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants