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.
Yes - pub run would in some cases end up doing double resolution
| Resolving dependencies in myapp... | ||
| Got dependencies in myapp. |
| /// The path where the package_config.json file is stored. | ||
| final String path; |
There was a problem hiding this comment.
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.
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.
| 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.
We actually always access entrypoint.packageGraph below
| if (argResults.wasParsed('style')) { | ||
| usageException('Cannot combine --json and --style.'); | ||
| } | ||
| await entrypoint.ensureUpToDate(); |
There was a problem hiding this comment.
...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.
Yes - pub run would in some cases end up doing double resolution
| /// The path where the package_config.json file is stored. | ||
| final String path; |
There was a problem hiding this comment.
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 runstill 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