aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-07-08 10:33:26 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-07-08 11:48:29 +0200
commit6d1e25756c3e8c43ce4d5721e7665f439a19e47c (patch)
tree4a0043bebf061479ccaeaa19129229894eb9598b /plugins
parenta97ae720815e462c2e941d84c6273d8ecc138e6b (diff)
downloaddokka-6d1e25756c3e8c43ce4d5721e7665f439a19e47c.tar.gz
dokka-6d1e25756c3e8c43ce4d5721e7665f439a19e47c.tar.bz2
dokka-6d1e25756c3e8c43ce4d5721e7665f439a19e47c.zip
Move common base test utils to submodule
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/build.gradle.kts5
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt11
-rw-r--r--plugins/base/test-utils/build.gradle.kts4
-rw-r--r--plugins/base/test-utils/src/main/kotlin/renderers/RenderingOnlyTestBase.kt8
-rw-r--r--plugins/base/test-utils/src/main/kotlin/renderers/TestPage.kt (renamed from plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt)30
-rw-r--r--plugins/base/test-utils/src/main/kotlin/renderers/defaultSourceSet.kt (renamed from plugins/base/src/test/kotlin/renderers/defaultSourceSet.kt)0
-rw-r--r--plugins/base/test-utils/src/main/kotlin/utils/TestOutputWriter.kt (renamed from plugins/base/src/test/kotlin/utils/TestOutputWriter.kt)0
-rw-r--r--plugins/gfm/build.gradle.kts2
-rw-r--r--plugins/gfm/src/main/kotlin/GfmPlugin.kt8
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt6
10 files changed, 38 insertions, 36 deletions
diff --git a/plugins/base/build.gradle.kts b/plugins/base/build.gradle.kts
index 08d1054a..1cedf354 100644
--- a/plugins/base/build.gradle.kts
+++ b/plugins/base/build.gradle.kts
@@ -4,8 +4,6 @@ plugins {
id("com.jfrog.bintray")
}
-val testUtils by configurations.creating
-
dependencies {
val coroutines_version: String by project
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
@@ -14,8 +12,7 @@ dependencies {
implementation("org.jsoup:jsoup:1.12.1")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.10")
testImplementation(project(":test-tools"))
-
- testUtils(sourceSets.test.get().output)
+ testImplementation(project(":plugins:base:test-utils"))
}
task("copy_frontend", Copy::class) {
diff --git a/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt b/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt
index 4f51a97d..f93eccb5 100644
--- a/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/HtmlRenderingOnlyTestBase.kt
@@ -65,14 +65,3 @@ private fun Any.accepts(n: Node) {
else -> throw IllegalArgumentException("$this is not proper matcher")
}
}
-
-
-internal object EmptyCommentConverter : CommentsToContentConverter {
- override fun buildContent(
- docTag: DocTag,
- dci: DCI,
- sourceSets: Set<DokkaConfiguration.DokkaSourceSet>,
- styles: Set<Style>,
- extras: PropertyContainer<ContentNode>
- ): List<ContentNode> = emptyList()
-} \ No newline at end of file
diff --git a/plugins/base/test-utils/build.gradle.kts b/plugins/base/test-utils/build.gradle.kts
new file mode 100644
index 00000000..4c39ed60
--- /dev/null
+++ b/plugins/base/test-utils/build.gradle.kts
@@ -0,0 +1,4 @@
+dependencies {
+ compileOnly(project(":plugins:base"))
+ implementation(project(":testApi"))
+} \ No newline at end of file
diff --git a/plugins/base/test-utils/src/main/kotlin/renderers/RenderingOnlyTestBase.kt b/plugins/base/test-utils/src/main/kotlin/renderers/RenderingOnlyTestBase.kt
new file mode 100644
index 00000000..e5ff8fa8
--- /dev/null
+++ b/plugins/base/test-utils/src/main/kotlin/renderers/RenderingOnlyTestBase.kt
@@ -0,0 +1,8 @@
+package renderers
+
+import org.jetbrains.dokka.testApi.context.MockContext
+
+abstract class RenderingOnlyTestBase<T> {
+ abstract val context: MockContext
+ abstract val renderedContent: T
+}
diff --git a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt b/plugins/base/test-utils/src/main/kotlin/renderers/TestPage.kt
index b5523d50..0dae8ce6 100644
--- a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
+++ b/plugins/base/test-utils/src/main/kotlin/renderers/TestPage.kt
@@ -1,21 +1,15 @@
package renderers
-import org.jetbrains.dokka.base.signatures.KotlinSignatureProvider
-import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
+import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.Documentable
-import org.jetbrains.dokka.pages.ContentNode
-import org.jetbrains.dokka.pages.ContentPage
-import org.jetbrains.dokka.pages.PageNode
-import org.jetbrains.dokka.pages.RootPageNode
-import org.jetbrains.dokka.testApi.context.MockContext
+import org.jetbrains.dokka.model.doc.DocTag
+import org.jetbrains.dokka.model.properties.PropertyContainer
+import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.utilities.DokkaConsoleLogger
-import renderers.html.EmptyCommentConverter
-
-abstract class RenderingOnlyTestBase<T> {
- abstract val context: MockContext
- abstract val renderedContent: T
-}
+import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
+import org.jetbrains.dokka.base.signatures.KotlinSignatureProvider
+import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
class TestPage(callback: PageContentBuilder.DocumentableContentBuilder.() -> Unit) : RootPageNode(), ContentPage {
override val dri: Set<DRI> = setOf(DRI.topLevel)
@@ -46,3 +40,13 @@ class TestPage(callback: PageContentBuilder.DocumentableContentBuilder.() -> Uni
override fun modified(name: String, children: List<PageNode>) = this
}
+
+internal object EmptyCommentConverter : CommentsToContentConverter {
+ override fun buildContent(
+ docTag: DocTag,
+ dci: DCI,
+ sourceSets: Set<DokkaConfiguration.DokkaSourceSet>,
+ styles: Set<Style>,
+ extras: PropertyContainer<ContentNode>
+ ): List<ContentNode> = emptyList()
+} \ No newline at end of file
diff --git a/plugins/base/src/test/kotlin/renderers/defaultSourceSet.kt b/plugins/base/test-utils/src/main/kotlin/renderers/defaultSourceSet.kt
index 7358d2c2..7358d2c2 100644
--- a/plugins/base/src/test/kotlin/renderers/defaultSourceSet.kt
+++ b/plugins/base/test-utils/src/main/kotlin/renderers/defaultSourceSet.kt
diff --git a/plugins/base/src/test/kotlin/utils/TestOutputWriter.kt b/plugins/base/test-utils/src/main/kotlin/utils/TestOutputWriter.kt
index 00b865b4..00b865b4 100644
--- a/plugins/base/src/test/kotlin/utils/TestOutputWriter.kt
+++ b/plugins/base/test-utils/src/main/kotlin/utils/TestOutputWriter.kt
diff --git a/plugins/gfm/build.gradle.kts b/plugins/gfm/build.gradle.kts
index 7bea1b97..2addd9c9 100644
--- a/plugins/gfm/build.gradle.kts
+++ b/plugins/gfm/build.gradle.kts
@@ -10,5 +10,5 @@ publishing {
dependencies {
compileOnly(project(":plugins:base"))
testImplementation(project(":plugins:base"))
- testImplementation(project(":plugins:base", configuration = "testUtils"))
+ testImplementation(project(":plugins:base:test-utils"))
}
diff --git a/plugins/gfm/src/main/kotlin/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/GfmPlugin.kt
index 671b87f8..df9d032f 100644
--- a/plugins/gfm/src/main/kotlin/GfmPlugin.kt
+++ b/plugins/gfm/src/main/kotlin/GfmPlugin.kt
@@ -149,7 +149,7 @@ open class CommonmarkRenderer(
platforms.joinToString(
prefix = " [",
postfix = "] $text "
- ) { it.sourceSetID.toString() })
+ ) { "${it.moduleDisplayName}/${it.displayName}" })
buildNewLine()
}
}
@@ -166,7 +166,7 @@ open class CommonmarkRenderer(
) {
if (node.dci.kind == ContentKind.Sample || node.dci.kind == ContentKind.Parameters) {
node.sourceSets.forEach { sourcesetData ->
- append(sourcesetData.sourceSetID.toString())
+ append("${sourcesetData.moduleDisplayName}/${sourcesetData.displayName}")
buildNewLine()
buildTable(
node.copy(
@@ -251,7 +251,7 @@ open class CommonmarkRenderer(
distinct.values.forEach { entry ->
val (instance, sourceSets) = entry.getInstanceAndSourceSets()
- append(sourceSets.joinToString(prefix = "#### [", postfix = "]") { it.sourceSetID.toString() })
+ append(sourceSets.joinToString(prefix = "#### [", postfix = "]") { "${it.moduleDisplayName}/${it.displayName}" })
buildNewLine()
instance.before?.let {
append("##### Brief description")
@@ -266,7 +266,7 @@ open class CommonmarkRenderer(
.values.forEach { innerEntry ->
val (innerInstance, innerSourceSets) = innerEntry.getInstanceAndSourceSets()
if(sourceSets.size > 1) {
- append(innerSourceSets.joinToString(prefix = "###### [", postfix = "]") { it.sourceSetID.toString() })
+ append(innerSourceSets.joinToString(prefix = "###### [", postfix = "]") { "${it.moduleDisplayName}/${it.displayName}" })
buildNewLine()
}
innerInstance.divergent.build(this@buildDivergent, pageContext)
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
index 035a9264..634f427a 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
@@ -13,21 +13,21 @@ import renderers.TestPage
class DivergentTest : GfmRenderingOnlyTestBase() {
private val js = defaultSourceSet.copy(
"root",
- "JS",
+ "js",
DokkaSourceSetID("root", "js"),
analysisPlatform = Platform.js,
sourceRoots = listOf(SourceRootImpl("pl1"))
)
private val jvm = defaultSourceSet.copy(
"root",
- "JVM",
+ "jvm",
DokkaSourceSetID("root", "jvm"),
analysisPlatform = Platform.jvm,
sourceRoots = listOf(SourceRootImpl("pl1"))
)
private val native = defaultSourceSet.copy(
"root",
- "NATIVE",
+ "native",
DokkaSourceSetID("root", "native"),
analysisPlatform = Platform.native,
sourceRoots = listOf(SourceRootImpl("pl1"))