Skip to content
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

Rewire all Dart entrypoints when the Dart plugin registrant is used. #91856

Merged
merged 10 commits into from
Oct 20, 2021

Conversation

blasten
Copy link

@blasten blasten commented Oct 14, 2021

Fixes #91841
Fixes #91832

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Oct 14, 2021
@google-cla google-cla bot added the cla: yes label Oct 14, 2021
Emmanuel Garcia added 2 commits October 14, 2021 18:48
@blasten blasten force-pushed the rewire_entrypoints branch 2 times, most recently from 397b195 to 92b48f2 Compare October 19, 2021 03:59
@blasten
Copy link
Author

blasten commented Oct 19, 2021

It turned out that the machinery to rewire entrypoints wasn't necessary. exporting the main library worked just fine.

Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

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

This is much simpler =)

@@ -685,6 +685,7 @@ const String _dartPluginRegistryForNonWebTemplate = '''

// @dart = {{dartLanguageVersion}}

export '{{mainEntrypoint}}';
Copy link
Member

Choose a reason for hiding this comment

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

Might be worth putting a comment here explaining that when {{mainEntrypoint}} defines main, that definition is expected to be shadowed by the definition of main below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we just delete the main below with this, and the import?

Copy link
Author

Choose a reason for hiding this comment

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

If I read the engine code correctly, there isn't anything that should prevent removing main from the generated file. However, that isn't what I'm seeing.

For some reason, if main isn't defined in this file, then _PluginRegistrant.register isn't called.

Copy link
Contributor

Choose a reason for hiding this comment

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

This matches my observation as well. The "entrypoint file" is the file which main is defined. If you attempt to call a function that is not defined nor exported in the "entrypoint file", then you need to specify its "library path".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple entry-points in same Dart file is broken Dart plugin registrant broke top-level Dart entrypoints
6 participants