Skip to content

Conversation

sigurdm
Copy link
Contributor

@sigurdm sigurdm commented Sep 30, 2025

To recover space occupied by unused old dependencies in the pub cache, without affecting "active" projects.

Will enumerate all package configs from all active projects to find all the packages located within the pub cache.

Then enumerates all packages/git repos in the pub cache, and removes those that are not referred to by the active projects.

Active projects have been marked since dart 3.9.0.

@sigurdm sigurdm requested a review from szakarias October 6, 2025 09:06
Copy link
Contributor

@szakarias szakarias left a comment

Choose a reason for hiding this comment

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

LGTM

parts[parts.length - 1] == 'package_config.json') {
projectDir = p.joinAll(parts.sublist(0, parts.length - 2));
}
log.message('* $projectDir');
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe restrict the number of outputs here?

/// successfully repaired.
Future<Iterable<RepairResult>> repairCachedPackages(SystemCache cache);

/// Return all files directories inside this source that can be removed while
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Return all files directories inside this source that can be removed while
/// Return all directories inside this source that can be removed while

});
});

test('gcing and empty cache behaves well', () async {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
test('gcing and empty cache behaves well', () async {
test('gcing an empty cache behaves well', () async {

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