-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Improve Dart plugin registration handling #122046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Dart plugin registration handling #122046
Conversation
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
|
|
||
| @override | ||
| String toString() { | ||
| return '<PluginInterfaceResolution ${plugin.name} for $platform>'; |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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(); | ||
| } |
There was a problem hiding this comment.
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.
bparrishMines
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Improve Dart plugin registration handling
Fixes issues related to transitive dependencies on plugins with Dart implementations:
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
///).