As you may know, the fsc compiler, the recommended way to compile Scala, and used by the Scala interpreter by default, detaches a daemon service the first time it is run. After that, fsc will always call the daemon service to compile for it, to save time.
It does this through TCP, which begs the question... can I compile remotely? The answer is Yes! It's not documented, and it is a bit awkward, but...
First, you get fsc running on the server by running fsc -verbose, like this:
$fsc -verbose [Server arguments: -d C:\Users\Daniel\Documents\Programas\. -verbose] [VM arguments: ] [Temp directory: C:\PROGRA~1\Scala\bin\..\var\scala-devel] [Executed command: C:\PROGRA~1\Scala\bin\..\bin\scala.bat scala.tools.nsc.CompileServer] [Port number: 1385] [Connected to compilation daemon at port 1385] Usage: fsc
This will get you the port number. Next, you can compile whatever you like from a remote client like this:
No comments:
Post a Comment