diff options
-rw-r--r-- | doc-tool/src/dotty/tools/dottydoc/api/java/Dottydoc.java | 48 | ||||
-rw-r--r-- | doc-tool/src/dotty/tools/dottydoc/api/scala/Dottydoc.scala | 39 | ||||
-rw-r--r-- | doc-tool/test/GenDocs.scala | 2 | ||||
-rw-r--r-- | sbt-bridge/src/xsbt/ScaladocInterface.scala | 27 |
4 files changed, 9 insertions, 107 deletions
diff --git a/doc-tool/src/dotty/tools/dottydoc/api/java/Dottydoc.java b/doc-tool/src/dotty/tools/dottydoc/api/java/Dottydoc.java deleted file mode 100644 index a44413c75..000000000 --- a/doc-tool/src/dotty/tools/dottydoc/api/java/Dottydoc.java +++ /dev/null @@ -1,48 +0,0 @@ -package dotty.tools.dottydoc.api.java; - -import dotty.tools.dottydoc.DocDriver; -import dotty.tools.dottydoc.model.Package; -import java.util.Map; -import java.util.List; -import java.net.URL; - -/** - * The Dottydoc API is fairly simple. The tool creates an index by calling: - * "createIndex" with the same argument list as you would the compiler - e.g: - * - * {{{ - * String[] array = { - * "-language:Scala2" - * }; - * - * Map<String, Package> index = createIndex(array); - * }}} - * - * Once the index has been generated, the tool can also build a documentation - * API given a Mustache template and a flat resources structure (i.e. absolute - * paths to each resource, which will be put in the same directory). - * - * {{{ - * buildDocs("path/to/output/dir", templateURL, resources, index); - * }}} - * - * The tool can also generate JSON from the created index using "toJson(index)" - * or directly using "createJsonIndex" - */ -public class Dottydoc { - private DocDriver driver = new DocDriver(); - - /** Creates index from compiler arguments */ - public Map<String, Package> createIndex(String[] args) { - return driver.compiledDocsJava(args); - } - - /** Creates JSON from compiler arguments */ - public String createJsonIndex(String[] args) { - return driver.indexToJsonJava(createIndex(args)); - } - - public String toJson(Map<String, Package> index) { - return driver.indexToJsonJava(index); - } -} diff --git a/doc-tool/src/dotty/tools/dottydoc/api/scala/Dottydoc.scala b/doc-tool/src/dotty/tools/dottydoc/api/scala/Dottydoc.scala deleted file mode 100644 index 9d00b08a3..000000000 --- a/doc-tool/src/dotty/tools/dottydoc/api/scala/Dottydoc.scala +++ /dev/null @@ -1,39 +0,0 @@ -package dotty.tools.dottydoc.api.scala - -import dotty.tools.dottydoc.DocDriver -import dotty.tools.dottydoc.model.Package - -import scala.collection.Map -import java.net.URL - -/** The Dottydoc API is fairly simple. The tool creates an index by calling: - * `createIndex` with the same argument list as you would the compiler - e.g: - * - * ```scala - * val array: Array[String] = Array( - * "-language:Scala2" - * ) - * - * val index: Map[String, Package] = createIndex(array) - * ``` - * - * Once the index has been generated, the tool can also build a documentation - * API given a Mustache template and a flat resources structure (i.e. absolute - * paths to each resource, which will be put in the same directory). - * - * ```scala - * buildDocs("path/to/output/dir", templateURL, resources, index) - * ``` - * - * The tool can also generate JSON from the created index using `indexToJson` - * or directly using `createJsonIndex` - */ -trait Dottydoc extends DocDriver { - /** Creates index from compiler arguments */ - def createIndex(args: Array[String]): Map[String, Package] = - compiledDocs(args) - - /** Creates JSON from compiler arguments */ - def createJsonIndex(args: Array[String]): String = - indexToJson(compiledDocs(args)) -} diff --git a/doc-tool/test/GenDocs.scala b/doc-tool/test/GenDocs.scala index 9a911d4eb..edd05acc2 100644 --- a/doc-tool/test/GenDocs.scala +++ b/doc-tool/test/GenDocs.scala @@ -9,7 +9,7 @@ object Files { } } -trait LocalResources extends api.scala.Dottydoc { +trait LocalResources extends DocDriver { import Files._ def getFiles(file: JFile): Array[JFile] = diff --git a/sbt-bridge/src/xsbt/ScaladocInterface.scala b/sbt-bridge/src/xsbt/ScaladocInterface.scala index 15a9a84f4..1eae8374d 100644 --- a/sbt-bridge/src/xsbt/ScaladocInterface.scala +++ b/sbt-bridge/src/xsbt/ScaladocInterface.scala @@ -3,8 +3,7 @@ */ package xsbt -import xsbti.Logger -import dotty.tools.dottydoc.api.scala.Dottydoc +import xsbti.{ Logger, Severity } import java.net.URL class ScaladocInterface { @@ -12,23 +11,13 @@ class ScaladocInterface { (new DottydocRunner(args, log, delegate)).run() } -class DottydocRunner(args: Array[String], log: Logger, delegate: xsbti.Reporter) extends Dottydoc { - def run(): Unit = getOutputFolder(args).map { outputFolder => - val index = createIndex(args) - val resources = getResources(args) - val template = getTemplate(resources) - - // FIXME: temporarily disabled until new implementation in place - //template.fold(writeJson(index, outputFolder)) { tpl => - // buildDocs(outputFolder, tpl, resources, index) - //} - } getOrElse { - delegate.log( - NoPosition, - "No output folder set for API documentation (\"-d\" parameter should be passed to the documentation tool)", - xsbti.Severity.Error - ) - } +class DottydocRunner(args: Array[String], log: Logger, delegate: xsbti.Reporter) { + def run(): Unit = delegate.log( + NoPosition, + """|The dotty sbt-bridge currently does not support doc generation directly + |via sbt. Please see the dotty documentation at dotty.epfl.ch""".stripMargin, + Severity.Error + ) private[this] val NoPosition = new xsbti.Position { val line = xsbti.Maybe.nothing[Integer] |