Skip to content

Inner devloop improvements#18

Merged
kzu merged 3 commits intomainfrom
dev
Oct 20, 2020
Merged

Inner devloop improvements#18
kzu merged 3 commits intomainfrom
dev

Conversation

@kzu
Copy link
Copy Markdown
Member

@kzu kzu commented Oct 20, 2020

No description provided.

kzu added 3 commits October 20, 2020 18:48
When working with packages built locally, it's quite common to dogfood those packages from sample projects locally. This can use a fixed package version for the locally produced packages, or auto-incremented versions. Also, the referencing projects might choose to use wildcards when testing local packages too.

The caching mechanisms built into NuGet make this process a bit more cumbersome than necessary: if you build a fixed version package, you will never get a newly built version restored in a project elsewhere in the machine because NuGet will believe the one in the cache is already the latest. The HTTP-level cache implemented on top of the package cache also works against you in that case even if you clean that folder. And wildcards don't make things much better unless you clean those caches too.

In addition, if you increment package versions when building locally too, the package output path will continuously be filled up with older versions unnecessarily.

This commit adds support for automatically fixing all those issues while still causing minimal disruption or performance problems for other packages and projets in your machine, as follows:

* The entire cleanup only is in place for packable projects, and in local (non-CI) builds
* It can be turned off entirely by setting `EnablePackCleanup=false`.
* It cleans the specific package folder in the cache for the current PackageId: nuget creates a subfolder in the package cache dir for each package id, and places all versions inside. By removing just that folder, you effectively clean the cache for that package and no others.
* It cleans the HTTP cache too: this cannot be done selectively for a specific package id, and therefore can be turned off by setting `CleanHttpNuGetCacheOnPack=false` if it causes performance issues. In my experience, it doesn't since the HTTP cache is just an optimization for offline scenarios (I think?).

I have used this approach for years on multiple projects with multiple packaging approaches and at this point I think it deserves being built-in in nugetizer.
@kzu kzu merged commit e9b43e4 into main Oct 20, 2020
@devlooped devlooped locked and limited conversation to collaborators Nov 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant