-
Notifications
You must be signed in to change notification settings - Fork 229
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
Make ensureUpToDate static #4171
Conversation
$ pub run -C myapp 'bin/app.dart' | ||
Resolving dependencies in myapp... | ||
Got dependencies in myapp. | ||
Resolving dependencies in myapp... | ||
Got dependencies in myapp. | ||
Building package executable... |
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.
Are we fixing something here?
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.
Yes - pub run would in some cases end up doing double resolution
Resolving dependencies in myapp... | ||
Got dependencies in myapp. |
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.
Why are we duplicating here?
lib/src/package_config.dart
Outdated
/// The path where the package_config.json file is stored. | ||
final String path; |
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 orthogonal right?
I don't think I mind, but aren't we going to regret this at some point.
I guess a package_config.json
needs to exist relative to some folder, otherwise we can't resolve relative paths.
Probably we should state that relative paths must always be resolved relative to path
.
We could also consider calling it location
? or?
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.
Yeah .. a bit iffy...
If Executable.resolve is to work without knowing the entrypoint, then we need to store the path to the package_config file somewhere else. And as you say - it contains relative uris.
Maybe we should just pass it to Executable.resolve... trying that.
@@ -71,9 +72,6 @@ class DepsCommand extends PubCommand { | |||
|
|||
@override | |||
Future<void> runProtected() async { | |||
// Explicitly run this in the directory in case | |||
// we don't access `entrypoint.packageGraph`. | |||
await entrypoint.ensureUpToDate(); |
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.
We actually always access entrypoint.packageGraph
below
@@ -90,7 +88,6 @@ class DepsCommand extends PubCommand { | |||
if (argResults.wasParsed('style')) { | |||
usageException('Cannot combine --json and --style.'); | |||
} | |||
await entrypoint.ensureUpToDate(); |
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.
...and for sure doing this twice was just ... not helpful!
$ pub run -C myapp 'bin/app.dart' | ||
Resolving dependencies in myapp... | ||
Got dependencies in myapp. | ||
Resolving dependencies in myapp... | ||
Got dependencies in myapp. | ||
Building package executable... |
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.
Yes - pub run would in some cases end up doing double resolution
lib/src/package_config.dart
Outdated
/// The path where the package_config.json file is stored. | ||
final String path; |
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.
Yeah .. a bit iffy...
If Executable.resolve is to work without knowing the entrypoint, then we need to store the path to the package_config file somewhere else. And as you say - it contains relative uris.
Maybe we should just pass it to Executable.resolve... trying that.
This means the fast path (relying on modified timestamps) doesn't have to load
pubspec.yaml
.dart run
still uses the package-graph to deciding if a package is "mutable" so the real savings will not manifest yet.This is a follow up to #4160 preparation for the `Update the ensureUptodate procedure to handle workspaces part of #4127