diff options
author | Paul Phillips <paulp@improving.org> | 2010-03-23 21:58:49 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-03-23 21:58:49 +0000 |
commit | 787e286505f4094e76da75038edd44f6e6d5a37f (patch) | |
tree | 66950389b0f3ccdd017800895ad5f2338a34f68d /src/compiler/scala/tools/nsc/CompilerCommand.scala | |
parent | c44c00ce7667e7d51d04d6e8ea4bc401d87b0c30 (diff) | |
download | scala-787e286505f4094e76da75038edd44f6e6d5a37f.tar.gz scala-787e286505f4094e76da75038edd44f6e6d5a37f.tar.bz2 scala-787e286505f4094e76da75038edd44f6e6d5a37f.zip |
Removed ArgumentsExpander in favor of having al...
Removed ArgumentsExpander in favor of having all arguments parsed the
same way. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/CompilerCommand.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/CompilerCommand.scala | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilerCommand.scala b/src/compiler/scala/tools/nsc/CompilerCommand.scala index f24bef9b60..0ef2bcb85d 100644 --- a/src/compiler/scala/tools/nsc/CompilerCommand.scala +++ b/src/compiler/scala/tools/nsc/CompilerCommand.scala @@ -8,7 +8,7 @@ package scala.tools.nsc import java.io.IOException import scala.collection.mutable.ListBuffer -import scala.tools.nsc.util.ArgumentsExpander +import io.File /** A class representing command line info for scalac */ class CompilerCommand( @@ -70,6 +70,19 @@ class CompilerCommand( case None => "" } + /** + * Expands all arguments starting with @ to the contents of the + * file named like each argument. + */ + def expandArg(arg: String): List[String] = { + def stripComment(s: String) = s takeWhile (_ != '#') + val file = File(arg stripPrefix "@") + if (!file.exists) + throw new java.io.FileNotFoundException("argument file %s could not be found" format file.name) + + settings splitParams (file.lines() map stripComment mkString " ") + } + // CompilerCommand needs processArguments called at the end of its constructor, // as does its subclass GenericRunnerCommand, but it cannot be called twice as it // accumulates arguments. The fact that it's called from within the constructors @@ -78,7 +91,7 @@ class CompilerCommand( if (shouldProcessArguments) { // expand out @filename to the contents of that filename val expandedArguments = arguments flatMap { - case x if x startsWith "@" => ArgumentsExpander expandArg x + case x if x startsWith "@" => expandArg(x) case x => List(x) } |