From e386ebdff8a1641dbe73cd84915ef9d5231db5d0 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 18 Nov 2011 16:53:09 +0000 Subject: Revert "Enable the use of spaces in paths for t... Revert "Enable the use of spaces in paths for the Scala build on Windows." This reverts the previous commit due to failure to build: BUILD FAILED /scratch/trunk1/build.xml:639: scalacfork doesn't support the nested "compilerarg" element. --- build.xml | 8 ++------ src/compiler/scala/tools/ant/sabbus/Make.scala | 2 +- src/compiler/scala/tools/ant/sabbus/ScalacFork.scala | 17 ++++------------- src/compiler/scala/tools/ant/sabbus/Settings.scala | 14 ++++++++------ src/compiler/scala/tools/ant/sabbus/TaskArgs.scala | 19 +++++-------------- tools/get-scala-revision.bat | 4 ++-- 6 files changed, 22 insertions(+), 42 deletions(-) diff --git a/build.xml b/build.xml index 4f359f8894..accaa92ec0 100644 --- a/build.xml +++ b/build.xml @@ -634,13 +634,11 @@ QUICK BUILD (QUICK) - - @@ -1149,13 +1147,11 @@ BOOTSTRAPPING BUILD (STRAP) - - diff --git a/src/compiler/scala/tools/ant/sabbus/Make.scala b/src/compiler/scala/tools/ant/sabbus/Make.scala index 57505420c5..75cd0105ac 100644 --- a/src/compiler/scala/tools/ant/sabbus/Make.scala +++ b/src/compiler/scala/tools/ant/sabbus/Make.scala @@ -21,7 +21,7 @@ class Make extends Task with TaskArgs { if (!compTarget.isEmpty) settings.target = compTarget.get if (!compilationPath.isEmpty) settings.classpath = compilationPath.get if (!sourcePath.isEmpty) settings.sourcepath = sourcePath.get - settings.extraParams = extraArgsFlat + if (!params.isEmpty) settings.more = params.get Compilers.make(id.get, (compilerPath.get.list.map{ path => new File(path).toURI.toURL }), settings) } } diff --git a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala index a39de64c5a..5da531146b 100644 --- a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala +++ b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala @@ -23,16 +23,14 @@ import scala.tools.nsc.util.ScalaClassLoader * - `failonerror`, * - `timeout`, * - `jvmargs`, - * - `argfile`, - * - `params`. + * - `argfile`. * * It also takes the following parameters as nested elements: * - `src` (for `srcdir`), * - `classpath`, * - `sourcepath`, * - `bootclasspath`, - * - `extdirs`, - * - `compilerarg`. + * - `extdirs`. * * @author Gilles Dubochet */ @@ -101,7 +99,7 @@ class ScalacFork extends ScalaMatchingTask with ScalacShared with TaskArgs { compTarget foreach (settings.target = _) compilationPath foreach (settings.classpath = _) sourcePath foreach (settings.sourcepath = _) - settings.extraParams = extraArgsFlat + params foreach (settings.more = _) if (isMSIL) settings.sourcedir = sourceDir @@ -134,17 +132,10 @@ class ScalacFork extends ScalaMatchingTask with ScalacShared with TaskArgs { java setClasspath compilerPath java setClassname MainClass - // Encode scalac/javac args for use in a file to be read back via "@file.txt" - def encodeScalacArgsFile(t: Traversable[String]) = t map { s => - if(s.find(c => c <= ' ' || "\"'\\".contains(c)).isDefined) - "\"" + s.flatMap(c => (if(c == '"' || c == '\\') "\\" else "") + c ) + "\"" - else s - } mkString "\n" - // dump the arguments to a file and do "java @file" val tempArgFile = io.File.makeTemp("scalacfork") val tokens = settings.toArgs ++ (includedFiles map (_.getPath)) - tempArgFile writeAll encodeScalacArgsFile(tokens) + tempArgFile writeAll (tokens mkString " ") val paths = List(Some(tempArgFile.toAbsolute.path), argfile).flatten map (_.toString) val res = execWithArgFiles(java, paths) diff --git a/src/compiler/scala/tools/ant/sabbus/Settings.scala b/src/compiler/scala/tools/ant/sabbus/Settings.scala index c62ea172ed..4d4e3cdb08 100644 --- a/src/compiler/scala/tools/ant/sabbus/Settings.scala +++ b/src/compiler/scala/tools/ant/sabbus/Settings.scala @@ -58,14 +58,16 @@ class Settings { def optimise = optimiseBf def optimise_=(b: Boolean) { optimiseBf = b } - private var extraParamsBf: Seq[String] = Seq() - def extraParams = extraParamsBf - def extraParams_=(s: Seq[String]): this.type = { extraParamsBf = s; this } + private var moreBf: Option[String] = None + def more = moreBf.get + def more_=(s: String): this.type = { moreBf = Some(s); this } + + private def q(o: AnyRef) = "\"" + o.toString.replace("""\""", """\\""") + "\"" def toArgs: List[String] = (if (!gBf.isEmpty) "-g:"+g :: Nil else Nil) ::: (if (uncheckedBf) "-unchecked" :: Nil else Nil) ::: - (if (!classpathBf.isEmpty) "-classpath" :: classpath.toString :: Nil else Nil) ::: + (if (!classpathBf.isEmpty) "-classpath" :: q(classpath) :: Nil else Nil) ::: (if (!sourcepathBf.isEmpty) "-sourcepath" :: sourcepath.toString :: Nil else Nil) ::: (if (!sourcedirBf.isEmpty) "-Xsourcedir" :: sourcedir.toString :: Nil else Nil) ::: (if (!bootclasspathBf.isEmpty) "-bootclasspath" :: bootclasspath.toString :: Nil else Nil) ::: @@ -74,7 +76,7 @@ class Settings { (if (!encodingBf.isEmpty) "-encoding" :: encoding :: Nil else Nil) ::: (if (!targetBf.isEmpty) "-target:"+target :: Nil else Nil) ::: (if (optimiseBf) "-optimise" :: Nil else Nil) ::: - extraParamsBf.toList + (if (!moreBf.isEmpty) (more split ' ').toList else Nil) override def equals(that: Any): Boolean = that match { case cs: Settings => @@ -89,7 +91,7 @@ class Settings { this.encodingBf == cs.encodingBf && this.targetBf == cs.targetBf && this.optimiseBf == cs.optimiseBf && - this.extraParamsBf == cs.extraParamsBf + this.moreBf == cs.moreBf case _ => false } diff --git a/src/compiler/scala/tools/ant/sabbus/TaskArgs.scala b/src/compiler/scala/tools/ant/sabbus/TaskArgs.scala index ca210f7187..b2487355e4 100644 --- a/src/compiler/scala/tools/ant/sabbus/TaskArgs.scala +++ b/src/compiler/scala/tools/ant/sabbus/TaskArgs.scala @@ -12,7 +12,6 @@ package scala.tools.ant.sabbus import java.io.File import org.apache.tools.ant.Task import org.apache.tools.ant.types.{Path, Reference} -import org.apache.tools.ant.types.Commandline.Argument trait CompilationPathProperty { this: Task => @@ -42,13 +41,10 @@ trait TaskArgs extends CompilationPathProperty { } def setParams(input: String) { - extraArgs ++= input.split(' ').map { s => val a = new Argument; a.setValue(s); a } - } - - def createCompilerArg(): Argument = { - val a = new Argument - extraArgs :+= a - a + params = params match { + case None => Some(input) + case Some(ps) => Some(ps + " " + input) + } } def setTarget(input: String) { @@ -88,16 +84,11 @@ trait TaskArgs extends CompilationPathProperty { } protected var id: Option[String] = None - protected var extraArgs: Seq[Argument] = Seq() + protected var params: Option[String] = None protected var compTarget: Option[String] = None protected var sourcePath: Option[Path] = None protected var compilerPath: Option[Path] = None protected var destinationDir: Option[File] = None - def extraArgsFlat: Seq[String] = extraArgs flatMap { a => - val parts = a.getParts - if(parts eq null) Seq[String]() else parts.toSeq - } - def isMSIL = compTarget exists (_ == "msil") } diff --git a/tools/get-scala-revision.bat b/tools/get-scala-revision.bat index 880bcc3f5c..c9de414cea 100644 --- a/tools/get-scala-revision.bat +++ b/tools/get-scala-revision.bat @@ -14,9 +14,9 @@ if "%OS%" NEQ "Windows_NT" ( set _DIR= if "%*"=="" ( - for /f "delims=;" %%i in ('cd') do set "_DIR=%%i" + for /f %%i in ('cd') do set _DIR=%%i ) else ( - set "_DIR=%~1" + set _DIR=%~1 ) cd %_DIR% -- cgit v1.2.3