commit | 8216501e9a07940ed0a0be3d204733df9a9d811c | [log] [tgz] |
---|---|---|
author | Sergey Mashkov <sergey.mashkov@jetbrains.com> | Mon Aug 10 14:46:50 2015 +0300 |
committer | Sergey Mashkov <sergey.mashkov@jetbrains.com> | Mon Aug 10 14:51:55 2015 +0300 |
tree | bdf92b7fff16d12086b004861ac26b3439fde021 | |
parent | ff89f37f3a525460d35d4fcaec99afbaec160618 [diff] |
~ configure javadoc module, configure artifact configuration
Dokka is documentation engine for Kotlin, performing the same function as javadoc for Java.
NOTE: It is work in progress both on compiler side and this tool. Do not base your business on it. Yet.
Dokka uses Kotlin-as-a-service technology to build code model
, then processes it into documentation model
. Documentation model
is graph of items describing code elements such as classes, packages, functions, etc.
Each node has semantic attached, e.g. Value:name -> Type:String means that some value name
is of type String
.
Each reference between nodes also has semantic attached, and there are three of them:
Member & Detail has reverse Owner reference, while Link's back reference is also Link.
Nodes that are Details of other nodes cannot have Members.
When we have documentation model, we can render docs in various formats, languages and layouts. We have some core services:
Basically, given the documentation
as a model, we do this:
val signatureGenerator = KotlinSignatureGenerator() val locationService = FoldersLocationService(arguments.outputDir) val markdown = JekyllFormatService(locationService, signatureGenerator) val generator = FileGenerator(signatureGenerator, locationService, markdown) generator.generate(documentation)
Dokka docs are built with Dokka. Yes, we bootstrap and dogfood :)
Documentation can be generated in various mark-up formats.
Place documentation in different file structure. All links are relative regardless of structure.
Output symbol declarations in different languages.
KDoc is a flavour of markdown with symbol processing extensions.
name
(markdown style)name
(Kotlin string interpolation style), or ${java.lang.String} for longer referencesname
, e.g. param docBuild only dokka
ant fatjar
Build dokka and maven plugin
ant install-fj cd maven-plugin mvn install
Build dokka and install maven plugin (do not require maven installed)
ant build-and-install
Minimal maven configuration is
<plugin> <groupId>org.jetbrains.dokka</groupId> <artifactId>dokka-maven-plugin</artifactId> <version>${dokka.version}</version> <executions> <execution> <phase>pre-site</phase> <goals> <goal>dokka</goal> </goals> </execution> </executions> </plugin>
by default files will be generated in target/dokka
Configuring source links mapping
<plugin> <groupId>org.jetbrains.dokka</groupId> <artifactId>dokka-maven-plugin</artifactId> <version>${dokka.version}</version> <executions> <execution> <phase>pre-site</phase> <goals> <goal>dokka</goal> </goals> </execution> </executions> <configuration> <sourceLinks> <link> <dir>${project.basedir}/src/main/kotlin</dir> <url>http://github.com/me/myrepo</url> </link> </sourceLinks> </configuration> </plugin>
buildscript { repositories { mavenLocal() jcenter() } dependencies { classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.1-SNAPSHOT" } } apply plugin: 'org.jetbrains.dokka'
To configure plugin use dokka lambda in the root scope. For example:
dokka { linkMapping { dir = "src/main/kotlin" url = "https://github.com/cy6erGn0m/vertx3-lang-kotlin/blob/master/src/main/kotlin" suffix = "#L" } }
To get it generated use gradle dokka
task
./gradlew dokka