diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-08-15 18:22:14 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-08-19 15:37:34 +0200 |
commit | abf16325cb8909b8c856d2a83ad7c9b05f49130b (patch) | |
tree | 82690f4fbd1c2fe76f2fcea0410e3847c58b7c55 /dottydoc/src/dotty/tools/dottydoc/api/java/Dottydoc.java | |
parent | d6b5c3e0404b754c2bef432b3227cf8f61bc8896 (diff) | |
download | dotty-abf16325cb8909b8c856d2a83ad7c9b05f49130b.tar.gz dotty-abf16325cb8909b8c856d2a83ad7c9b05f49130b.tar.bz2 dotty-abf16325cb8909b8c856d2a83ad7c9b05f49130b.zip |
Add documentation to dottydoc API
Diffstat (limited to 'dottydoc/src/dotty/tools/dottydoc/api/java/Dottydoc.java')
-rw-r--r-- | dottydoc/src/dotty/tools/dottydoc/api/java/Dottydoc.java | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/dottydoc/src/dotty/tools/dottydoc/api/java/Dottydoc.java b/dottydoc/src/dotty/tools/dottydoc/api/java/Dottydoc.java index dbe3f6f41..1bdfe0488 100644 --- a/dottydoc/src/dotty/tools/dottydoc/api/java/Dottydoc.java +++ b/dottydoc/src/dotty/tools/dottydoc/api/java/Dottydoc.java @@ -7,16 +7,46 @@ import java.util.Map; import java.util.List; import java.net.URL; -/** FIXME: document me! */ +/** + * 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 extends DocDriver { + + /** Creates index from compiler arguments */ public Map<String, Package> createIndex(String[] args) { return compiledDocsJava(args); } + /** Creates JSON from compiler arguments */ public String createJsonIndex(String[] args) { - return indexToJson(createIndex(args)); + return indexToJsonJava(createIndex(args)); + } + + public String toJson(Map<String, Package> index) { + return indexToJsonJava(index); } + /** Creates a documentation from the given parameters */ public void buildDocs( String outputDir, URL template, @@ -26,6 +56,7 @@ public class Dottydoc extends DocDriver { new OutputWriter().writeJava(index, outputDir, template, resources); } + /** Writes JSON to an output directory as "index.json" */ public void writeJson(Map<String, Package> index, String outputDir) { new OutputWriter().writeJsonJava(index, outputDir); } |