diff options
author | Lex Spoon <lex@lexspoon.org> | 2007-06-12 22:13:49 +0000 |
---|---|---|
committer | Lex Spoon <lex@lexspoon.org> | 2007-06-12 22:13:49 +0000 |
commit | 54b23b83942201d69a74748aa8c1b7733f48123a (patch) | |
tree | 8a271a2ab6283e4a1cdad63d2fcf23dbd3718eb5 | |
parent | 273405850c5d30bb5b837bfc3142caf71357cccc (diff) | |
download | scala-54b23b83942201d69a74748aa8c1b7733f48123a.tar.gz scala-54b23b83942201d69a74748aa8c1b7733f48123a.tar.bz2 scala-54b23b83942201d69a74748aa8c1b7733f48123a.zip |
added a few hooks so that scalac variants
can reuse this code by subclassing
-rw-r--r-- | src/compiler/scala/tools/ant/Scalac.scala | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index f84536543a..7f5573c1bc 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -430,6 +430,18 @@ class Scalac extends MatchingTask { private def error(message: String): Nothing = throw new BuildException(message, getLocation()) + +/*============================================================================*\ +** Hooks for variants of Scala ** +\*============================================================================*/ + + protected val sourceEnding = ".scala" + protected def newSettings(error: String=>Unit): Settings = + new Settings(error) + protected def newGlobal(settings: Settings, reporter: Reporter) = + new Global(settings, reporter) + + /*============================================================================*\ ** The big execute method ** \*============================================================================*/ @@ -445,7 +457,7 @@ class Scalac extends MatchingTask { val mapper = new GlobPatternMapper() mapper.setTo("*.class") - mapper.setFrom("*.scala") + mapper.setFrom("*" + sourceEnding) // Scans source directories to build up a compile lists. // If force is false, only files were the .class file in destination is @@ -489,7 +501,7 @@ class Scalac extends MatchingTask { // Builds-up the compilation settings for Scalac with the existing Ant // parameters. - val settings = new Settings(error) + val settings = newSettings(error) settings.outdir.value = asString(destination.get) if (!classpath.isEmpty) settings.classpath.value = asString(getClasspath) @@ -540,7 +552,7 @@ class Scalac extends MatchingTask { val reporter = new ConsoleReporter(settings) // Compiles the actual code - val compiler = new Global(settings, reporter) + val compiler = newGlobal(settings, reporter) try { (new compiler.Run).compile(sourceFiles.map (_.toString)) } |