fsc
– Fast offline compiler for the Scala 2 language
fsc
[ <options> ] <source files>
<options>
<source files>
MyClass.scala
).
The offline compiler supports all options of scalac
plus the following:
–reset
–shutdown
–server <hostname:portnumber>
–J<flag>
<flag>
directly to the Java VM for the compilation daemon.
The fsc
tool submits Scala compilation jobs to a compilation daemon. The first time it is executed, the daemon is started automatically. On subsequent runs, the same daemon can be reused, thus resulting in a faster compilation. The tool is especially effective when repeatedly compiling with the same class paths, because the compilation daemon can reuse a compiler instance.
The compilation daemon is smart enough to flush its cached compiler when the class path changes. However, if the contents of the class path change, for example due to upgrading a library, then the daemon should be explicitly shut down with -shutdown
.
Note that the scala
script runner will also use the offline compiler by default, with the same advantages and caveats.
The following session shows a typical speed up due to using the offline compiler.
> fsc -verbose -d /tmp test.scala \&... [Port number: 32834] [Starting new Scala compile server instance] [Classpath = ...] [loaded directory path ... in 692ms] \&... [parsing test.scala] \&... [total in 943ms] > fsc -verbose -d /tmp test.scala \&... [Port number: 32834] [parsing test.scala] \&... [total in 60ms] > fsc -verbose -d /tmp test.scala \&... [Port number: 32834] [parsing test.scala] \&... [total in 42ms] > fsc -verbose -shutdown [Scala compile server exited]
JAVACMD
java
command to be used for running the Scala code. Arguments may be specified as part of the environment variable; spaces, quotation marks, etc., will be passed directly to the shell for expansion.JAVA_HOME
java
command unless JAVACMD
variable set.JAVA_OPTS
java
command defined by JAVACMD
.
JAVA_OPTS="-Xmx512M -Xms16M -Xss16M"
JAVA_OPTS="--mx512m --ms16m"
fsc
returns a zero exit status if it succeeds to compile the specified input files. Non zero is returned in case of failure.
Written by Martin Odersky and other members of the Scala team.
Report bugs to https://issues.scala-lang.org/
.
This is open-source software, available to you under a BSD-like license. See accompanying "copyright" or "LICENSE" file for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
scala(1), scalac(1), scaladoc(1), scalap(1)