aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-06-30 11:29:29 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-07-02 13:17:28 +0200
commit6a15ef4a921058a86bd831f464ec00f6f33b56c9 (patch)
tree13b1fbae0b8f8daaa1af95d9976a6b23869bfbe0
parentae8b4481b56d6bac4a3feb6a427e77afdbe36b2f (diff)
downloaddokka-6a15ef4a921058a86bd831f464ec00f6f33b56c9.tar.gz
dokka-6a15ef4a921058a86bd831f464ec00f6f33b56c9.tar.bz2
dokka-6a15ef4a921058a86bd831f464ec00f6f33b56c9.zip
Javadoc location test
-rw-r--r--core/migration_guide.md3
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt1
-rw-r--r--plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt63
3 files changed, 66 insertions, 1 deletions
diff --git a/core/migration_guide.md b/core/migration_guide.md
index b5d9678f..b8ff7893 100644
--- a/core/migration_guide.md
+++ b/core/migration_guide.md
@@ -83,3 +83,6 @@ dokkaMultimodule {
}
```
+### Maven
+
+There are no changes in maven configuration API for dokka, so all previous configurations should work without issues.
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt
index 2d24bbf1..6e467542 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt
@@ -5,7 +5,6 @@ import javadoc.location.JavadocLocationProviderFactory
import javadoc.renderer.KorteJavadocRenderer
import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.base.DokkaBase
-import org.jetbrains.dokka.base.resolvers.external.JavadocExternalLocationProviderFactory
import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.plugability.querySingle
diff --git a/plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt b/plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt
new file mode 100644
index 00000000..cbaa3dd6
--- /dev/null
+++ b/plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt
@@ -0,0 +1,63 @@
+package javadoc.location
+
+import javadoc.pages.JavadocClasslikePageNode
+import javadoc.pages.JavadocPackagePageNode
+import javadoc.renderer.JavadocContentToHtmlTranslator
+import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.ExternalDocumentationLinkImpl
+import org.jetbrains.dokka.javadoc.JavadocPlugin
+import org.jetbrains.dokka.model.firstChildOfType
+import org.jetbrains.dokka.plugability.plugin
+import org.jetbrains.dokka.plugability.querySingle
+import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
+import org.junit.jupiter.api.Test
+
+class JavadocTest : AbstractCoreTest() {
+
+ @Test
+ fun `resolved signature with external links`() {
+
+ fun externalLink(link: String) = DokkaConfiguration.ExternalDocumentationLink
+ .Builder(link)
+ .build() as ExternalDocumentationLinkImpl
+
+ val config = dokkaConfiguration {
+ format = "javadoc"
+ passes {
+ pass {
+ sourceRoots = listOf("jvmSrc/")
+ externalDocumentationLinks = listOf(
+ externalLink("https://docs.oracle.com/javase/8/docs/api/"),
+ externalLink("https://kotlinlang.org/api/latest/jvm/stdlib/")
+ )
+ analysisPlatform = "jvm"
+ }
+ }
+ }
+
+ testInline(
+ """
+ |/jvmSrc/javadoc/Test.kt
+ |package javadoc
+ |class Test() : Serializable, Cloneable
+ """.trimIndent(),
+ config,
+ cleanupOutput = false,
+ pluginOverrides = listOf(JavadocPlugin())
+ ) {
+ renderingStage = { rootPageNode, dokkaContext ->
+ val transformer = JavadocContentToHtmlTranslator(
+ dokkaContext.plugin<JavadocPlugin>().querySingle { locationProviderFactory }
+ .getLocationProvider(rootPageNode),
+ dokkaContext
+ )
+ val testClass = rootPageNode.firstChildOfType<JavadocPackagePageNode>()
+ .firstChildOfType<JavadocClasslikePageNode>()
+ assert(
+ "public final class <a href=javadoc/Test.html>Test</a> extends <a href=https://docs.oracle.com/javase/8/docs/api/java/lang/Cloneable.html>Cloneable</a>"
+ == transformer.htmlForContentNode(testClass.signature, null)
+ )
+ }
+ }
+ }
+} \ No newline at end of file