First of all, incremental builds via SBT are pretty awesome, generally in the < 1sec range. However, sometimes you have to do a full clean/compile, or, in the case of increme
Have a look at how incremental recompilation works in SBT.
It's roughly this:
For the purposes of SBT, a "dependent" is both a user of the class and a class defined in the same file.
Owen's example for foo.scala could even be this, and you'd see the issue:
object foo {
def z: Int = 8
}
object foo2 {
class A { ... }
}
Good practices:
I've noticed that type members can force rebuilds in places you would not expect. For example:
foo.scala:
object foo {
class A {
type F = Float
}
def z: Int = 8
}
bar.scala:
object bar {
def run { println(foo.z) }
}
Changing the value of z
does not force bar
to be recompiled. Changing the type of F
does, even though bar
never refers to F
or even to A
. Why, I have no idea (Scala 2.9.1).