-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Recognize file entry-points that should be accessed as package URIs #33076
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
What does "entry point" mean in this context? Is it "Dart library with a |
It means a reference to something you can run the tool on. It doesn't need to have a main method, and it doesn't need to be a library. For example, you can run both dartfmt and the analyzer on part files. |
Yes, any user supplied file name, as long as there is also a way to resolve package URIs. For application entry points (library containing the Purely single-file or source based tools, like the formatter, usually don't care what URI the library is identified by, so there is no reason to exempt them. |
Actually, we would search for a .packages file for any entry point. |
This would be amazing! I've had a lot of issues filed on my projects related to this very problem. A few examples: flutter_redux: scoped_model: This is just the tip of the iceberg :) |
Another example of this issue, this time on Stack Overflow: https://stackoverflow.com/questions/50913869/flutter-a-value-of-type-lib1object-cant-be-assigned-to-a-variable-of-type-li |
This is now the main issue for tracking this problem. What does this have to do with the CFE, though? Wouldn't this be handled by the analyzer? |
My understanding of the proposal is that the CFE would automatically treat |
Oh, love it! |
Until this is solved, can we add a TL;DR for users that followed the various bug threads to here for what the bug is and what is the temporary workaround? |
@xster I was thinking if it were a good idea to add a comment to |
Face the same problem. |
@peter-ahe-google are you still looking at this? |
It's next on my todo list. |
Proposed fix https://dart-review.googlesource.com/c/sdk/+/78246 |
Is it possible that the fix will be included in the Dart 2.1 release? |
@vanesyan it's looking good, but I can't promise anything. |
Users provide entry points to our tools as command line arguments. In some cases those entry points are inside a the
lib
directory of the package the user is working on, but are specified as file paths.This can cause the same library file to be imported both using a file URI and a package URI, causing it to be interpreted as two different libraries.
To help users, we should vet the entry point path against its package configuration, and if the entry point could be referenced using a package URI, use that package URI as the URI of the entry-point instead.
The text was updated successfully, but these errors were encountered: