Inspired by Speedy Scala Builds with Bazel at Databricks. I decided to see whether we can speed up our build by caching the generated class files. I want the first build for a contributor to be fast as well as builds when switching between branches.
So far I’ve managed to prevent compilation by copying back class files just before compile. This works when I delete a specifc class file or delete the target directory altogether.
However, when I run
clean the next
compile always recompiles, regardless of whether I restore the whole
target directory or not.
Where does sbt store the extra metadata that it uses for deciding whether to recompile?
(A first and very hacky attempt to wire the caching into the compilation step is here: https://github.com/spockz/sbt-cached-build-tryout)