dotnet / dotnet/msbuild

MSBuild Clean action deletes files from ccache's cache

Open
#11,921 0 comments 1 reaction 1 assignee Claimed by @rainersigwald View on GitHub
Area: Performance triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Issue Description

[ccache](https://ccache.dev) 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](https://github.com/ccache/ccache/wiki/MS-Visual-Studio#alternative-2-make-a-wrapper-script)
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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.