Just thinking,
Eugene.
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
>
As scala tends to generate more .class files than there are "class",
"object" or "trait" keywords in your source code, the "not remove
classfiles prior to (re-)compilation" can produce some rather
surprising results -- especially if you're using e.g. Spring to do
things like "scan the present classfiles for things annotated in this
way, and produce beans from them".
By moving from Maven (whose scala plugin doesn't delete classfiles
before re-compilation) to SBT, the amount of "clean" build actions
I've had to do to has gone from more than 10 times a day to be all but
eliminated. Please don't kill this correctness for speed.
To further optimize SBT's strategy for recompilation while keeping
things as correct as they are, I think it'd have to recompile the
modified file(s), note what classfiles this generated, compare this
set of classfiles with the pre-existing set, and for files that
already existed also compare the contents of the old and the new
classfile. There are likely tricky issues to do with synthetic
classfiles, and there might well be performance considerations for
"how complicated should the recompile-detection algorithm be" versus
"how many potentially affected files might just as well be recompiled
in one go".
--
Harald
> AFAIR this is a conservative approach to account for interactions between
> templates defined in a source file, namely the contents of a sealed type,
> and possibly the companionship status between a class and an object
>
> sealed abstract class A
> case object B extends A
> case object C extends A
>
> Adding `object D extends A` requires a recompile of code that pattern
> matches a scrutinee of type A.
Yes.
> Perhaps this can be refined to a more fine-grained level (although the
> additional complexity of the implementation must be weighed against the
> benefits).
Right. Moving to finer granularity is as big a step as the 0.7->0.10 shift. There are several improvements that can be made on the current approach before such a move would be worth it, in my opinion. A serious obstacle is that we had to drop the full API in favor of a hash for memory reasons. We'd need the full API for a finer approach or we'd need to come up with some other system. Also, we have macros coming up and those are likely problematic for incremental compilation.
-Mark
No, the files have to be removed from the classpath for compilation to properly fail on references to stale classes.
-Mark
--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> Ah, I thought it was a problem for running after, which of course makes no
> sense.
> Could they be removed from the classpath without being deleted?
How? You'd need both javac and scalac to support this and they both only accept directories and jars on the classpath as far as I know.
This wouldn't fix the problem regardless. sbt does multi-step compilation, so class files get generated at different times anyway.
-Mark
My work in progress allows arbitrary classpath filtering, so you could
actually remove individual classes from the classpath were it
desirable. (You're on your own with java.)