Add NuGet cache support for .NET projects - #36
Open
yairixStudio wants to merge 1 commit into
Open
Conversation
I ran ClearDisk on a machine with a few years of .NET side projects on it and kept wondering why disk usage never matched what the app reported — ~/.nuget/packages had quietly grown past 8 GB and wasn't showing up anywhere in the scan. Adds ~/.nuget/packages (the global-packages folder; not ~/.nuget itself, which also holds NuGet.Config) as a "safe" cache, restored on the next `dotnet restore`. Also adds a regression test asserting every allCachePaths() entry has a matching cacheDescriptions key, since that lookup fails silently (empty description) rather than at compile time. Tested with `swift build` and `swift test` (5/5, including the new test). I don't have the .NET SDK installed here, so the path is based on NuGet's documented global-packages folder location rather than something I generated locally with dotnet restore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4.
I've got a few years of .NET side projects on this Mac, and
~/.nuget/packageshad quietly grown past several gigabytes without ClearDisk ever mentioning it — every JS/Python/Ruby/Go cache I use showed up, but nothing for .NET.What changed
~/.nuget/packages(NuGet's global-packages folder — not~/.nugetitself, which also holdsNuGet.Config) as a new".NET NuGet"entry inallCachePaths(), markedsafesince it's restored on the nextdotnet restore.cacheDescriptionsentry.testEveryCacheDefinitionHasADescription) asserting everyallCachePaths()name has acacheDescriptionskey — that lookup inMainViewcurrently fails silently (blank description) rather than at compile time, so it seemed worth locking down while I was in there.On the path itself: I don't have the .NET SDK installed on this machine, so I wasn't able to run
dotnet restoreand check the folder in person — the path and "safe to delete" classification are based on NuGet's documented global-packages folder location (issue #4 also lists the same path). Unlike the Go module cache noted a few lines above in the same file, NuGet doesn't check the extracted packages out read-only, so there shouldn't be a Trash-move issue, but I wanted to flag that I'm going on documentation here rather than something I generated and deleted myself.I noticed #4 was mentioned as already covered in a fork back in July, but no PR ever landed for it — happy to close this if that work is still coming.
Testing
swift build— cleanswift test— 5/5 passing (including the new test)dotnet restorelocally (no .NET SDK on this machine) — noted above