Fix 2.8 scaladoc interface

This commit is contained in:
Mark Harrah 2009-10-05 22:43:11 -04:00
parent ac645c4387
commit 651a84ebaf
1 changed files with 28 additions and 21 deletions

View File

@ -60,29 +60,36 @@ class CompilerInterface
}
class ScaladocInterface
{
def run(args: Array[String], maximumErrors: Int, log: Logger)
def run(args: Array[String], maximumErrors: Int, log: Logger)
{
import scala.tools.nsc.{doc, CompilerCommand, Global}
val reporter = new LoggerReporter(maximumErrors, log)
val docSettings: doc.Settings = new doc.Settings(reporter.error)
val command = new CompilerCommand(args.toList, docSettings, error, false)
trait Compat27 { def computeInternalPhases(): Unit = () }
val phasesSet = scala.collection.mutable.Set[scala.tools.nsc.SubComponent]() // for 2.7 source compatibility
object compiler extends Global(command.settings, reporter) with Compat27
{
import scala.tools.nsc.{doc, CompilerCommand, Global}
val reporter = new LoggerReporter(maximumErrors, log)
val docSettings: doc.Settings = new doc.Settings(reporter.error)
val command = new CompilerCommand(args.toList, docSettings, error, false)
object compiler extends Global(command.settings, reporter)
{
override val onlyPresentation = true
override def onlyPresentation = true
override def computeInternalPhases() {
phasesSet += syntaxAnalyzer
phasesSet += analyzer.namerFactory
phasesSet += analyzer.typerFactory
}
if(!reporter.hasErrors)
{
val run = new compiler.Run
run compile command.files
val generator = new doc.DefaultDocDriver
{
lazy val global: compiler.type = compiler
lazy val settings = docSettings
}
generator.process(run.units)
}
reporter.printSummary()
if(reporter.hasErrors) throw new InterfaceCompileFailed(args, "Scaladoc generation failed")
}
if(!reporter.hasErrors)
{
val run = new compiler.Run
run compile command.files
val generator = new doc.DefaultDocDriver
{
lazy val global: compiler.type = compiler
lazy val settings = docSettings
}
generator.process(run.units)
}
reporter.printSummary()
if(reporter.hasErrors) throw new InterfaceCompileFailed(args, "Scaladoc generation failed")
}
}
class InterfaceCompileFailed(val arguments: Array[String], override val toString: String) extends xsbti.CompileFailed