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

More robust snapshot deletion #4170

Merged
merged 1 commit into from
Mar 14, 2024
Merged

Conversation

sigurdm
Copy link
Contributor

@sigurdm sigurdm commented Mar 12, 2024

Change snapshot deletion to only delete snapshots made by different sdk's.

This is such that the .dart_tool folder will not grow without bounds.

This requires that we rebuild even snapshots from mutable packages after pub get. So this pr also adds a timestamp check comparing the snapshot modified time to the .dart_tool/package_config.json modified time. And will recompile if the snapshot is older, even for immutable packages.

This is not as bad as it sounds, because we are doing incremental recompilation.

Fixes #4161

pub get and dart run will still race if they are run concurrently from different sdks. But that seems acceptable.

@@ -455,7 +455,7 @@ To update `$lockFilePath` run `$topLevelProgram pub get`$suffix without
if (precompile) {
await precompileExecutables();
} else {
await _deleteExecutableSnapshots(changed: result.changedPackages);
await _deleteExecutableSnapshots();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we are throwing away information here. But at the same time, I don't know how we would communicate to a different compilation process what dependency entries changed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, I'm just making an observation, not saying it's a problem.

I think this is solid! :D

@jonasfj
Copy link
Member

jonasfj commented Mar 12, 2024

Are there potential problems where new/old SDK versions interact poorly here?

I think not since snapshots are suffixed with SDK-version.

@sigurdm
Copy link
Contributor Author

sigurdm commented Mar 14, 2024

Are there potential problems where new/old SDK versions interact poorly here?

If you switch between two different sdk versions you'll have your snapshots deleted all the time.

@sigurdm sigurdm merged commit 539457d 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.

dart run <package> can fail if a dart pub get operation is running concurrently
2 participants