diff options
author | David Turner <dturner@twitter.com> | 2014-10-04 00:44:07 -0400 |
---|---|---|
committer | David Turner <dturner@twitter.com> | 2014-10-04 00:44:07 -0400 |
commit | 5f29a264469b6ae161d9a98fe76d3f6466d82b12 (patch) | |
tree | 2e4749b146eedf41e5ebb60113f2678bb46b1a93 /src/scaladoc | |
parent | 192d65f718ab042cb57090d580c83e15a0509964 (diff) | |
download | scala-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')
-rw-r--r-- | src/scaladoc/scala/tools/nsc/ScalaDoc.scala | 20 |
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" |