summaryrefslogtreecommitdiff
path: root/src/scaladoc/scala/tools/nsc/ScalaDoc.scala
diff options
context:
space:
mode:
authorDavid Turner <dturner@twitter.com>2014-10-04 00:44:07 -0400
committerDavid Turner <dturner@twitter.com>2014-10-04 00:44:07 -0400
commit5f29a264469b6ae161d9a98fe76d3f6466d82b12 (patch)
tree2e4749b146eedf41e5ebb60113f2678bb46b1a93 /src/scaladoc/scala/tools/nsc/ScalaDoc.scala
parent192d65f718ab042cb57090d580c83e15a0509964 (diff)
downloadscala-5f29a264469b6ae161d9a98fe76d3f6466d82b12.tar.gz
scala-5f29a264469b6ae161d9a98fe76d3f6466d82b12.tar.bz2
scala-5f29a264469b6ae161d9a98fe76d3f6466d82b12.zip
Make Scaladoc actually exit with non-zero exit code in case of errors,
as its docs say it does.
Diffstat (limited to 'src/scaladoc/scala/tools/nsc/ScalaDoc.scala')
-rw-r--r--src/scaladoc/scala/tools/nsc/ScalaDoc.scala20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/scaladoc/scala/tools/nsc/ScalaDoc.scala b/src/scaladoc/scala/tools/nsc/ScalaDoc.scala
index 52a0c20a11..32a6ba0ce3 100644
--- a/src/scaladoc/scala/tools/nsc/ScalaDoc.scala
+++ b/src/scaladoc/scala/tools/nsc/ScalaDoc.scala
@@ -18,14 +18,10 @@ class ScalaDoc {
val versionMsg = "Scaladoc %s -- %s".format(Properties.versionString, Properties.copyrightString)
def process(args: Array[String]): Boolean = {
- var reporter: ConsoleReporter = null
+ var reporter: ScalaDocReporter = null
val docSettings = new doc.Settings(msg => reporter.error(FakePos("scaladoc"), msg + "\n scaladoc -help gives more information"),
msg => reporter.printMessage(msg))
- reporter = new ConsoleReporter(docSettings) {
- // need to do this so that the Global instance doesn't trash all the
- // symbols just because there was an error
- override def hasErrors = false
- }
+ reporter = new ScalaDocReporter(docSettings)
val command = new ScalaDoc.Command(args.toList, docSettings)
def hasFiles = command.files.nonEmpty || docSettings.uncompilableFiles.nonEmpty
@@ -50,12 +46,18 @@ class ScalaDoc {
}
finally reporter.printSummary()
- // not much point in returning !reporter.hasErrors when it has
- // been overridden with constant false.
- true
+ !reporter.reallyHasErrors
}
}
+class ScalaDocReporter(settings: Settings) extends ConsoleReporter(settings) {
+
+ // need to do sometimes lie so that the Global instance doesn't
+ // trash all the symbols just because there was an error
+ override def hasErrors = false
+ def reallyHasErrors = super.hasErrors
+}
+
object ScalaDoc extends ScalaDoc {
class Command(arguments: List[String], settings: doc.Settings) extends CompilerCommand(arguments, settings) {
override def cmdName = "scaladoc"