diff options
author | Sergey Mashkov <sergey.mashkov@jetbrains.com> | 2015-07-31 15:35:34 +0300 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-10-29 13:21:47 +0100 |
commit | c9d59e9ae85f76e021d53c77ef18bfce0ff7ec7c (patch) | |
tree | d5e86994c762318008f7beaf781cdeafde573802 /javadoc | |
parent | ff77b8e0ad0b5089e940227dfdd94ba21cfc6bd8 (diff) | |
download | dokka-c9d59e9ae85f76e021d53c77ef18bfce0ff7ec7c.tar.gz dokka-c9d59e9ae85f76e021d53c77ef18bfce0ff7ec7c.tar.bz2 dokka-c9d59e9ae85f76e021d53c77ef18bfce0ff7ec7c.zip |
Use Guice injector and ServiceLocator to load implementations on the fly
Diffstat (limited to 'javadoc')
-rw-r--r-- | javadoc/build.gradle | 2 | ||||
-rw-r--r-- | javadoc/javadoc.iml | 5 | ||||
-rw-r--r-- | javadoc/src/main/kotlin/docbase.kt | 10 | ||||
-rw-r--r-- | javadoc/src/main/kotlin/dokka-adapters.kt | 29 | ||||
-rw-r--r-- | javadoc/src/main/kotlin/main.kt | 24 | ||||
-rw-r--r-- | javadoc/src/main/kotlin/tags.kt | 6 | ||||
-rw-r--r-- | javadoc/src/main/resources/dokka/generator/javadoc.properties | 2 | ||||
-rw-r--r-- | javadoc/src/main/resources/format/javadoc.properties | 1 |
8 files changed, 44 insertions, 35 deletions
diff --git a/javadoc/build.gradle b/javadoc/build.gradle index 5c1d464d..ac079b99 100644 --- a/javadoc/build.gradle +++ b/javadoc/build.gradle @@ -33,7 +33,7 @@ repositories { dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "org.jetbrains.dokka:dokka-fatjar:(,0.2)" + compile "org.jetbrains.dokka:dokka-fatjar:(1.0,1.1)" compile files("${System.properties['java.home']}/../lib/tools.jar") compile gradleApi() diff --git a/javadoc/javadoc.iml b/javadoc/javadoc.iml index bc2537e7..e62f617f 100644 --- a/javadoc/javadoc.iml +++ b/javadoc/javadoc.iml @@ -16,8 +16,6 @@ </content> <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" name="Gradle: org.jetbrains.dokka:dokka-fatjar:0.0.1-SNAPSHOT" level="project" /> - <orderEntry type="library" name="Gradle: org.fusesource.jansi:jansi:1.11" level="project" /> <orderEntry type="module-library"> <library name="Gradle: gradle-core-2.5"> <CLASSES> @@ -1473,11 +1471,12 @@ <orderEntry type="module-library"> <library name="Gradle: tools"> <CLASSES> - <root url="jar:///usr/java/jdk1.8.0_51/lib/tools.jar!/" /> + <root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/tools.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </orderEntry> + <orderEntry type="library" name="Gradle: org.jetbrains.dokka:dokka-fatjar:1.0.0-beta-1038" level="project" /> </component> </module>
\ No newline at end of file diff --git a/javadoc/src/main/kotlin/docbase.kt b/javadoc/src/main/kotlin/docbase.kt index fe66a672..36371ad8 100644 --- a/javadoc/src/main/kotlin/docbase.kt +++ b/javadoc/src/main/kotlin/docbase.kt @@ -63,7 +63,7 @@ open class DocumentationNodeAdapter(val module: ModuleNodeAdapter, docNode: Docu }).toTypedArray() } -private val allClassKinds = setOf(DocumentationNode.Kind.Class, DocumentationNode.Kind.Enum, DocumentationNode.Kind.Interface, DocumentationNode.Kind.Object, DocumentationNode.Kind.Exception) +val allClassKinds = setOf(DocumentationNode.Kind.Class, DocumentationNode.Kind.Enum, DocumentationNode.Kind.Interface, DocumentationNode.Kind.Object, DocumentationNode.Kind.Exception) class PackageAdapter(module: ModuleNodeAdapter, val node: DocumentationNode) : DocumentationNodeAdapter(module, node), PackageDoc { private val allClasses = node.members.filter { it.kind in allClassKinds }.toMap { it.name } @@ -472,7 +472,7 @@ fun DocumentationNode.lookupSuperClasses(module: ModuleNodeAdapter) = .map { module.allTypes[it?.qualifiedName] } .filterNotNull() -class ModuleNodeAdapter(val module: DocumentationModule, val reporter: DocErrorReporter) : DocumentationNodeBareAdapter(module), DocErrorReporter by reporter, RootDoc { +class ModuleNodeAdapter(val module: DocumentationModule, val reporter: DocErrorReporter, val outputPath: String) : DocumentationNodeBareAdapter(module), DocErrorReporter by reporter, RootDoc { val allPackages = module.members(DocumentationNode.Kind.Package).toMap { it.name } val allTypes = module.members(DocumentationNode.Kind.Package) .flatMap { it.members(DocumentationNode.Kind.Class) + it.members(DocumentationNode.Kind.Interface) + it.members(DocumentationNode.Kind.Enum) } @@ -486,8 +486,10 @@ class ModuleNodeAdapter(val module: DocumentationModule, val reporter: DocErrorR .toTypedArray() override fun options(): Array<out Array<String>> = arrayOf( - arrayOf("-d", "out/javadoc"), - arrayOf("-docencoding", "UTF-8") + arrayOf("-d", outputPath), + arrayOf("-docencoding", "UTF-8"), + arrayOf("-charset", "UTF-8"), + arrayOf("-keywords") ) override fun specifiedPackages(): Array<out PackageDoc>? = module.members(DocumentationNode.Kind.Package).map { PackageAdapter(this, it) }.toTypedArray() diff --git a/javadoc/src/main/kotlin/dokka-adapters.kt b/javadoc/src/main/kotlin/dokka-adapters.kt new file mode 100644 index 00000000..c9183d50 --- /dev/null +++ b/javadoc/src/main/kotlin/dokka-adapters.kt @@ -0,0 +1,29 @@ +package org.jetbrains.dokka.javadoc + +import com.sun.tools.doclets.formats.html.HtmlDoclet +import org.jetbrains.dokka.* +import org.jetbrains.dokka.Formats.FormatDescriptor + +class JavadocGenerator(val conf: DokkaGenerator) : Generator { + override fun buildPages(nodes: Iterable<DocumentationNode>) { + val module = nodes.single() as DocumentationModule + + DokkaConsoleLogger.report() + HtmlDoclet.start(ModuleNodeAdapter(module, StandardReporter, conf.outputDir)) + } + + override fun buildOutlines(nodes: Iterable<DocumentationNode>) { + // no outline could be generated separately + } +} + +class JavadocFormatDescriptor : FormatDescriptor { + override val formatServiceClass: Class<out FormatService>? + get() = null + override val outlineServiceClass: Class<out OutlineFormatService>? + get() = null + + override val generatorServiceClass: Class<out Generator> + get() = javaClass<JavadocGenerator>() +} + diff --git a/javadoc/src/main/kotlin/main.kt b/javadoc/src/main/kotlin/main.kt deleted file mode 100644 index 0c3821c3..00000000 --- a/javadoc/src/main/kotlin/main.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.jetbrains.dokka.javadoc - -import com.sun.tools.doclets.formats.html.HtmlDoclet -import org.jetbrains.dokka.DocumentationOptions -import org.jetbrains.dokka.DokkaConsoleLogger -import org.jetbrains.dokka.DokkaGenerator -import org.jetbrains.dokka.buildDocumentationModule -import java.io.File - -/** - * Test me, my friend - */ -public fun main(args: Array<String>) { - val generator = DokkaGenerator(DokkaConsoleLogger, System.getProperty("java.class.path").split(File.pathSeparator), listOf(File("test").absolutePath), emptyList(), emptyList(), "me", "out/dokka", "html", emptyList(), false) - val env = generator.createAnalysisEnvironment() - val module = buildDocumentationModule(env, generator.moduleName, DocumentationOptions(includeNonPublic = true, sourceLinks = emptyList()), emptyList(), { - generator.isSample(it) - }, generator.logger) - - DokkaConsoleLogger.report() - HtmlDoclet.start(ModuleNodeAdapter(module, StandardReporter)) -} - -public fun String.a(): Int = 1
\ No newline at end of file diff --git a/javadoc/src/main/kotlin/tags.kt b/javadoc/src/main/kotlin/tags.kt index 120154f9..6f0ebca0 100644 --- a/javadoc/src/main/kotlin/tags.kt +++ b/javadoc/src/main/kotlin/tags.kt @@ -2,7 +2,7 @@ package org.jetbrains.dokka.javadoc import com.sun.javadoc.* import org.jetbrains.dokka.* -import java.util.ArrayList +import java.util.* class TextTag(val holder: Doc, val content: ContentText) : Tag { val plainText: String @@ -66,7 +66,7 @@ class SeeClassTagAdapter(holder: Doc, val clazz: ClassDocumentationNodeAdapter, override fun firstSentenceTags(): Array<out Tag> = inlineTags() // TODO } -class ParamTagAdapter(val module: ModuleNodeAdapter, val holder: Doc, val parameterName: String, val isTypeParameter: Boolean, val content: List<ContentNode>) : ParamTag { +class ParamTagAdapter(val module: ModuleNodeAdapter, val holder: Doc, val parameterName: String, val typeParameter: Boolean, val content: List<ContentNode>) : ParamTag { constructor(module: ModuleNodeAdapter, holder: Doc, parameterName: String, isTypeParameter: Boolean, content: ContentNode) : this(module, holder, parameterName, isTypeParameter, listOf(content)) override fun name(): String = "@param" @@ -78,7 +78,7 @@ class ParamTagAdapter(val module: ModuleNodeAdapter, val holder: Doc, val parame override fun inlineTags(): Array<out Tag> = content.flatMap { buildInlineTags(module, holder, it) }.toTypedArray() override fun firstSentenceTags(): Array<out Tag> = arrayOf(TextTag(holder, ContentText(text()))) - override fun isTypeParameter(): Boolean = isTypeParameter + override fun isTypeParameter(): Boolean = typeParameter override fun parameterComment(): String = content.toString() // TODO override fun parameterName(): String = parameterName } diff --git a/javadoc/src/main/resources/dokka/generator/javadoc.properties b/javadoc/src/main/resources/dokka/generator/javadoc.properties new file mode 100644 index 00000000..4075704f --- /dev/null +++ b/javadoc/src/main/resources/dokka/generator/javadoc.properties @@ -0,0 +1,2 @@ +class=org.jetbrains.dokka.javadoc.JavadocGenerator +description=Produces output via JDK javadoc tool
\ No newline at end of file diff --git a/javadoc/src/main/resources/format/javadoc.properties b/javadoc/src/main/resources/format/javadoc.properties new file mode 100644 index 00000000..a58317fc --- /dev/null +++ b/javadoc/src/main/resources/format/javadoc.properties @@ -0,0 +1 @@ +class=org.jetbrains.dokka.javadoc.JavadocFormatDescriptor
\ No newline at end of file |