FSC re-compiles my scripts files every time, even there is no need - between the efforts I can compile it twice without editing anything, recompiles them! For example, I have 2 files
HelloScale
class Hello {print ("Hello")}
and token. Scala:
When I compile the project from scratch, I got the following output: I got the following output:
I do not edit a Ything and ask re-compute ant:
ant compile init: [mkdir] created dir: D: \ Projects \ test \ build \ classes [mkdir] created dir: D: \ projects \ Test \ Build \ test \ classes compile: [fsc] Base directory is `D: \ Projects \ Test '[FSC] compiling source files : Some packages \ tokens. Callah: Projects \ test \ build \ class builds are successful
As you can see, FSC, Hello Scala (no re-assemble ) In the case of clever acts and dumb in the case of Tokens.scala. I suggest that the problem is related to heritage in some way, but it is all.
So what's wrong?
I do not like the posting content written by other people, but I think this question is more Strictly answers what was strictly asked.
So, firstly, FSC
recompiles everything by default, period. This is not ant
, fsc
, which is leaving hellocall
, because the name of the file matches the class name. This Tokens.scala
is not being dropped because the Tokens
is not a class compiled - therefore, due to the absence of Tokens.class
, it Tokens.scala
has been compiled again.
It is wrong to do this with Scala, Scala is different from Java in a fundamental aspect, because due to technical limitations on JVM, a change in
Now, a clever thing with Scala 2.8 can fix a ant
task. I am taking this information from Kaoyuan, for the sake of the Netbeans of the Scala Plugin. You can define scala work at the following types of construction goals:
& lt; Scalac srcdir = "$ {src.dir}" destdir = "$ {build.classes.dir}" classpathref = "Build.classpath" force = "yes" adeperm = "- create: transitive-dispensing file $ {build.dir} / Scala_account "& gt; & Lt; Src path = "$ {baseir} / src1" /> & Lt ;! - Include name = "compile / ** / * scala" / - & gt; & Lt ;! - Leave the name = "forget / ** / * scala" / - & gt; & Lt; / Scalac & gt; It tells ant
to recompile everything, because ant
is simply not enough to understand whether it has been compiled again Need to go or not. It also asks Scala to create a file containing compilation dependencies, and using an infected dependency algorithm to determine whether it needs to be compiled again or not.
You aim to include the build directory in the intbuild classpath, as Scala will need to compile the other classes again. It should look like this:
& lt; Path id = "build.classpath" & gt; & Lt; Pathelement location = "$ {scala-library.jar}" /> & Lt; Pathelement location = "$ {scala-compiler.jar}" /> & Lt; Pathelement = "$ {build.classes.dir}" /> & Lt; / Path & gt;
For more information, please visit Chaoyuan's blog.
Comments
Post a Comment