diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-03-24 16:33:32 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-03-24 16:33:32 +0000 |
commit | ba2bb4c1a126305e6d1b0e34a341fa16e9abd4e0 (patch) | |
tree | 0236c811237a393e97465e0f04fa4e20f21ca2fe /src | |
parent | a2bfe6eef5294f9bd6347ab98c171db4bc6fe78d (diff) | |
download | scala-ba2bb4c1a126305e6d1b0e34a341fa16e9abd4e0.tar.gz scala-ba2bb4c1a126305e6d1b0e34a341fa16e9abd4e0.tar.bz2 scala-ba2bb4c1a126305e6d1b0e34a341fa16e9abd4e0.zip |
scalac ant task now supports @argfile (needed t...
scalac ant task now supports @argfile (needed to build .net on windows)
Diffstat (limited to 'src')
-rw-r--r-- | src/build/msil.xml | 17 | ||||
-rw-r--r-- | src/compiler/scala/tools/ant/Scalac.scala | 24 |
2 files changed, 33 insertions, 8 deletions
diff --git a/src/build/msil.xml b/src/build/msil.xml index 1f4e610c76..c5675d23d7 100644 --- a/src/build/msil.xml +++ b/src/build/msil.xml @@ -132,16 +132,27 @@ MSIL BUILD <mkdir dir="${build-msil.dir}/library"/> <!-- <ilasm srcdir="${msil.dir}/il" includes="*.msil" outputfile="${msil.dir}/lib/predef.dll"/> --> + <pathconvert property="msil.lib.files" pathsep=" "> + <fileset dir="${build-msil-src.dir}"> + <include name="**/*.scala"/> + <exclude name="scala/ScalaObject.scala"/> + </fileset> + </pathconvert> + + <echo message="${msil.lib.files}" file="${build-msil-src.dir}/libfiles"/> + <scalac srcdir="${build-msil-src.dir}" destdir="${build-msil.dir}/library" target="msil" assemname="predef.msil" - assemrefs="${lib.dir}"> - <include name="**/*.scala"/> - <exclude name="scala/ScalaObject.scala"/> + assemrefs="${lib.dir}" + argfile="${build-msil-src.dir}/libfiles"> + <exclude name="**"/> <!-- files are in @libfiles --> </scalac> <stopwatch name="msil.lib.timer" action="total"/> + + <delete file="${build-msil-src.dir}/libfiles"/> </target> <target name="msil.done" depends="msil.lib"/> diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index f4cbcf1bf8..a7ff39ec0e 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -18,7 +18,7 @@ import org.apache.tools.ant.types.{Path, Reference} import org.apache.tools.ant.util.{FileUtils, GlobPatternMapper, SourceFileScanner} -import scala.tools.nsc.{Global, Settings} +import scala.tools.nsc.{Global, Settings, CompilerCommand} import scala.tools.nsc.reporters.{Reporter, ConsoleReporter} /** <p> @@ -157,6 +157,9 @@ class Scalac extends MatchingTask { * (not only the number of files). */ protected var scalacDebugging: Boolean = false + /** An optional file containing compiler arguments */ + protected var argfile: Option[File] = None + /*============================================================================*\ ** Properties setters ** \*============================================================================*/ @@ -349,6 +352,10 @@ class Scalac extends MatchingTask { def setAssemrefs(input: String) { assemrefs = Some(input) } + + /** Sets the <code>argfile</code> attribute. */ + def setArgfile(input: File) { argfile = Some(input) } + /*============================================================================*\ ** Properties getters ** \*============================================================================*/ @@ -457,6 +464,7 @@ class Scalac extends MatchingTask { protected def newSettings(error: String=>Unit): Settings = new Settings(error) + protected def newGlobal(settings: Settings, reporter: Reporter) = new Global(settings, reporter) @@ -466,7 +474,7 @@ class Scalac extends MatchingTask { \*============================================================================*/ /** Initializes settings and source files */ - protected def initialize: (Settings, List[File], Boolean) = { + protected def initialize: (Settings, List[String], Boolean) = { // Tests if all mandatory attributes are set and valid. if (origin.isEmpty) error("Attribute 'srcdir' is not set.") if (getOrigin.isEmpty) error("Attribute 'srcdir' is not set.") @@ -483,7 +491,7 @@ class Scalac extends MatchingTask { // Scans source directories to build up a compile lists. // If force is false, only files were the .class file in destination is // older than the .scala file will be used. - val sourceFiles: List[File] = + var sourceFiles: List[String] = for { val originDir <- getOrigin val originFiles <- { @@ -521,12 +529,18 @@ class Scalac extends MatchingTask { } yield { log(originFiles, Project.MSG_DEBUG) - nameToFile(originDir)(originFiles) + nameToFile(originDir)(originFiles).toString } // Builds-up the compilation settings for Scalac with the existing Ant // parameters. val settings = newSettings(error) + if (!argfile.isEmpty) { + log("Using argument file: @" +argfile.get) + javaOnly = false // not quite correct, depends on content of argfile + val command = new CompilerCommand(List("@"+ argfile.get), settings, error, true) + sourceFiles = sourceFiles ::: command.files + } settings.outdir.value = asString(destination.get) if (!classpath.isEmpty) settings.classpath.value = asString(getClasspath) @@ -572,7 +586,7 @@ class Scalac extends MatchingTask { // Compiles the actual code val compiler = newGlobal(settings, reporter) try { - (new compiler.Run).compile(sourceFiles.map (_.toString)) + (new compiler.Run).compile(sourceFiles) } catch { case exception: Throwable if (exception.getMessage ne null) => |