From 8bafc41b19deca3b95877633dd07ffa38c42feec Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 12 Mar 2009 18:15:25 +0000 Subject: A big cleanup of Settings code. manage existing settings and add new ones. It's paving the way for low-fuss scalac preferences so we can exert fine grained config file based control over compiler behavior. --- .../scala/tools/nsc/GenericRunnerSettings.scala | 50 +--------------------- 1 file changed, 1 insertion(+), 49 deletions(-) (limited to 'src/compiler/scala/tools/nsc/GenericRunnerSettings.scala') diff --git a/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala b/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala index fc69df6203..0e23681ed6 100644 --- a/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala +++ b/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala @@ -7,9 +7,6 @@ package scala.tools.nsc -import java.lang.System.getProperties -import scala.collection.mutable.Queue - class GenericRunnerSettings(error: String => Unit) extends Settings(error) { val howtorun = @@ -42,50 +39,5 @@ extends Settings(error) { "-nocompdaemon", "do not use the fsc compilation daemon") - - /** For some reason, "object defines extends Setting(...)" - * does not work here. The object is present but the setting - * is not added to allsettings. Thus, - */ - class DefinesSetting extends Setting("set a Java property") { - - def name = "-D" - - private val props = new Queue[(String, String)] - - def value = props.toList - - def tryToSet(args: List[String]): List[String] = { - args match { - case arg0::rest - if arg0.startsWith("-D") => - val stripD = arg0.substring(2) - val eqidx = stripD.indexOf('=') - val addition = - if (eqidx < 0) - (stripD, "") - else - (stripD.substring(0, eqidx), stripD.substring(eqidx+1)) - props += addition - rest - - case _ => args - } - } - - /** Apply the specified properties to the current JVM */ - def applyToCurrentJVM = { - val systemProps = getProperties - for ((key, value) <- props.toList) - systemProps.setProperty(key, value) - } - - def unparse: List[String] = - (props.toList.foldLeft[List[String]] - (Nil) - ((args, prop) => - ("-D" + prop._1 + "=" + prop._2) :: args)) - } - - val defines = new DefinesSetting + val defines = DefinesSetting } -- cgit v1.2.3