diff options
author | michelou <michelou@epfl.ch> | 2011-07-20 21:52:50 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2011-07-20 21:52:50 +0000 |
commit | c0ddb8f941dcb4ec0ca0aae0739406352e17cdfa (patch) | |
tree | d2107fa9c923dbd53f1c17cd8d4b6159b15b7768 /src/compiler/scala/tools/ant/Scalac.scala | |
parent | 628c0265aaeaab8ef84dfc623d45119972f83656 (diff) | |
download | scala-c0ddb8f941dcb4ec0ca0aae0739406352e17cdfa.tar.gz scala-c0ddb8f941dcb4ec0ca0aae0739406352e17cdfa.tar.bz2 scala-c0ddb8f941dcb4ec0ca0aae0739406352e17cdfa.zip |
4th round of clean ups (see r25293, r25285, r25...
4th round of clean ups (see r25293, r25285, r25292)
Diffstat (limited to 'src/compiler/scala/tools/ant/Scalac.scala')
-rw-r--r-- | src/compiler/scala/tools/ant/Scalac.scala | 208 |
1 files changed, 99 insertions, 109 deletions
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index f8d5f74f50..01e35ac70a 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -6,7 +6,6 @@ ** |/ ** \* */ - package scala.tools.ant import java.io.{File,PrintWriter,BufferedWriter,FileWriter} @@ -20,51 +19,43 @@ import org.apache.tools.ant.util.{FileUtils, GlobPatternMapper, import scala.tools.nsc.{Global, Settings, CompilerCommand} import scala.tools.nsc.reporters.{Reporter, ConsoleReporter} -/** <p> - * An Ant task to compile with the new Scala compiler (NSC). - * </p> - * <p> - * This task can take the following parameters as attributes: - * </p> - * <ul style="font-family:Courier;"> - * <li>srcdir (mandatory),</li> - * <li>srcref,</li> - * <li>destdir,</li> - * <li>classpath,</li> - * <li>classpathref,</li> - * <li>sourcepath,</li> - * <li>sourcepathref,</li> - * <li>bootclasspath,</li> - * <li>bootclasspathref,</li> - * <li>extdirs,</li> - * <li>extdirsref,</li> - * <li>encoding,</li> - * <li>target,</li> - * <li>force,</li> - * <li>fork,</li> - * <li>logging,</li> - * <li>logphase,</li> - * <li>debuginfo,</li> - * <li>addparams,</li> - * <li>scalacdebugging,</li> - * <li>deprecation,</li> - * <li>optimise,</li> - * <li>unchecked,</li> - * <li>failonerror,</li> - * <li>scalacdebugging,</li> - * <li>assemname,</li> - * <li>assemrefs.</li> - * </ul> - * <p> - * It also takes the following parameters as nested elements: - * </p> - * <ul> - * <li>src (for srcdir),</li> - * <li>classpath,</li> - * <li>sourcepath,</li> - * <li>bootclasspath,</li> - * <li>extdirs.</li> - * </ul> +/** An Ant task to compile with the new Scala compiler (NSC). + * + * This task can take the following parameters as attributes: + * - `srcdir` (mandatory), + * - `srcref`, + * - `destdir`, + * - `classpath`, + * - `classpathref`, + * - `sourcepath`, + * - `sourcepathref`, + * - `bootclasspath`, + * - `bootclasspathref`, + * - `extdirs`, + * - `extdirsref`, + * - `encoding`, + * - `target`, + * - `force`, + * - `fork`, + * - `logging`, + * - `logphase`, + * - `debuginfo`, + * - `addparams`, + * - `scalacdebugging`, + * - `deprecation`, + * - `optimise`, + * - `unchecked`, + * - `failonerror`, + * - `scalacdebugging`, + * - `assemname`, + * - `assemrefs`. + * + * It also takes the following parameters as nested elements: + * - `src` (for `srcdir`), + * - `classpath`, + * - `sourcepath`, + * - `bootclasspath`, + * - `extdirs`. * * @author Gilles Dubochet, Stephane Micheloud */ @@ -96,13 +87,12 @@ class Scalac extends ScalaMatchingTask with ScalacShared { "terminal") } - /** Defines valid values for the <code>target</code> property. */ + /** Defines valid values for the `target` property. */ object Target extends PermissibleValue { val values = List("jvm-1.5", "msil") } - /** Defines valid values for the <code>deprecation</code> and - * <code>unchecked</code> properties. */ + /** Defines valid values for the `deprecation` and `unchecked` properties. */ object Flag extends PermissibleValue { val values = List("yes", "no", "on", "off", "true", "false") def toBoolean(flag: String) = @@ -191,137 +181,137 @@ class Scalac extends ScalaMatchingTask with ScalacShared { \*============================================================================*/ - /** Sets the srcdir attribute. Used by Ant. - * @param input The value of <code>origin</code>. */ + /** Sets the srcdir attribute. Used by [[http://ant.apache.org Ant]]. + * @param input The value of `origin`. */ def setSrcdir(input: Path) { origin = setOrAppend(origin, input) } - /** Sets the <code>origin</code> as a nested src Ant parameter. + /** Sets the `origin` as a nested src Ant parameter. * @return An origin path to be configured. */ def createSrc(): Path = createNewPath(origin _, p => origin = p) - /** Sets the <code>origin</code> as an external reference Ant parameter. + /** Sets the `origin` as an external reference Ant parameter. * @param input A reference to an origin path. */ def setSrcref(input: Reference) = createSrc().setRefid(input) - /** Sets the <code>destdir</code> attribute. Used by Ant. - * @param input The value of <code>destination</code>. */ + /** Sets the `destdir` attribute. Used by [[http://ant.apache.org Ant]]. + * @param input The value of `destination`. */ def setDestdir(input: File) { destination = Some(input) } - /** Sets the <code>classpath</code> attribute. Used by Ant. - * @param input The value of <code>classpath</code>. */ + /** Sets the `classpath` attribute. Used by [[http://ant.apache.org Ant]]. + * @param input The value of `classpath`. */ def setClasspath(input: Path) { classpath = setOrAppend(classpath, input) } - /** Sets the <code>compilerPath</code> attribute. Used by Ant. - * @param input The value of <code>compilerPath</code>. */ + /** Sets the `compilerPath` attribute. Used by [[http://ant.apache.org Ant]]. + * @param input The value of `compilerPath`. */ def setCompilerPath(input : Path) { compilerPath = setOrAppend(compilerPath, input) } def createCompilerPath: Path = createNewPath(compilerPath _, p => compilerPath = p) - /** Sets the <code>compilerpathref</code> attribute. Used by Ant. - * @param input The value of <code>compilerpathref</code>. */ + /** Sets the `compilerpathref` attribute. Used by Ant. + * @param input The value of `compilerpathref`. */ def setCompilerPathRef(input: Reference) { createCompilerPath.setRefid(input) } - /** Sets the <code>classpath</code> as a nested classpath Ant parameter. + /** Sets the `classpath` as a nested classpath Ant parameter. * @return A class path to be configured. */ def createClasspath(): Path = createNewPath(classpath _, p => classpath = p) - /** Sets the <code>classpath</code> as an external reference Ant parameter. + /** Sets the `classpath` as an external reference Ant parameter. * @param input A reference to a class path. */ def setClasspathref(input: Reference) { createClasspath().setRefid(input) } - /** Sets the <code>sourcepath</code> attribute. Used by Ant. - * @param input The value of <code>sourcepath</code>. */ + /** Sets the `sourcepath` attribute. Used by [[http://ant.apache.org Ant]]. + * @param input The value of `sourcepath`. */ def setSourcepath(input: Path) { sourcepath = setOrAppend(sourcepath, input) } - /** Sets the <code>sourcepath</code> as a nested sourcepath Ant parameter. + /** Sets the `sourcepath` as a nested sourcepath Ant parameter. * @return A source path to be configured. */ def createSourcepath(): Path = createNewPath(sourcepath _, p => sourcepath = p) - /** Sets the <code>sourcepath</code> as an external reference Ant parameter. + /** Sets the `sourcepath` as an external reference Ant parameter. * @param input A reference to a source path. */ def setSourcepathref(input: Reference) { createSourcepath().setRefid(input) } - /** Sets the boot classpath attribute. Used by Ant. + /** Sets the boot classpath attribute. Used by [[http://ant.apache.org Ant]]. * - * @param input The value of <code>bootclasspath</code>. */ + * @param input The value of `bootclasspath`. */ def setBootclasspath(input: Path) { bootclasspath = setOrAppend(bootclasspath, input) } - /** Sets the <code>bootclasspath</code> as a nested sourcepath Ant + /** Sets the `bootclasspath` as a nested sourcepath Ant * parameter. * @return A source path to be configured. */ def createBootclasspath(): Path = createNewPath(bootclasspath _, p => bootclasspath = p) - /** Sets the <code>bootclasspath</code> as an external reference Ant + /** Sets the `bootclasspath` as an external reference Ant * parameter. * @param input A reference to a source path. */ def setBootclasspathref(input: Reference) = createBootclasspath().setRefid(input) /** Sets the external extensions path attribute. Used by Ant. - * @param input The value of <code>extdirs</code>. */ + * @param input The value of `extdirs`. */ def setExtdirs(input: Path) = extdirs = setOrAppend(extdirs, input) - /** Sets the <code>extdirs</code> as a nested sourcepath Ant parameter. + /** Sets the `extdirs` as a nested sourcepath Ant parameter. * @return An extensions path to be configured. */ def createExtdirs(): Path = createNewPath(extdirs _, p => extdirs = p) - /** Sets the <code>extdirs</code> as an external reference Ant parameter. + /** Sets the `extdirs` as an external reference Ant parameter. * @param input A reference to an extensions path. */ def setExtdirsref(input: Reference) = createExtdirs().setRefid(input) - /** Sets the <code>encoding</code> attribute. Used by Ant. - * @param input The value of <code>encoding</code>. */ + /** Sets the `encoding` attribute. Used by Ant. + * @param input The value of `encoding`. */ def setEncoding(input: String): Unit = encoding = Some(input) - /** Sets the <code>target</code> attribute. Used by Ant. - * @param input The value for <code>target</code>. */ + /** Sets the `target` attribute. Used by Ant. + * @param input The value for `target`. */ def setTarget(input: String): Unit = if (Target.isPermissible(input)) backend = Some(input) else buildError("Unknown target '" + input + "'") - /** Sets the <code>force</code> attribute. Used by Ant. - * @param input The value for <code>force</code>. */ + /** Sets the `force` attribute. Used by Ant. + * @param input The value for `force`. */ def setForce(input: Boolean) { force = input } - /** Sets the <code>fork</code> attribute. Used by Ant. - * @param input The value for <code>fork</code>. */ + /** Sets the `fork` attribute. Used by Ant. + * @param input The value for `fork`. */ def setFork(input : Boolean) { fork = input } /** - * Sets the <code>jvmargs</code> attribute. Used by Ant. - * @param input The value for <code>jvmargs</code> + * Sets the `jvmargs` attribute. Used by Ant. + * @param input The value for `jvmargs` */ def setJvmargs(input : String) { jvmArgs = Some(input) } /** Sets the logging level attribute. Used by Ant. - * @param input The value for <code>logging</code>. */ + * @param input The value for `logging`. */ def setLogging(input: String) { if (LoggingLevel.isPermissible(input)) logging = Some(input) else buildError("Logging level '" + input + "' does not exist.") } - /** Sets the <code>logphase</code> attribute. Used by Ant. - * @param input The value for <code>logPhase</code>. */ + /** Sets the `logphase` attribute. Used by Ant. + * @param input The value for `logPhase`. */ def setLogPhase(input: String) { logPhase = input.split(",").toList.flatMap { s: String => val st = s.trim() @@ -333,38 +323,38 @@ class Scalac extends ScalaMatchingTask with ScalacShared { } } - /** Set the <code>debug</code> info attribute. - * @param input The value for <code>debug</code>. */ + /** Set the `debug` info attribute. + * @param input The value for `debug`. */ def setDebuginfo(input: String) { debugInfo = Some(input) } - /** Set the <code>addparams</code> info attribute. - * @param input The value for <code>addparams</code>. */ + /** Set the `addparams` info attribute. + * @param input The value for `addparams`. */ def setAddparams(input: String) { addParams = input } - /** Set the <code>deprecation</code> info attribute. - * @param input One of the flags <code>yes/no</code> or <code>on/off</code>. */ + /** Set the `deprecation` info attribute. + * @param input One of the flags `yes/no` or `on/off`. */ def setDeprecation(input: String) { deprecation = Flag toBoolean input orElse buildError("Unknown deprecation flag '" + input + "'") } - /** Set the <code>optimise</code> info attribute. - * @param input One of the flags <code>yes/no</code> or <code>on/off</code>. */ + /** Set the `optimise` info attribute. + * @param input One of the flags `yes/no` or `on/off`. */ def setOptimise(input: String) { optimise = Flag toBoolean input orElse buildError("Unknown optimisation flag '" + input + "'") } - /** Set the <code>unchecked</code> info attribute. - * @param input One of the flags <code>yes/no</code> or <code>on/off</code>. */ + /** Set the `unchecked` info attribute. + * @param input One of the flags `yes/no` or `on/off`. */ def setUnchecked(input: String) { unchecked = Flag toBoolean input orElse buildError("Unknown unchecked flag '" + input + "'") } - /** Sets the <code>force</code> attribute. Used by Ant. - * @param input The value for <code>force</code>. */ + /** Sets the `force` attribute. Used by Ant. + * @param input The value for `force`. */ def setFailonerror(input: Boolean) { failonerror = input } - /** Set the <code>scalacdebugging</code> info attribute. If set to - * <code>true</code>, the scalac ant task will print out the filenames + /** Set the `scalacdebugging` info attribute. If set to + * `'''true'''`, the scalac ant task will print out the filenames * being compiled. * @param input The specified flag */ def setScalacdebugging(input: Boolean) { scalacDebugging = input } @@ -376,34 +366,34 @@ class Scalac extends ScalaMatchingTask with ScalacShared { ** Properties getters ** \*============================================================================*/ - /** Gets the value of the <code>classpath</code> attribute in a + /** Gets the value of the `classpath` attribute in a * Scala-friendly form. * @return The class path as a list of files. */ protected def getClasspath: List[File] = pathAsList(classpath, "classpath") - /** Gets the value of the <code>origin</code> attribute in a + /** Gets the value of the `origin` attribute in a * Scala-friendly form. * @return The origin path as a list of files. */ protected def getOrigin: List[File] = pathAsList(origin, "origin") - /** Gets the value of the <code>destination</code> attribute in a + /** Gets the value of the `destination` attribute in a * Scala-friendly form. * @return The destination as a file. */ protected def getDestination: File = if (destination.isEmpty) buildError("Member 'destination' is empty.") else existing(getProject().resolveFile(destination.get.toString)) - /** Gets the value of the <code>sourcepath</code> attribute in a + /** Gets the value of the `sourcepath` attribute in a * Scala-friendly form. * @return The source path as a list of files. */ protected def getSourcepath: List[File] = pathAsList(sourcepath, "sourcepath") - /** Gets the value of the <code>bootclasspath</code> attribute in a + /** Gets the value of the `bootclasspath` attribute in a * Scala-friendly form. * @return The boot class path as a list of files. */ protected def getBootclasspath: List[File] = pathAsList(bootclasspath, "bootclasspath") - /** Gets the value of the <code>extdirs</code> attribute in a + /** Gets the value of the `extdirs` attribute in a * Scala-friendly form. * @return The extensions path as a list of files. */ protected def getExtdirs: List[File] = pathAsList(extdirs, "extdirs") @@ -441,13 +431,13 @@ class Scalac extends ScalaMatchingTask with ScalacShared { /** Transforms a path into a Scalac-readable string. * @param path A path to convert. - * @return A string-representation of the path like <code>a.jar:b.jar</code>. */ + * @return A string-representation of the path like `a.jar:b.jar`. */ protected def asString(path: List[File]): String = path.map(asString).mkString(File.pathSeparator) /** Transforms a file into a Scalac-readable string. * @param path A file to convert. - * @return A string-representation of the file like <code>/x/k/a.scala</code>. */ + * @return A string-representation of the file like `/x/k/a.scala`. */ protected def asString(file: File): String = file.getAbsolutePath() |