Skip to content

Fix dotty-doc exit code #3893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions doc-tool/src/dotty/tools/dottydoc/DocDriver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ package dottydoc
import dotty.tools.dottydoc.util.syntax._
import core.ContextDottydoc
import dotc.core.Contexts._
import dotc.reporting.Reporter
import dotc.{ Compiler, Driver }
import model.Package
import dotc.config._
import dotc.core.Comments.ContextDoc
import staticsite.Site
import dotc.printing.Highlighting._

/** `DocDriver` implements the main entry point to the Dotty documentation
* tool. It's methods are used by the external scala and java APIs.
Expand All @@ -33,16 +32,12 @@ class DocDriver extends Driver {

override def newCompiler(implicit ctx: Context): Compiler = new DocCompiler

def compiledDocs(args: Array[String]): collection.Map[String, Package] = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this method since I found no reference for it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactoring! LGTM

val (fileNames, ctx) = setup(args, initCtx.fresh)
doCompile(newCompiler(ctx), fileNames)(ctx)
override def process(args: Array[String], rootCtx: Context): Reporter = {
val (filesToDocument, ictx) = setup(args, initCtx.fresh)

ctx.docbase.packages
}
implicit val ctx: Context = ictx
val reporter = doCompile(newCompiler, filesToDocument)

override def main(args: Array[String]): Unit = {
implicit val (filesToDocument, ctx) = setup(args, initCtx.fresh)
val reporter = doCompile(newCompiler(ctx), filesToDocument)(ctx)
val siteRoot = new java.io.File(ctx.settings.siteRoot.value)
val projectName = ctx.settings.projectName.value
val projectVersion = ctx.settings.projectVersion.value
Expand All @@ -60,7 +55,8 @@ class DocDriver extends Driver {
.generateBlog()

ctx.docbase.printSummary()
System.exit(if (reporter.hasErrors) 1 else 0)
}

reporter
}
}