diff options
author | Paul Phillips <paulp@improving.org> | 2011-02-01 08:27:18 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-02-01 08:27:18 +0000 |
commit | ee4e09235afa578a7a33267061179ca338e396c0 (patch) | |
tree | 52ff21a786e84f0a3c47ef5666746591301cc47c /src/compiler/scala/tools/nsc/CompileClient.scala | |
parent | d59d7f928d8a71d73d198690ab5816af3be90d6b (diff) | |
download | scala-ee4e09235afa578a7a33267061179ca338e396c0.tar.gz scala-ee4e09235afa578a7a33267061179ca338e396c0.tar.bz2 scala-ee4e09235afa578a7a33267061179ca338e396c0.zip |
Eliminating duplication and trying to outrun ob...
Eliminating duplication and trying to outrun obsolescence in the
exciting world of fsc. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/CompileClient.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/CompileClient.scala | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/src/compiler/scala/tools/nsc/CompileClient.scala b/src/compiler/scala/tools/nsc/CompileClient.scala index b15aab7714..41b96bfcdd 100644 --- a/src/compiler/scala/tools/nsc/CompileClient.scala +++ b/src/compiler/scala/tools/nsc/CompileClient.scala @@ -14,8 +14,8 @@ import util.ClassPath /** The client part of the fsc offline compiler. Instead of compiling * things itself, it send requests to a CompileServer. */ -class StandardCompileClient { - def compileSocket: CompileSocket = CompileSocket // todo: should be lazy val +class StandardCompileClient extends CompileSocketShared { + lazy val compileSocket: CompileSocket = CompileSocket val versionMsg = "Fast " + Properties.versionMsg var verbose = false @@ -85,37 +85,19 @@ class StandardCompileClient { if (serverAdr == "") compileSocket.getOrCreateSocket(vmArgs, !shutdown) else Some(compileSocket.getSocket(serverAdr)) - val sawerror: Boolean = socket match { - case None => - val msg = if (shutdown) "[No compilation server running.]" else "Compilation failed." - Console println msg - !shutdown - - case Some(sock) => - var wasError = false - - sock.applyReaderAndWriter { (in, out) => - out println compileSocket.getPassword(sock.getPort()) - out println args.mkString("\0") - def loop: Unit = in.readLine() match { - case null => () - case fromServer => - if (compileSocket.errorPattern matcher fromServer matches) - wasError = true - - Console println fromServer - loop - } - loop - } - wasError + val success = socket match { + case Some(sock) => fscCompile(sock, args) + case _ => + Console.println( + if (shutdown) "[No compilation server running.]" else "Compilation failed." + ) + shutdown } - if (sawerror) 1 else 0 + if (success) 1 else 0 } +} +object CompileClient extends StandardCompileClient { def main(args: Array[String]): Unit = sys.exit(try main0(args) catch { case e: Exception => 1 }) } - - -object CompileClient extends StandardCompileClient |