Why should I not put the .buildtool cache folder under source control?

조회 수: 3 (최근 30일)
Strider
Strider 2024년 8월 29일
댓글: Strider 2024년 8월 30일
Concerning the build tool, incremental build cache, and source control the doc is very clear:
"Do not put the cache folder under source control. To exclude the cache folder from source control, add its name to your source control ignore list. For example, append the cache folder name to the .gitignore file in the plan root folder."
If I am working on a team or utilizng a CI pipeline to run build tasks there is zero gurrantee that the build will be on the same machine for consecutive builds. My question is why not put it under source control or how else can I achieve incremental builds across different machines?

답변 (1개)

Tushar Sharma
Tushar Sharma 2024년 8월 30일
Hey Strider,
Your logic is quite reasonable—if the cache folder contains information like task traces that enable incremental builds, it makes sense to consider putting it in source control so other machines can leverage it.
However, there are a couple of issues with this approach. The cache keeps track of changes since the last build to avoid rebuilding everything from scratch. This data is specific to the local environment and may not be useful across different environments or users.
Additionally, the primary purpose of the cache is to improve build performance rather than ensure build reproducibility. This suggests that it shouldn't be shared or versioned. Builds should be reproducible from the source files and build scripts alone, without relying on cached data.
I hope this makes sense!
  댓글 수: 1
Strider
Strider 2024년 8월 30일
Thanks for the reply. I disagree with the implied point, at least how I interpreted it, that a build could intentionally be allowed to depend upon on the local environment; other than what is under source control. To me that would be something that is not repeatable across machines which is a risk. I have interpreted the incremental build purpose to check for changes in task inputs or outputs only.
On the second point, does the incremental build do anything to not ensure reproducibility?
I am aware of the clean task or the ability to override incremental builds so I could always ignore the cache.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Build Automation에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by