msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

MSBuild Clean action deletes files from ccache's cache

Open ftrofin opened this issue 6 months ago • 0 comments

Issue Description

ccache is a compiler cache that stores the results of previous compiler invocations to accelerate your builds (even after you clean). It works fine with MSBuild as long as you don't invoke the "Clean" action. When Clean is invoked it deletes the files from ccache's cache (completely outside of my build tree) because the MSBuild's FileTracker noticed the writes that ccache.exe did to its cache folder and thinks it should delete those files. We need a way to specify a deny list for certain folders (like ccache's list) or a "do not track" list of certain executables (ccache.exe in this case) for the FileTracker (I would prefer the second since it will eliminate needless overhead in tracking ccache's reads and writes).

Steps to Reproduce

  1. Configure ccache using a wrapper script as specified in the docs
  2. Build your project as normal (from cmd line or Visual Studio). ccache should be invoked via the wrapper script and the cache location should contain the results of the compilations (you can check using ccache -sv to see the stats). Note the number of files in the cache and the size of the cache.
  3. Run the "Clean" target for your project.
  4. Check the ccache stats again (ccache -sv). You'll notice that most of the files are gone.

Expected Behavior

MSBuild should not track the files written by ccache and should not delete them when Clean is invoked.

Actual Behavior

Clean action deletes the files from the ccache's cache folder.

Analysis

No response

Versions & Configurations

No response

ftrofin avatar May 28 '25 17:05 ftrofin