Skip to content

Conversation

@Markzipan
Copy link
Contributor

@Markzipan Markzipan commented Jan 12, 2024

Context:

DDC modules are abstractions over how libraries are loaded/updated. The entirety of google3 uses the DDC/legacy module system due to its flexibility extensibility over the other two (ES6 and AMD/RequireJS). Unifying DDC's module system saves us from duplicating work and will allow us to have finer grained control over how JS modules are loaded. This is a a prerequisite to features such as hot reload.

Overview:

This change plumbs a boolean flag through flutter_tools that switches between DDC (new) and AMD (current) modules. This mode is automatically applied when --extra-front-end-options=--dartdevc-module-format=ddc is specified alongside flutter run. Other important additions include:

  • Splitting Flutter artifacts between DDC and AMD modules
  • Adding unit tests for the DDC module system
  • Additional bootstrapper logic for the DDC module system

We don't expect to see any user-visible behavior or performance differences.

This is dependent on incoming module system support in DWDS and additional artifacts in the engine.

This is part of a greater effort to deprecate the AMD module system: dart-lang/sdk#52361

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jan 12, 2024
@christopherfujino
Copy link
Contributor

DDC modules are abstractions over how libraries are loaded/updated. The entirety of google3 uses the DDC/legacy module system due to its flexibility extensibility over the other two (ES6 and AMD/RequireJS).

This change plumbs a boolean flag through flutter_tools that switches between DDC (new) and AMD (current) modules.

Between these two statements I'm already confused. So does "DDC" refer to the new or the old?

@christopherfujino
Copy link
Contributor

It seems like DDC is new, and AMD is old/legacy. And so, does that mean Google internally uses the new DDC system, and Flutter on GitHub uses the old system, so you're introducing the new module system here, gated by a flag, so that we can unify the ecosystem?

@Markzipan
Copy link
Contributor Author

Sorry about the confusion - here's some clarification. DDC (our web development compiler) has three module systems:

  • AMD/RequireJS - uses require.js modules
  • DDC/Legacy - uses a custom load strategy
  • ES6 - uses native ES6 import/export

In today's world, google3 uses the DDC/legacy module system, but the external world (including flutter web) generally uses the AMD system. We're trying to unify this by migrating all major platforms to the ddc/legacy module system since it's much more configurable.

This change introduces the DDC/legacy module system to external flutter web ecosystem and locks it behind an "automatic" flag - with a goal to deprecate the AMD/requireJS module system.

@parlough
Copy link
Member

parlough commented Jan 16, 2024

Thanks for the clarification Mark!

I think part of the confusion (at least for me) is that you refer to the system you are migrating the various tools to as "/Legacy". Perhaps drop that terminology where possible (and deprecate it elsewhere) and just call it the "DDC module system"? Outside of the web compiler and dev tooling teams, I'm not sure anyone else will be that familiar with the "legacy" term anyway.

@Markzipan
Copy link
Contributor Author

No problem! I dislike the terminology as well - especially since 'legacy' can mean legacy types (non-nullability context). "DDC module system" is the accepted name, and I have some ongoing work to rename this everywhere.

@christopherfujino
Copy link
Contributor

No problem! I dislike the terminology as well - especially since 'legacy' can mean legacy types (non-nullability context). "DDC module system" is the accepted name, and I have some ongoing work to rename this everywhere.

Thanks, this makes sense.

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

Overall this seems reasonable--my main request is to add a top level tool option for ddc-module-format.

Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

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

Much less scary now, I found a small syntax error in CSS ;)

Let me ping the whole web team so they're aware this is a-comin'!

Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

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

Small indentation issue (I think I got them all).

@ditman
Copy link
Member

ditman commented Feb 8, 2024

I can't add any more insight into this PR. I've pinged the rest of the web team for them to take a look, if they can!

Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

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

Still LGTM!

@ditman
Copy link
Member

ditman commented Feb 24, 2024

Hey @christopherfujino, do you mind skimming this again? This looks ready to land!

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

LGTM!

@christopherfujino christopherfujino added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 24, 2024
@auto-submit auto-submit bot merged commit ee94fe2 into flutter:master Feb 24, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 24, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Feb 24, 2024
flutter/flutter@39585e6...f6c1082

2024-02-24 [email protected] Roll Flutter Engine from 81035b7d56ef to 1d7d5e613d7e (1 revision) (flutter/flutter#144085)
2024-02-24 [email protected] Roll Flutter Engine from a148bdb63740 to 81035b7d56ef (2 revisions) (flutter/flutter#144083)
2024-02-24 [email protected] Roll Flutter Engine from 3c036c081534 to a148bdb63740 (1 revision) (flutter/flutter#144077)
2024-02-24 [email protected] Roll Flutter Engine from 738042295f97 to 3c036c081534 (2 revisions) (flutter/flutter#144073)
2024-02-24 [email protected] Roll Flutter Engine from ca2452074a49 to 738042295f97 (4 revisions) (flutter/flutter#144071)
2024-02-24 [email protected] Roll Flutter Engine from 9409b75e8f35 to ca2452074a49 (2 revisions) (flutter/flutter#144068)
2024-02-24 [email protected] Adding support for DDC modules when running Flutter Web in debug mode (flutter/flutter#141423)
2024-02-24 [email protected] Roll Flutter Engine from 733163c4e5d7 to 9409b75e8f35 (1 revision) (flutter/flutter#144061)
2024-02-23 [email protected] allow optional direct injection of Config instance into DevFS (flutter/flutter#144002)
2024-02-23 [email protected] Enable asset transformation for `flutter build` for iOS, Android, Windows, MacOS, Linux, and web (also `flutter run` without hot reload support) (flutter/flutter#143815)
2024-02-23 [email protected] Roll Flutter Engine from 5d1c0d4dc327 to 733163c4e5d7 (1 revision) (flutter/flutter#144058)
2024-02-23 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.24.4 to 3.24.5 (flutter/flutter#144059)
2024-02-23 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 4.0.1 to 4.0.2 (flutter/flutter#144060)
2024-02-23 [email protected] Render the warm up frame in a proper rendering process (flutter/flutter#143290)
2024-02-23 [email protected] Roll Flutter Engine from fbc9b889aee9 to 5d1c0d4dc327 (2 revisions) (flutter/flutter#144049)
2024-02-23 [email protected] Roll Flutter Engine from b5bebfe43d29 to fbc9b889aee9 (3 revisions) (flutter/flutter#144041)
2024-02-23 [email protected] disable debug banner in m3 page test apps. (flutter/flutter#143857)
2024-02-23 [email protected] Relands "Changing `TextPainter.getOffsetForCaret` implementation to remove the logarithmic search (#143281)" (reverted in #143801) (flutter/flutter#143954)
2024-02-23 [email protected] Roll Flutter Engine from 5f99a6c3289e to b5bebfe43d29 (1 revision) (flutter/flutter#144035)
2024-02-23 [email protected] Implementing null-aware operators throughout the repository (flutter/flutter#143804)

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
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
LouiseHsu pushed a commit to LouiseHsu/packages that referenced this pull request Mar 7, 2024
flutter/flutter@39585e6...f6c1082

2024-02-24 [email protected] Roll Flutter Engine from 81035b7d56ef to 1d7d5e613d7e (1 revision) (flutter/flutter#144085)
2024-02-24 [email protected] Roll Flutter Engine from a148bdb63740 to 81035b7d56ef (2 revisions) (flutter/flutter#144083)
2024-02-24 [email protected] Roll Flutter Engine from 3c036c081534 to a148bdb63740 (1 revision) (flutter/flutter#144077)
2024-02-24 [email protected] Roll Flutter Engine from 738042295f97 to 3c036c081534 (2 revisions) (flutter/flutter#144073)
2024-02-24 [email protected] Roll Flutter Engine from ca2452074a49 to 738042295f97 (4 revisions) (flutter/flutter#144071)
2024-02-24 [email protected] Roll Flutter Engine from 9409b75e8f35 to ca2452074a49 (2 revisions) (flutter/flutter#144068)
2024-02-24 [email protected] Adding support for DDC modules when running Flutter Web in debug mode (flutter/flutter#141423)
2024-02-24 [email protected] Roll Flutter Engine from 733163c4e5d7 to 9409b75e8f35 (1 revision) (flutter/flutter#144061)
2024-02-23 [email protected] allow optional direct injection of Config instance into DevFS (flutter/flutter#144002)
2024-02-23 [email protected] Enable asset transformation for `flutter build` for iOS, Android, Windows, MacOS, Linux, and web (also `flutter run` without hot reload support) (flutter/flutter#143815)
2024-02-23 [email protected] Roll Flutter Engine from 5d1c0d4dc327 to 733163c4e5d7 (1 revision) (flutter/flutter#144058)
2024-02-23 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.24.4 to 3.24.5 (flutter/flutter#144059)
2024-02-23 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 4.0.1 to 4.0.2 (flutter/flutter#144060)
2024-02-23 [email protected] Render the warm up frame in a proper rendering process (flutter/flutter#143290)
2024-02-23 [email protected] Roll Flutter Engine from fbc9b889aee9 to 5d1c0d4dc327 (2 revisions) (flutter/flutter#144049)
2024-02-23 [email protected] Roll Flutter Engine from b5bebfe43d29 to fbc9b889aee9 (3 revisions) (flutter/flutter#144041)
2024-02-23 [email protected] disable debug banner in m3 page test apps. (flutter/flutter#143857)
2024-02-23 [email protected] Relands "Changing `TextPainter.getOffsetForCaret` implementation to remove the logarithmic search (#143281)" (reverted in #143801) (flutter/flutter#143954)
2024-02-23 [email protected] Roll Flutter Engine from 5f99a6c3289e to b5bebfe43d29 (1 revision) (flutter/flutter#144035)
2024-02-23 [email protected] Implementing null-aware operators throughout the repository (flutter/flutter#143804)

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
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 14, 2024
@Markzipan Markzipan deleted the legacy-support branch May 6, 2025 18:21
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 tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants