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

Add automatic cleanups to improve the inner devloop #17

Merged
merged 2 commits into from
Oct 20, 2020
Merged

Add automatic cleanups to improve the inner devloop #17

merged 2 commits into from
Oct 20, 2020

Commits on Oct 20, 2020

  1. Add automatic cleanups to improve the inner devloop

    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 committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    8c2eb51 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    594b10d View commit details
    Browse the repository at this point in the history