summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/ant/Scaladoc.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-12-05 02:56:08 +0000
committerPaul Phillips <paulp@improving.org>2010-12-05 02:56:08 +0000
commit77eb8fefec3e62ead95c7d409ec5a28f30289ec3 (patch)
tree5e035714a7e6363d1ae7f712d5b1f73c1d27d79e /src/compiler/scala/tools/ant/Scaladoc.scala
parent626e38940b72f5e8445ecbece4d41996b5e2842e (diff)
downloadscala-77eb8fefec3e62ead95c7d409ec5a28f30289ec3.tar.gz
scala-77eb8fefec3e62ead95c7d409ec5a28f30289ec3.tar.bz2
scala-77eb8fefec3e62ead95c7d409ec5a28f30289ec3.zip
Mopping up after the deprecation of exit and er...
Mopping up after the deprecation of exit and error. It is decidedly non-trivial (at least for the IDE-impaired) to be completely sure of which error function was being called when there were about twenty with the same signature in trunk and they are being variously inherited, imported, shadowed, etc. So although I was careful, the possibility exists that something is now calling a different "error" function than before. Caveat programmer. (And let's all make it our policy not to name anything "error" or "exit" from here on out....) No review.
Diffstat (limited to 'src/compiler/scala/tools/ant/Scaladoc.scala')
-rw-r--r--src/compiler/scala/tools/ant/Scaladoc.scala42
1 files changed, 16 insertions, 26 deletions
diff --git a/src/compiler/scala/tools/ant/Scaladoc.scala b/src/compiler/scala/tools/ant/Scaladoc.scala
index 427846fa33..be5311b471 100644
--- a/src/compiler/scala/tools/ant/Scaladoc.scala
+++ b/src/compiler/scala/tools/ant/Scaladoc.scala
@@ -12,7 +12,6 @@ package scala.tools.ant
import java.io.File
import org.apache.tools.ant.{BuildException, Project}
-import org.apache.tools.ant.taskdefs.MatchingTask
import org.apache.tools.ant.types.{Path, Reference}
import org.apache.tools.ant.util.{FileUtils, GlobPatternMapper}
@@ -61,7 +60,7 @@ import scala.tools.nsc.reporters.{Reporter, ConsoleReporter}
*
* @author Gilles Dubochet, Stephane Micheloud
*/
-class Scaladoc extends MatchingTask {
+class Scaladoc extends ScalaMatchingTask {
/** The unique Ant file utilities instance to use in this task. */
private val fileUtils = FileUtils.getFileUtils()
@@ -306,7 +305,7 @@ class Scaladoc extends MatchingTask {
if (Flag.isPermissible(input))
deprecation = "yes".equals(input) || "on".equals(input)
else
- error("Unknown deprecation flag '" + input + "'")
+ buildError("Unknown deprecation flag '" + input + "'")
}
/** Set the <code>unchecked</code> info attribute.
@@ -317,7 +316,7 @@ class Scaladoc extends MatchingTask {
if (Flag.isPermissible(input))
unchecked = "yes".equals(input) || "on".equals(input)
else
- error("Unknown unchecked flag '" + input + "'")
+ buildError("Unknown unchecked flag '" + input + "'")
}
/*============================================================================*\
@@ -330,7 +329,7 @@ class Scaladoc extends MatchingTask {
* @return The class path as a list of files.
*/
private def getClasspath: List[File] =
- if (classpath.isEmpty) error("Member 'classpath' is empty.")
+ if (classpath.isEmpty) buildError("Member 'classpath' is empty.")
else classpath.get.list().toList.map(nameToFile)
/** Gets the value of the <code>origin</code> attribute in a Scala-friendly
@@ -339,7 +338,7 @@ class Scaladoc extends MatchingTask {
* @return The origin path as a list of files.
*/
private def getOrigin: List[File] =
- if (origin.isEmpty) error("Member 'origin' is empty.")
+ if (origin.isEmpty) buildError("Member 'origin' is empty.")
else origin.get.list().toList.map(nameToFile)
/** Gets the value of the <code>destination</code> attribute in a
@@ -348,7 +347,7 @@ class Scaladoc extends MatchingTask {
* @return The destination as a file.
*/
private def getDestination: File =
- if (destination.isEmpty) error("Member 'destination' is empty.")
+ 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
@@ -357,7 +356,7 @@ class Scaladoc extends MatchingTask {
* @return The source path as a list of files.
*/
private def getSourcepath: List[File] =
- if (sourcepath.isEmpty) error("Member 'sourcepath' is empty.")
+ if (sourcepath.isEmpty) buildError("Member 'sourcepath' is empty.")
else sourcepath.get.list().toList.map(nameToFile)
/** Gets the value of the <code>bootclasspath</code> attribute in a
@@ -366,7 +365,7 @@ class Scaladoc extends MatchingTask {
* @return The boot class path as a list of files.
*/
private def getBootclasspath: List[File] =
- if (bootclasspath.isEmpty) error("Member 'bootclasspath' is empty.")
+ if (bootclasspath.isEmpty) buildError("Member 'bootclasspath' is empty.")
else bootclasspath.get.list().toList.map(nameToFile)
/** Gets the value of the <code>extdirs</code> attribute in a
@@ -375,7 +374,7 @@ class Scaladoc extends MatchingTask {
* @return The extensions path as a list of files.
*/
private def getExtdirs: List[File] =
- if (extdirs.isEmpty) error("Member 'extdirs' is empty.")
+ if (extdirs.isEmpty) buildError("Member 'extdirs' is empty.")
else extdirs.get.list().toList.map(nameToFile)
/*============================================================================*\
@@ -437,15 +436,6 @@ class Scaladoc extends MatchingTask {
private def asString(file: File): String =
file.getAbsolutePath()
- /** Generates a build error. Error location will be the current task in the
- * ant file.
- *
- * @param message A message describing the error.
- * @throws BuildException A build error exception thrown in every case.
- */
- private def error(message: String): Nothing =
- throw new BuildException(message, getLocation())
-
/*============================================================================*\
** The big execute method **
\*============================================================================*/
@@ -453,10 +443,10 @@ class Scaladoc extends MatchingTask {
/** Initializes settings and source files */
protected def initialize: Pair[Settings, List[File]] = {
// 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.")
+ if (origin.isEmpty) buildError("Attribute 'srcdir' is not set.")
+ if (getOrigin.isEmpty) buildError("Attribute 'srcdir' is not set.")
if (!destination.isEmpty && !destination.get.isDirectory())
- error("Attribute 'destdir' does not refer to an existing directory.")
+ buildError("Attribute 'destdir' does not refer to an existing directory.")
if (destination.isEmpty) destination = Some(getOrigin.head)
val mapper = new GlobPatternMapper()
@@ -501,7 +491,7 @@ class Scaladoc extends MatchingTask {
// Builds-up the compilation settings for Scalac with the existing Ant
// parameters.
- val docSettings = new Settings(error)
+ val docSettings = new Settings(buildError)
docSettings.outdir.value = asString(destination.get)
if (!classpath.isEmpty)
docSettings.classpath.value = asString(getClasspath)
@@ -532,7 +522,7 @@ class Scaladoc extends MatchingTask {
val docProcessor = new scala.tools.nsc.doc.DocFactory(reporter, docSettings)
docProcessor.document(sourceFiles.map (_.toString))
if (reporter.ERROR.count > 0)
- error(
+ buildError(
"Document failed with " +
reporter.ERROR.count + " error" +
(if (reporter.ERROR.count > 1) "s" else "") +
@@ -547,11 +537,11 @@ class Scaladoc extends MatchingTask {
} catch {
case exception: Throwable if exception.getMessage ne null =>
exception.printStackTrace()
- error("Document failed because of an internal documenter error (" +
+ buildError("Document failed because of an internal documenter error (" +
exception.getMessage + "); see the error output for details.")
case exception =>
exception.printStackTrace()
- error("Document failed because of an internal documenter error " +
+ buildError("Document failed because of an internal documenter error " +
"(no error message provided); see the error output for details.")
}
}