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

Make ensureUpToDate static #4171

Merged
merged 6 commits into from
Mar 14, 2024
Merged

Conversation

sigurdm
Copy link
Contributor

@sigurdm sigurdm commented Mar 12, 2024

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

Comment on lines 97 to 100
$ 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...
Copy link
Member

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?

Copy link
Contributor Author

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

Comment on lines 146 to 147
Resolving dependencies in myapp...
Got dependencies in myapp.
Copy link
Member

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?

Comment on lines 14 to 15
/// The path where the package_config.json file is stored.
final String path;
Copy link
Member

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?

Copy link
Contributor Author

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();
Copy link
Contributor Author

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();
Copy link
Contributor Author

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!

Comment on lines 97 to 100
$ 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...
Copy link
Contributor Author

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

Comment on lines 14 to 15
/// The path where the package_config.json file is stored.
final String path;
Copy link
Contributor Author

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.

@sigurdm sigurdm merged commit e08f720 into dart-lang:master Mar 14, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants