aboutsummaryrefslogtreecommitdiff
path: root/doc-tool
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-12-22 14:44:56 +0100
committerFelix Mulder <felix.mulder@gmail.com>2017-01-31 14:28:08 +0100
commitf6e0e4fc2e779af83f2e4a27402991a107d727e4 (patch)
tree3ca38680f3b6f0a59dbac3ce5c407d5f11d125cb /doc-tool
parentf85e55226cb9d70429636ffe09e3ca13f1d253ef (diff)
downloaddotty-f6e0e4fc2e779af83f2e4a27402991a107d727e4.tar.gz
dotty-f6e0e4fc2e779af83f2e4a27402991a107d727e4.tar.bz2
dotty-f6e0e4fc2e779af83f2e4a27402991a107d727e4.zip
Make dottydoc main available for Java instances
Diffstat (limited to 'doc-tool')
-rw-r--r--doc-tool/src/dotty/tools/dottydoc/DottyDoc.scala2
-rw-r--r--doc-tool/src/dotty/tools/dottydoc/Main.scala5
-rw-r--r--doc-tool/src/dotty/tools/dottydoc/api/java/Dottydoc.java9
-rw-r--r--doc-tool/src/dotty/tools/dottydoc/api/scala/Dottydoc.scala45
4 files changed, 33 insertions, 28 deletions
diff --git a/doc-tool/src/dotty/tools/dottydoc/DottyDoc.scala b/doc-tool/src/dotty/tools/dottydoc/DottyDoc.scala
index 0dea96134..b7d3e4d58 100644
--- a/doc-tool/src/dotty/tools/dottydoc/DottyDoc.scala
+++ b/doc-tool/src/dotty/tools/dottydoc/DottyDoc.scala
@@ -49,7 +49,7 @@ class DocFrontEnd extends FrontEnd {
unit.isJava
}
-abstract class DocDriver extends Driver {
+class DocDriver extends Driver {
import scala.collection.JavaConverters._
override def setup(args: Array[String], rootCtx: Context): (List[String], Context) = {
diff --git a/doc-tool/src/dotty/tools/dottydoc/Main.scala b/doc-tool/src/dotty/tools/dottydoc/Main.scala
new file mode 100644
index 000000000..f158bdbfc
--- /dev/null
+++ b/doc-tool/src/dotty/tools/dottydoc/Main.scala
@@ -0,0 +1,5 @@
+package dotty.tools
+package dottydoc
+
+/** Main runnable for DottyDoc */
+object Main extends DocDriver
diff --git a/doc-tool/src/dotty/tools/dottydoc/api/java/Dottydoc.java b/doc-tool/src/dotty/tools/dottydoc/api/java/Dottydoc.java
index 1bdfe0488..d10e145a8 100644
--- a/doc-tool/src/dotty/tools/dottydoc/api/java/Dottydoc.java
+++ b/doc-tool/src/dotty/tools/dottydoc/api/java/Dottydoc.java
@@ -30,20 +30,21 @@ import java.net.URL;
* The tool can also generate JSON from the created index using "toJson(index)"
* or directly using "createJsonIndex"
*/
-public class Dottydoc extends DocDriver {
+public class Dottydoc {
+ private DocDriver driver = new DocDriver();
/** Creates index from compiler arguments */
public Map<String, Package> createIndex(String[] args) {
- return compiledDocsJava(args);
+ return driver.compiledDocsJava(args);
}
/** Creates JSON from compiler arguments */
public String createJsonIndex(String[] args) {
- return indexToJsonJava(createIndex(args));
+ return driver.indexToJsonJava(createIndex(args));
}
public String toJson(Map<String, Package> index) {
- return indexToJsonJava(index);
+ return driver.indexToJsonJava(index);
}
/** Creates a documentation from the given parameters */
diff --git a/doc-tool/src/dotty/tools/dottydoc/api/scala/Dottydoc.scala b/doc-tool/src/dotty/tools/dottydoc/api/scala/Dottydoc.scala
index 15db81a95..37f97040b 100644
--- a/doc-tool/src/dotty/tools/dottydoc/api/scala/Dottydoc.scala
+++ b/doc-tool/src/dotty/tools/dottydoc/api/scala/Dottydoc.scala
@@ -7,29 +7,28 @@ import dotty.tools.dottydoc.util.OutputWriter
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:
- *
- * {{{
- * 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).
- *
- * {{{
- * buildDocs("path/to/output/dir", templateURL, resources, index)
- * }}}
- *
- * The tool can also generate JSON from the created index using "indexToJson"
- * or directly using "createJsonIndex"
- */
+/** 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] =