Skip to content

"flutter run" will unconditionally rewrite plugin registrants #134899

Description

@iamsergio

Is there an existing issue for this?

Steps to reproduce

Consecutive runs of flutter run will regenerate and rebuild the C++ boilerplate, which makes the build slower.

On Desktop (at least Linux, but probably others as well), flutter run generates some C++ files such as:

linux/flutter/generated_plugin_registrant.cc
windows/flutter/generated_plugin_registrant.cc

The problem is that it will regenerate them even if they already exist. Flutter should 1st compare the contents before regenerating them, otherwise cmake will notice the new timestamp and trigger a rebuild.

Expected results

flutter run -v should not show any time spent running cmake and ninja if source files haven't changed since the last good build.

Actual results

unneeded rebuilds

Code sample

flutter create foo
cd foo
flutter run
flutter run -v

Screenshots or Video

No response

Logs

[ +414 ms] [2/5] Building CXX object CMakeFiles/pointless.dir/flutter/generated_plugin_registrant.cc.o
[  +20 ms] [3/5] Building CXX object CMakeFiles/pointless.dir/my_application.cc.o
[  +99 ms] [4/5] Linking CXX executable intermediates_do_not_run/pointless
[        ] [4/5] Install the project...

Flutter Doctor output

Flutter 3.13.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision efbf63d9c6 (5 weeks ago) • 2023-08-15 21:05:06 -0500
Engine • revision 1ac611c64e
Tools • Dart 3.1.0 • DevTools 2.25.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: buildBuilding flutter applications with the toola: desktopRunning on desktopa: pluginsSupport for writing, building, and running plugin packagesfound in release: 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions