aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/javadoc/src')
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt41
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt33
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt2
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToHtmlTranslator.kt4
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt2
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt24
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt8
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/AbstractJavadocTemplateMapTest.kt11
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocTest.kt69
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt4
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt74
-rw-r--r--plugins/javadoc/src/test/resources/javadoc/test/main/java/adaptation/Adaptation.kt50
12 files changed, 152 insertions, 170 deletions
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
index 0c322a82..cf45ef75 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
@@ -1,21 +1,27 @@
package org.jetbrains.dokka.javadoc
-import org.jetbrains.dokka.javadoc.JavadocDocumentableToPageTranslator
import org.jetbrains.dokka.javadoc.location.JavadocLocationProviderFactory
import org.jetbrains.dokka.javadoc.renderer.KorteJavadocRenderer
import org.jetbrains.dokka.javadoc.signatures.JavadocSignatureProvider
import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.base.DokkaBase
+import org.jetbrains.dokka.base.renderers.PackageListCreator
+import org.jetbrains.dokka.base.renderers.RootCreator
+import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat
+import org.jetbrains.dokka.javadoc.pages.AllClassesPageInstaller
+import org.jetbrains.dokka.javadoc.pages.ResourcesInstaller
+import org.jetbrains.dokka.javadoc.pages.TreeViewInstaller
import org.jetbrains.dokka.kotlinAsJava.KotlinAsJavaPlugin
import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.plugability.querySingle
+import org.jetbrains.dokka.transformers.pages.PageTransformer
class JavadocPlugin : DokkaPlugin() {
val dokkaBasePlugin by lazy { plugin<DokkaBase>() }
val kotinAsJavaPlugin by lazy { plugin<KotlinAsJavaPlugin>() }
-
- val locationProviderFactory by extensionPoint<JavadocLocationProviderFactory>()
+ val locationProviderFactory by lazy { dokkaBasePlugin.locationProviderFactory }
+ val javadocPreprocessors by extensionPoint<PageTransformer>()
val dokkaJavadocPlugin by extending {
(CoreExtensions.renderer
@@ -34,9 +40,9 @@ class JavadocPlugin : DokkaPlugin() {
}
val javadocLocationProviderFactory by extending {
- locationProviderFactory providing { context ->
+ dokkaBasePlugin.locationProviderFactory providing { context ->
JavadocLocationProviderFactory(context)
- }
+ } override dokkaBasePlugin.locationProvider
}
val javadocSignatureProvider by extending {
@@ -49,5 +55,30 @@ class JavadocPlugin : DokkaPlugin() {
)
} override kotinAsJavaPlugin.javaSignatureProvider
}
+
+ val rootCreator by extending {
+ javadocPreprocessors with RootCreator
+ }
+
+ val packageListCreator by extending {
+ javadocPreprocessors providing {
+ PackageListCreator(
+ it,
+ RecognizedLinkFormat.DokkaJavadoc
+ )
+ } order { after(rootCreator) }
+ }
+
+ val resourcesInstaller by extending {
+ javadocPreprocessors with ResourcesInstaller order { after(rootCreator) }
+ }
+
+ val treeViewInstaller by extending {
+ javadocPreprocessors with TreeViewInstaller order { after(rootCreator) }
+ }
+
+ val allClassessPageInstaller by extending {
+ javadocPreprocessors with AllClassesPageInstaller order { before(rootCreator) }
+ }
}
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
index 7bc6d6d8..24719ebf 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
@@ -32,37 +32,32 @@ interface WithBrief {
}
class JavadocModulePageNode(
- override val name: String,
- override val content: JavadocContentNode,
- override val children: List<PageNode>,
+ name: String,
+ content: JavadocContentNode,
+ children: List<PageNode>,
override val dri: Set<DRI>
) :
- RootPageNode(),
+ ModulePageNode(name, content, null, children, emptyList()),
JavadocPageNode {
- override val documentable: Documentable? = null
- override val embeddedResources: List<String> = emptyList()
- override fun modified(name: String, children: List<PageNode>): RootPageNode =
- JavadocModulePageNode(name, content, children, dri)
-
override fun modified(
name: String,
content: ContentNode,
dri: Set<DRI>,
embeddedResources: List<String>,
children: List<PageNode>
- ): ContentPage = JavadocModulePageNode(name, content as JavadocContentNode, children, dri)
+ ): ModulePageNode = JavadocModulePageNode(name, content as JavadocContentNode, children, dri)
}
class JavadocPackagePageNode(
- override val name: String,
- override val content: JavadocContentNode,
- override val dri: Set<DRI>,
+ name: String,
+ content: JavadocContentNode,
+ dri: Set<DRI>,
- override val documentable: Documentable? = null,
- override val children: List<PageNode> = emptyList(),
- override val embeddedResources: List<String> = listOf()
-) : JavadocPageNode, WithIndexables, IndexableJavadocNode {
+ documentable: Documentable? = null,
+ children: List<PageNode> = emptyList(),
+ embeddedResources: List<String> = listOf()
+) : JavadocPageNode, WithIndexables, IndexableJavadocNode, PackagePageNode(name, content, dri, documentable, children, embeddedResources) {
override fun getAllIndexables(): List<IndexableJavadocNode> =
children.filterIsInstance<IndexableJavadocNode>().flatMap {
@@ -73,7 +68,7 @@ class JavadocPackagePageNode(
override fun modified(
name: String,
children: List<PageNode>
- ): PageNode = JavadocPackagePageNode(
+ ): PackagePageNode = JavadocPackagePageNode(
name,
content,
dri,
@@ -88,7 +83,7 @@ class JavadocPackagePageNode(
dri: Set<DRI>,
embeddedResources: List<String>,
children: List<PageNode>
- ): ContentPage =
+ ): PackagePageNode =
JavadocPackagePageNode(
name,
content as JavadocContentNode,
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
index a2c3cf22..c54d484a 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
@@ -5,8 +5,6 @@ import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.transformers.pages.PageTransformer
import kotlin.collections.HashMap
-val preprocessors = listOf(ResourcesInstaller, TreeViewInstaller, AllClassesPageInstaller, IndexGenerator)
-
object ResourcesInstaller : PageTransformer {
override fun invoke(input: RootPageNode): RootPageNode = input.modified(
children = input.children +
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToHtmlTranslator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToHtmlTranslator.kt
index b5fdde33..413b6387 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToHtmlTranslator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToHtmlTranslator.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka.javadoc.renderer
-import org.jetbrains.dokka.javadoc.location.JavadocLocationProvider
+import org.jetbrains.dokka.base.resolvers.local.LocationProvider
import org.jetbrains.dokka.javadoc.pages.JavadocSignatureContentNode
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
@@ -8,7 +8,7 @@ import org.jetbrains.dokka.utilities.formatToEndWithHtml
import org.jetbrains.dokka.utilities.htmlEscape
internal class JavadocContentToHtmlTranslator(
- private val locationProvider: JavadocLocationProvider,
+ private val locationProvider: LocationProvider,
private val context: DokkaContext
) {
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
index ab12f50c..554bdb8a 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
@@ -167,6 +167,8 @@ internal class JavadocContentToTemplateMapTranslator(
else -> emptyMap()
}
+ fun templateMapForJavadocContentNode(node: ContentNode): TemplateMap = (node as? JavadocContentNode)?.let { templateMapForJavadocContentNode(it) } ?: emptyMap()
+
private fun templateMapForParameterNode(node: JavadocParameterNode): TemplateMap =
mapOf(
"description" to htmlForContentNodes(node.description, contextNode),
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt
index 20115ac8..cdd045a4 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt
@@ -10,11 +10,13 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import org.jetbrains.dokka.base.renderers.OutputWriter
+import org.jetbrains.dokka.base.resolvers.local.LocationProvider
import org.jetbrains.dokka.javadoc.JavadocPlugin
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
+import org.jetbrains.dokka.plugability.query
import org.jetbrains.dokka.plugability.querySingle
import org.jetbrains.dokka.renderers.Renderer
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
@@ -25,6 +27,7 @@ typealias TemplateMap = Map<String, Any?>
class KorteJavadocRenderer(private val outputWriter: OutputWriter, val context: DokkaContext, resourceDir: String) :
Renderer {
private lateinit var locationProvider: JavadocLocationProvider
+ private val registeredPreprocessors = context.plugin<JavadocPlugin>().query { javadocPreprocessors }
private val contentToHtmlTranslator by lazy {
JavadocContentToHtmlTranslator(locationProvider, context)
@@ -34,10 +37,10 @@ class KorteJavadocRenderer(private val outputWriter: OutputWriter, val context:
JavadocContentToTemplateMapTranslator(locationProvider, context)
}
- override fun render(root: RootPageNode) = root.let { preprocessors.fold(root) { r, t -> t.invoke(r) } }.let { newRoot ->
- locationProvider = context.plugin<JavadocPlugin>().querySingle { locationProviderFactory }.getLocationProvider(newRoot)
+ override fun render(root: RootPageNode) = root.let { registeredPreprocessors.fold(root) { r, t -> t.invoke(r) } }.let { newRoot ->
+ locationProvider = context.plugin<JavadocPlugin>().querySingle { locationProviderFactory }.getLocationProvider(newRoot) as JavadocLocationProvider
runBlocking(Dispatchers.IO) {
- renderModulePageNode(newRoot as JavadocModulePageNode)
+ renderPage(newRoot)
SearchScriptsCreator(locationProvider).invoke(newRoot).forEach { renderSpecificPage(it, "") }
}
}
@@ -52,11 +55,11 @@ class KorteJavadocRenderer(private val outputWriter: OutputWriter, val context:
else -> ""
}
- private fun CoroutineScope.renderNode(node: PageNode, path: String = "") {
- if (node is JavadocPageNode) {
- renderJavadocPageNode(node)
- } else if (node is RendererSpecificPage) {
- renderSpecificPage(node, path)
+ private fun CoroutineScope.renderPage(node: PageNode, path: String = "") {
+ when(node){
+ is JavadocModulePageNode -> renderModulePageNode(node)
+ is JavadocPageNode -> renderJavadocPageNode(node)
+ is RendererSpecificPage -> renderSpecificPage(node, path)
}
}
@@ -67,14 +70,14 @@ class KorteJavadocRenderer(private val outputWriter: OutputWriter, val context:
val contentMap = contentToTemplateMapTranslator.templateMapForPageNode(node)
writeFromTemplate(outputWriter, "$link/$name".toNormalized(), "tabPage.korte", contentMap.toList())
- node.children.forEach { renderNode(it, link) }
+ node.children.forEach { renderPage(it, link) }
}
private fun CoroutineScope.renderJavadocPageNode(node: JavadocPageNode) {
val link = locationProvider.resolve(node, skipExtension = true)
val contentMap = contentToTemplateMapTranslator.templateMapForPageNode(node)
writeFromTemplate(outputWriter, link, templateForNode(node), contentMap.toList())
- node.children.forEach { renderNode(it, link.toNormalized()) }
+ node.children.forEach { renderPage(it, link.toNormalized()) }
}
private fun CoroutineScope.renderSpecificPage(node: RendererSpecificPage, path: String) = launch {
@@ -87,6 +90,7 @@ class KorteJavadocRenderer(private val outputWriter: OutputWriter, val context:
)
RenderingStrategy.DoNothing -> Unit
}
+ node.children.forEach { renderPage(it, locationProvider.resolve(node, skipExtension = true).toNormalized()) }
}
private fun Pair<String, String>.pairToTag() =
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt
index 589aeb51..0c2d8e07 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt
@@ -1,12 +1,10 @@
package org.jetbrains.dokka.javadoc.renderer
-import org.jetbrains.dokka.javadoc.location.JavadocLocationProvider
import org.jetbrains.dokka.javadoc.pages.*
import org.jetbrains.dokka.javadoc.renderer.SearchRecord.Companion.allTypes
-import org.jetbrains.dokka.DokkaConfiguration
-import org.jetbrains.dokka.DokkaException
import org.jetbrains.dokka.base.renderers.sourceSets
import org.jetbrains.dokka.base.resolvers.local.resolveOrThrow
+import org.jetbrains.dokka.base.resolvers.local.LocationProvider
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.DisplaySourceSet
import org.jetbrains.dokka.model.Documentable
@@ -14,12 +12,12 @@ import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.utilities.formatToEndWithHtml
import java.lang.StringBuilder
-class SearchScriptsCreator(private val locationProvider: JavadocLocationProvider) {
+class SearchScriptsCreator(private val locationProvider: LocationProvider) {
fun invoke(input: RootPageNode): List<RendererSpecificPage> {
val data = when (input) {
is JavadocModulePageNode -> processModules(listOf(input))
- else -> SearchData()
+ else -> processModules(input.children.filterIsInstance<JavadocModulePageNode>())
}
val serializer = SearchRecordJsonSerializer()
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/AbstractJavadocTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/AbstractJavadocTemplateMapTest.kt
index e37f8daf..09feebe9 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/AbstractJavadocTemplateMapTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/AbstractJavadocTemplateMapTest.kt
@@ -3,14 +3,12 @@ package org.jetbrains.dokka.javadoc
import org.jetbrains.dokka.DokkaConfigurationImpl
import org.jetbrains.dokka.ExternalDocumentationLink
import org.jetbrains.dokka.javadoc.pages.JavadocPageNode
-import org.jetbrains.dokka.javadoc.pages.preprocessors
import org.jetbrains.dokka.javadoc.renderer.JavadocContentToTemplateMapTranslator
+import org.jetbrains.dokka.javadoc.JavadocPlugin
+import org.jetbrains.dokka.javadoc.location.JavadocLocationProvider
import org.jetbrains.dokka.model.withDescendants
import org.jetbrains.dokka.pages.RootPageNode
-import org.jetbrains.dokka.plugability.DokkaContext
-import org.jetbrains.dokka.plugability.DokkaPlugin
-import org.jetbrains.dokka.plugability.plugin
-import org.jetbrains.dokka.plugability.querySingle
+import org.jetbrains.dokka.plugability.*
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
internal abstract class AbstractJavadocTemplateMapTest : AbstractCoreTest() {
@@ -36,7 +34,7 @@ internal abstract class AbstractJavadocTemplateMapTest : AbstractCoreTest() {
val translator: JavadocContentToTemplateMapTranslator by lazy {
val locationProvider = context.plugin<JavadocPlugin>()
.querySingle { locationProviderFactory }
- .getLocationProvider(rootPageNode)
+ .getLocationProvider(rootPageNode) as JavadocLocationProvider
JavadocContentToTemplateMapTranslator(locationProvider, context)
}
@@ -68,6 +66,7 @@ internal abstract class AbstractJavadocTemplateMapTest : AbstractCoreTest() {
) {
testInline(query, configuration, pluginOverrides = pluginsOverride) {
renderingStage = { rootPageNode, dokkaContext ->
+ val preprocessors = dokkaContext.plugin<JavadocPlugin>().query { javadocPreprocessors }
val transformedRootPageNode = preprocessors.fold(rootPageNode) { acc, pageTransformer ->
pageTransformer(acc)
}
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocTest.kt
index 9adcc2e0..e69de29b 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocTest.kt
@@ -1,69 +0,0 @@
-package org.jetbrains.dokka.javadoc
-
-import org.jetbrains.dokka.javadoc.JavadocPlugin
-import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
-import org.junit.jupiter.api.Test
-
-class JavadocTest : AbstractCoreTest() {
-
- @Test
- fun test() {
- val config = dokkaConfiguration {
- format = "javadoc"
- sourceSets {
- sourceSet {
- sourceRoots = listOf("jvmSrc/")
- analysisPlatform = "jvm"
- }
- }
- }
-
- /*
- |/jvmSrc/javadoc/test/Test2.kt
- |package javadoc.test
- |class Test2()
- */
-
- testInline("""
- |/jvmSrc/javadoc/Test.kt
- |/**
- | test
- |**/
- |package javadoc
- |class Test() : List<Int>
- |class Test2() : List<Int>
- |/jvmSrc/javadoc/TestJ.java
- |package javadoc
- |abstract class Test3 extends List<Int> {}
- """.trimIndent(),
- config,
- cleanupOutput = false,
- pluginOverrides = listOf(JavadocPlugin())
- ) {
- pagesTransformationStage = {
- it
- }
- }
- }
-
-// @Test
-// fun test() {
-// val config = dokkaConfiguration {
-// format = "javadoc"
-// passes {
-// pass {
-// sourceRoots = listOf("main/")
-// analysisPlatform = "jvm"
-// targets = listOf("jvm")
-// }
-// }
-// }
-// testFromData(config,
-// cleanupOutput = false,
-// pluginOverrides = listOf(JavadocPlugin())) {
-// pagesTransformationStage = {
-// it
-// }
-// }
-// }
-}
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt
index afea5914..87de4228 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt
@@ -16,7 +16,7 @@ import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.assertEquals
-class JavadocTest : AbstractCoreTest() {
+class JavadocLocationTest : AbstractCoreTest() {
private fun locationTestInline(testHandler: (RootPageNode, DokkaContext) -> Unit) {
fun externalLink(link: String) = ExternalDocumentationLink(link)
@@ -134,7 +134,7 @@ class JavadocTest : AbstractCoreTest() {
private fun htmlTranslator(rootPageNode: RootPageNode, dokkaContext: DokkaContext): JavadocContentToHtmlTranslator {
val locationProvider = dokkaContext.plugin<JavadocPlugin>().querySingle { locationProviderFactory }
- .getLocationProvider(rootPageNode)
+ .getLocationProvider(rootPageNode) as JavadocLocationProvider
return htmlTranslator(dokkaContext, locationProvider)
}
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt
new file mode 100644
index 00000000..f31b5793
--- /dev/null
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt
@@ -0,0 +1,74 @@
+package org.jetbrains.dokka.javadoc.packagelist
+
+import org.jetbrains.dokka.javadoc.AbstractJavadocTemplateMapTest
+import org.junit.jupiter.api.Test
+import utils.TestOutputWriterPlugin
+import org.junit.jupiter.api.Assertions.*
+
+internal class JavadocPackageListTest : AbstractJavadocTemplateMapTest() {
+ @Test
+ fun `package list should be generated for a flat structure`(){
+ val writerPlugin = TestOutputWriterPlugin()
+ dualTestTemplateMapInline(
+ java = """
+ /src/package0/ClassA.java
+ package package0
+ public class ClassA {
+
+ }
+
+ /src/package1/ClassB.java
+ package package1
+ public class ClassB {
+ }
+ """,
+ pluginsOverride = listOf(writerPlugin)
+ ){
+ val contents = writerPlugin.writer.contents
+ val expected = """
+ ${'$'}dokka.format:dokkaJavadoc
+ ${'$'}dokka.linkExtension:html
+
+ package0
+ package1
+ """.trimIndent()
+ assertEquals(expected, contents["/package-list"]?.trimIndent())
+ }
+ }
+
+ @Test
+ fun `package list should be generated for nested structure`(){
+ val writerPlugin = TestOutputWriterPlugin()
+ dualTestTemplateMapInline(
+ java = """
+ /src/package0/ClassA.java
+ package package0
+ public class ClassA {
+
+ }
+
+ /src/package0/package0Inner/ClassB.java
+ package package0.package0Inner
+ public class ClassB {
+ }
+
+ /src/package1/package1Inner/package1InnerInner/ClassC.java
+ package package1.package1Inner.package1InnerInner
+ public class ClassC {
+ }
+ """,
+ pluginsOverride = listOf(writerPlugin)
+ ){
+ val contents = writerPlugin.writer.contents
+ val expected = """
+ ${'$'}dokka.format:dokkaJavadoc
+ ${'$'}dokka.linkExtension:html
+
+ package0
+ package0.package0Inner
+ package1.package1Inner.package1InnerInner
+ """.trimIndent()
+ assertEquals(expected, contents["/package-list"]?.trimIndent())
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/javadoc/src/test/resources/javadoc/test/main/java/adaptation/Adaptation.kt b/plugins/javadoc/src/test/resources/javadoc/test/main/java/adaptation/Adaptation.kt
deleted file mode 100644
index 6ec3692a..00000000
--- a/plugins/javadoc/src/test/resources/javadoc/test/main/java/adaptation/Adaptation.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-package adaptation
-
-import app.MainApp
-import model.InteriorNode
-import model.ModelGraph
-import org.javatuples.Pair
-import transformation.Transformation
-
-class Adaptation {
- private val log: org.apache.log4j.Logger = org.apache.log4j.Logger.getLogger(Adaptation::class.java.name)
- fun transform(graph: ModelGraph, transformation: Transformation): Pair<ModelGraph, Boolean> {
- return transform(graph, transformation, false)
- }
-
- private fun transform(
- graph: ModelGraph,
- transformation: Transformation,
- prevResult: Boolean
- ): Pair<ModelGraph, Boolean> {
- var model: ModelGraph = graph
- val interiors: Collection<InteriorNode> = graph.getInteriors()
- for (i in interiors) {
- try {
- if (transformation.isConditionCompleted(graph, i)) {
- model = transformation.transformGraph(model, i)
- log.info(
- "Executing transformation: " + transformation.getClass().getSimpleName()
- .toString() + " on interior" + i.getId()
- )
- Thread.sleep(1000)
- return transform(model, transformation, true)
- }
- } catch (e: Exception) {
- log.error(
- "Transformation " + transformation.getClass().getSimpleName()
- .toString() + " returned an error: " + e.toString() + " for interior: " + i.toString()
- )
- }
- }
- return Pair(model, prevResult)
- }
-
- inner class AdaptationInternalClass internal constructor(var param: Int) {
-
- inner class AdaptationInternalInternalClass
-
- }
-
- class AdaptationInternalStaticClass internal constructor(var param: Int)
-} \ No newline at end of file