fsc(1)

πŸ“¦
version 2.11.12 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– fsc β€” the offline compiler era πŸ’–

okay so bestie, you're looking at the manual page for fsc, section 1 of the USER COMMANDS, aka Fast offline compiler for the Scala 2 language. yes it's giving "my laptop is warm and I'm thriving". let's get into it πŸ¦‹


✨ NAME ✨

fsc β€” Fast offline compiler for the Scala 2 language


✨ SYNOPSIS ✨

fsc  [ <options> ] <source files>

✨ PARAMETERS ✨

  • <options> β€” command line options, bestie. the whole list lives down in OPTIONS πŸ‘‡
  • <source files> β€” one or more source files you wanna compile, like MyClass.scala. plural, she's flexible πŸ’…

✨ OPTIONS ✨

so the offline compiler supports all the options of scalac β€” all of them, no cap β€” plus these extra little icons:

  • -reset β€” reset compile server caches. clean slate energy ✨
  • -shutdown β€” shut down the compilation daemon. she tries to restart herself whenever she needs to, but sometimes you gotta be explicit and say "girl, log off". a super common reason is when jars on the class path have changed.
  • -server <hostname:portnumber> β€” specify the compile server host at that port number. usually you don't need this one. important though: the hostname has to be for a host that shares the same filesystem. sharing is caring, fr fr.
  • -J<flag> β€” pass <flag> directly to the Java VM for the compilation daemon. straight to the JVM, no middleman 🫢

✨ DESCRIPTION ✨

okay so here's the whole vibe: fsc submits Scala compilation jobs to a compilation daemon. the first time you run it, the daemon starts automatically, all by herself. on subsequent runs, the same daemon can be reused β€” which means faster compilation. the tool is especially effective when you're repeatedly compiling with the same class paths, because the compilation daemon can reuse a compiler instance. obsessed. πŸ‘‘

the compilation daemon is smart enough to flush its cached compiler when the class path changes. however β€” and listen, this part matters β€” if the contents of the class path change, for example because you upgraded a library, then the daemon should be explicitly shut down with -shutdown. don't let her cling to stale vibes 😭

also note: the scala script runner will use the offline compiler by default too, with all the same advantages and the same caveats. iykyk.

✨ EXAMPLE ✨

this session right here shows a typical speed up from using the offline compiler. watch the glow-up πŸ“ˆ

> 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]

look at that: 943ms β†’ 60ms β†’ 42ms. she ate and left no crumbs πŸ”₯


✨ ENVIRONMENT ✨

  • JAVACMD β€” specify the 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. she's not gonna clean it up for you, bestie, the shell handles it.
  • JAVA_HOME β€” specify the JDK/JRE home directory. this directory is used to locate the java command unless JAVACMD variable set.
  • JAVA_OPTS β€” specify the options to be passed to the java command defined by JAVACMD.

with Java 1.5 (or newer) one may for example configure the memory usage of the JVM as follows: JAVA_OPTS="-Xmx512M -Xms16M -Xss16M" 🧚


✨ EXIT STATUS ✨

fsc returns a zero exit status if it succeeds to compile the specified input files. non zero is returned in case of failure. zero = slay, non-zero = not slay πŸ’€


✨ AUTHOR ✨

written by Martin Odersky and other members of the Scala team. shoutout the whole team 🫢


✨ REPORTING BUGS ✨

report bugs to https://issues.scala-lang.org/. please do, they wanna know πŸ™ˆ


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. like, none. zero. read the LICENSE, bestie πŸ’…

✨ SEE ALSO ✨

scala(1), scalac(1), scaladoc(1), scalap(1) β€” the whole friend group 🌈


and that's the page, bestie! this was version 0.5, dated March 2012, and it lives under section fsc(1). yes we're reading a 2012 manpage and yes it's still iconic. take care of your daemon, shut her down when your classpath changes, and go compile something beautiful βœ¨πŸŽ€πŸ’–

πŸ“¦ where this page comes from