Gabriele Petronella Gabriele Petronella - 4 years ago 122
Scala Question

Preserve results of sbt incremental compilation when moving project directory

Consider the scenario: I have a simple scala project managed by sbt, in a directory called

foo
.

cd foo
sbt compile


It now takes a few seconds and the project compiles correctly.

Now, thanks to sbt incremental compilation, if I run

sbt compile


it terminates the compile task in close to 0 seconds, since the source code hasn't changed.

But if I rename the
foo
directory into
bar


cd ..
mv foo bar


and try to compile it again

cd bar
sbt compile


now the compile task takes again few seconds, hence not using the results from the previous compilation.

Is there a way to preserve the incremental compilation results of a project even when its absolute path on disk has changed?

Answer Source

As it turns out, there's some work in progress to make incremental compilation results cacheable. Here's the relevant PR: https://github.com/sbt/zinc/pull/216.

Also, there's an issue (being discussed at the time of this writing) about making zinc's analysis completely machine independent. See https://github.com/sbt/zinc/issues/218.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download