Skip to content

flutter <build> <ios> regenerates plugins multiple times? #157391

@matanlurey

Description

@matanlurey

To reproduce:

diff --git a/packages/flutter_tools/lib/src/flutter_plugins.dart b/packages/flutter_tools/lib/src/flutter_plugins.dart
index 67e9799087..0f543219f5 100644
--- a/packages/flutter_tools/lib/src/flutter_plugins.dart
+++ b/packages/flutter_tools/lib/src/flutter_plugins.dart
@@ -1011,6 +1011,7 @@ Future<void> refreshPluginsList(
   bool macOSPlatform = false,
   bool forceCocoaPodsOnly = false,
 }) async {
+  print('>>> refreshPluginList() ::: ${StackTrace.current}');
   final List<Plugin> plugins = await findPlugins(project);
   // Sort the plugins by name to keep ordering stable in generated files.
   plugins.sort((Plugin left, Plugin right) => left.name.compareTo(right.name));

And then create and run an iOS (and I believe, MacOS) build:

$ flutter create . --platforms ios

>>> refreshPluginList() :: refreshPluginsList (package:flutter_tools/src/flutter_plugins.dart:1103:51)
#1      FlutterProject.ensureReadyForPlatformSpecificTooling (package:flutter_tools/src/project.dart:373:11)
#2      FlutterProject.regeneratePlatformSpecificTooling (package:flutter_tools/src/project.dart:344:12)
#3      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1793:21)

>>> refreshPluginList() ::: #0      refreshPluginsList (package:flutter_tools/src/flutter_plugins.dart:1103:51)
#1      processPodsIfNeeded (package:flutter_tools/src/macos/cocoapod_utils.dart:29:9)
#2      buildXcodeProject (package:flutter_tools/src/ios/mac.dart:280:9)
#3      _BuildIOSSubCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:701:37)

As far as I can tell, every FlutterCommand regenerates plugins as long as shouldRunPub is set, so when the code was added (again) in #146256 it might have been duplicate work? Defer to the iOS team, maybe they see something I don't.

(This complicates conditionally removing the .flutter-plugins file which is why I'm bringing it up)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: tech-debtTechnical debt, code quality, testing, etc.team-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions