Exploring Build Caching - A Practical Overview
summary
Build caching reduces repetitive work by reusing compiler outputs and test artifacts; sbt 1 already supports remote compilation caching (push/pull of class files + inc compiler state) and sbt 2 plans a Bazel-compatible protocol with local and remote stores. Implementation requires stable inputs/outputs, explicit declared outputs, and cache observability to track hit/miss rates and size. Real-world uses include Scala 3 and Pekko repositories; reported gains range from minutes per developer to saving multi-day CI test runs when cache hit rates are high.
AI-written summary · about
chapters (18)
- 0:00Introduction
- 1:05What is build caching
- 4:11Challenges in build caching
- 6:56Incremental compilation
- 7:16Build caching solutions
- 8:41Build caching in SBT1X and SBT2
- 10:03Specialized caching in SBT1X
- 11:06Remote compilation caching in SBT1X
- 12:29Making remote caching easier
- 15:20Cache key generation in SBT
- 16:03Cached tasks
- 18:54Caching test results
- 20:39Generalizing task caching
- 22:48Task caching challenges
- 23:11Deploying build caching
- 24:35Need for cache observability
- 25:37Pitfalls in build caching
- 27:43Conclusion
related talks
37mCache once and use everywhere
25mFaster Builds With Xcode Compilation Cache
58mNext generation Scala builds with CBT
49mDRY compiling!
19mGetting to a green build with caching on CI
41mCBT A New, Intuitive Build Tool for Scala
31mBazel: Do We Really Need Another Build Tool?
06mLightning Talk: Remote Execution Caching Compiler (RECC) for C++ Builds
