The scalac compiler understand java code and can perform mixed compilation without specifying an order.
Basically, it goes in 3 phases if there are java files present 1) scalac compiler extract all java class/interface signatures 2) scalac compiler compiles all .scala files using extracted signatures from #1 3) scalac compiler compiler all Java code (using compiled .scala classes from #2) so it doesn't matter if the Java code depends on Scala code or vice-versa. On Tue, Jul 30, 2013 at 8:48 PM, Peter Donald <[email protected]>wrote: > Hi, > > I don't use the scala plugin so this may be wrong but looking at the > source, it seems that the scala compilers are responsible for > compiling the java dependencies as well as the scala code. It seems > that the only reason that the scala plugin also runs the javac > compiler is to pick up java files that are not transitive dependencies > of the scala code. Or thats what it looks like to me ... > > On Thu, Jul 25, 2013 at 6:14 PM, Marius Kjeldahl > <[email protected]> wrote: > > In the process of adding tests to my kawa module for buildr, I'm > struggling > > with build order. The scala module that I've modelled my kawa module on > > seems to simply build the scala code first, then the java code for mixed > > mode compilation. The code can be found in scala/compiler.rb in the > method > > compile_with_scalac. > > > > One of the tests that comes with the module then defines a java package > > Foo, and a scala package Bar, where Bar inherits from Foo. > > > > When I model my own compile_with_kawac method similar to the scala > method, > > this test fails. The reason it fails is because the java module Foo > hasn't > > been compiled when the kawa module Bar is being compiled. > > > > At first I suspected there might be something wrong in my compile_map > code, > > but after looking at it, it seems that the method does not even try to > > figure out build order at all, only mapping from source file to class > file. > > > > So how is build order decided in buildr? > > > > For this one test I added a workaround where I retry kawa compilation if > it > > fails the first time, but considering that I'm doing everything in a > > simliar way and order as the scala module, there's got to be something > I'm > > missing. Worst case, the scala compiler handles such dependencies itself. > > > > Anyway, figured I would ask, hoping somebody could clue me in. > > > > Thanks, > > > > Marius Kjeldahl > > > > -- > Cheers, > > Peter Donald >
