Skip to content

Conversation

@stuartmorgan-g
Copy link
Contributor

Fixes issues related to transitive dependencies on plugins with Dart implementations:

  • Ensures that if there are multiple transitive dependencies including the app-facing-package-selected default, the default is picked. Previously it was order-dependent what would happen, and in some cases no implementation would be picked.
  • Allows registration of a package's implementation even if the app-facing package is not present, as long as there is only one possible implementation (or the app directly picks one). There are cases where depending on just a platform implementation of a package, rather than the app-facing package, is useful. (E.g., shared_preferences_linux depends directly on path_provider_linux.)

Also fixes a bug where an implementation conflict error was being gated behind a flag that was only supposed to be hiding an (overly-strict at the moment) error about plugin pubspec definitions.

Fixes #99083
Fixes #118401

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

Fixes issues related to transitive dependencies on plugins with Dart
implementations:
- Ensures that if there are multiple transitive dependencies including
  the app-facing-package-selected default, the default is picked.
  Previously it was order-dependent what would happen, and in some
  cases no implementation would be picked.
- Allows registration of a package's implementation even if the
  app-facing package is not present, as long as there is only one
  possible implementation (or the app directly picks one). There are
  cases where depending on just a platform implementation of a package,
  rather than the app-facing package, is useful. (E.g.,
  shared_preferences_linux depends directly on path_provider_linux.)

Also fixes a bug where an implementation conflict error was being gated
behind a flag that was only supposed to be hiding an (overly-strict at
the moment) error about plugin pubspec definitions.

Fixes flutter#99083
Fixes flutter#118401
@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 6, 2023

@override
String toString() {
return '<PluginInterfaceResolution ${plugin.name} for $platform>';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this to help with debugging, and it seemed harmless to keep it for future debugging.

message: 'Please resolve the errors',
));

expect(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These error text expectations were moved because they didn't actually do anything where they were; they were at the end of a try/catch that was expected to throw.

fileSystem: fs,
appDependencies: directDependencies,
),
Plugin.fromYaml(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test's description says it was supposed to test for multiple errors all being output, but didn't actually do that, so I fixed it.

);
});

testWithoutContext('selects user selected implementation despites default implementation', () async {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is removed because there were two exact duplicate copies of this test.

.childFile('.packages');
if (packagesFile.existsSync()) {
packagesFile.deleteSync();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One test re-runs createFakeDartPlugins, and the fact that this clearing step wasn't necessary was a side-effect of the fact that the previous implementation would not create registration when the only plugin was an implementation for which neither the app-facing package nor a direct dependency was present. That logic changed, which broke the test even though that wasn't the point of that test.

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

LGTM

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 9, 2023
@auto-submit auto-submit bot merged commit 62116f9 into flutter:master Mar 9, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 10, 2023
hannah-hyj pushed a commit to hannah-hyj/flutter that referenced this pull request Mar 11, 2023
Improve Dart plugin registration handling
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 11, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 12, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
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

2 participants