-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Proposal: Have dart run <file.dart>
do resolution
#55548
Comments
cc @jonasfj |
Is the procedure something like this:
|
Yes I think that is close enough. One thing I'm a bit unsure about is the priority og package config vs pubspec. Ie
In the second case we risk having to parse yaml in order to decide if the pubspec we found is the right one. That's why I think we go with the first. |
Did I understand this correctly? Current behavoir:
Suggested new behavoir:
|
Yep! |
With the detail that the resolution is not for the current working dir, but for the context of |
OK, I think I'd do a breaking change for this. Given there is a work around (change |
I'd look for both If you find a If you find a package-config, but no If you find both, it's the first case again, you may just not have to run So finding (Will this cause |
Is the intention of this mostly to improve performance with snapshotting, to ensure packages are up to date, or both? For performance improvements, we're already in the process of exploring enabling the resident frontend server by default (cc @a-siva @derekxu16). |
My focus is on the package resolution. Snapshotting would just come as a bonus, but longer term I really want the snapshotting logic out of pub, as I think the VM has a lot more information available to do this efficiently. Getting the resident frontend server on by default would be awesome! |
Unfortunately that doesn't work if that pubspec is part of a flutter.dev/go/pub-workspace, and you have to parse it to decide if that is the case. |
Then I guess you need to parse the At least, if doing |
We have discussed a bit offline, and come to this solution: It will be of the form: {
"workspaceRoot": "../.."
} We then for each parent directory
|
Something that @a-siva had pointed out to me earlier is that
So I think it makes sense for your improved package resolution strategy to be implemented in |
Ideally |
Yes, I will try to share as much code as possible between the two implementations. |
Background
Currently
will ensure that resolution and
.dart_tool/package_config.json
in the current working dir is up to date, and then findbin/<executable>.dart
relative to the<package>
package dir.As part of the workspace work, we will search in parent directories to current working dir
However:
Will pass
path/to/file.dart
directly to the VM without doing any resolution. The package will be run with the nearest enclosing.dart_tool/package_config.dart
topath/to
and no snapshotting is done. This corresponds to runningdart path/to/file.dart
(though it is slower because it enters the dartdev command-line handling).Proposal
Let
dart run path/to/file.dart
search for a.dart_tool/package_config.json
(or, failing that a pubspec.yaml) enclosingpath/to
, ensuring the resolution is up-to-date and doing the same snapshotting it would do fordart run <package>:<executable>
.This will slightly change the current observed behavior, and could be considered a bug fix or a breaking change depending on how you look at it.
The text was updated successfully, but these errors were encountered: