aboutsummaryrefslogtreecommitdiff
path: root/core/test-api/src/main
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-07-05 10:04:55 +0200
committerGitHub <noreply@github.com>2023-07-05 10:04:55 +0200
commit9559158bfeeb274e9ccf1b4563f1b23b42afc493 (patch)
tree3ece0887623cfe2b7148af23001867a1dd5e6597 /core/test-api/src/main
parentcbd9733d3dd2f52992e98e7cebd072091a572529 (diff)
downloaddokka-9559158bfeeb274e9ccf1b4563f1b23b42afc493.tar.gz
dokka-9559158bfeeb274e9ccf1b4563f1b23b42afc493.tar.bz2
dokka-9559158bfeeb274e9ccf1b4563f1b23b42afc493.zip
Decompose Kotlin/Java analysis (#3034)
* Extract analysis into separate modules
Diffstat (limited to 'core/test-api/src/main')
-rw-r--r--core/test-api/src/main/kotlin/testApi/logger/TestLogger.kt2
-rw-r--r--core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt4
-rw-r--r--core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt25
3 files changed, 18 insertions, 13 deletions
diff --git a/core/test-api/src/main/kotlin/testApi/logger/TestLogger.kt b/core/test-api/src/main/kotlin/testApi/logger/TestLogger.kt
index e70200a7..1e301735 100644
--- a/core/test-api/src/main/kotlin/testApi/logger/TestLogger.kt
+++ b/core/test-api/src/main/kotlin/testApi/logger/TestLogger.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.testApi.logger
import org.jetbrains.dokka.utilities.DokkaLogger
-import java.util.Collections
+import java.util.*
/*
* Even in tests it be used in a concurrent environment, so needs to be thread safe
diff --git a/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt b/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt
index 50ab3bad..c63f5b2e 100644
--- a/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt
+++ b/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt
@@ -1,6 +1,5 @@
package testApi.testRunner
-import org.intellij.markdown.MarkdownElementTypes
import org.jetbrains.dokka.*
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
@@ -206,6 +205,5 @@ fun dPackage(
fun documentationNode(vararg texts: String): DocumentationNode {
return DocumentationNode(
texts.toList()
- .map { Description(CustomDocTag(listOf(Text(it)), name = MarkdownElementTypes.MARKDOWN_FILE.name)) })
+ .map { Description(CustomDocTag(listOf(Text(it)), name = "MARKDOWN_FILE")) })
}
-
diff --git a/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt b/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt
index 31443b2d..cfb809ea 100644
--- a/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt
+++ b/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt
@@ -1,7 +1,8 @@
package org.jetbrains.dokka.testApi.testRunner
-import com.intellij.openapi.application.PathManager
-import org.jetbrains.dokka.*
+import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.DokkaConfigurationImpl
+import org.jetbrains.dokka.ExternalDocumentationLinkImpl
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.DokkaContext
@@ -37,7 +38,7 @@ abstract class AbstractTest<M : TestMethods, T : TestBuilder<M>, D : DokkaTestGe
cleanupOutput: Boolean = true,
useOutputLocationFromConfig: Boolean = false,
pluginOverrides: List<DokkaPlugin> = emptyList(),
- block: T.() -> Unit
+ block: T.() -> Unit,
) {
val testMethods = testBuilder().apply(block).build()
val configurationToUse =
@@ -65,7 +66,7 @@ abstract class AbstractTest<M : TestMethods, T : TestBuilder<M>, D : DokkaTestGe
cleanupOutput: Boolean = true,
pluginOverrides: List<DokkaPlugin> = emptyList(),
loggerForTest: DokkaLogger = logger,
- block: T.() -> Unit
+ block: T.() -> Unit,
) {
val testMethods = testBuilder().apply(block).build()
val testDirPath = getTempDir(cleanupOutput).root.toPath().toAbsolutePath()
@@ -133,7 +134,7 @@ abstract class AbstractTest<M : TestMethods, T : TestBuilder<M>, D : DokkaTestGe
private fun Map<String, String>.materializeFiles(
root: Path = Paths.get("."),
- charset: Charset = Charset.forName("utf-8")
+ charset: Charset = Charset.forName("utf-8"),
) = this.map { (path, content) ->
val file = root.resolve(path)
Files.createDirectories(file.parent)
@@ -160,11 +161,17 @@ abstract class AbstractTest<M : TestMethods, T : TestBuilder<M>, D : DokkaTestGe
protected val jvmStdlibPath: String? by lazy {
- PathManager.getResourceRoot(Strictfp::class.java, "/kotlin/jvm/Strictfp.class")
+ ClassLoader.getSystemResource("kotlin/jvm/Strictfp.class")
+ ?.file
+ ?.replace("file:", "")
+ ?.replaceAfter(".jar", "")
}
protected val jsStdlibPath: String? by lazy {
- PathManager.getResourceRoot(Any::class.java, "/kotlin/jquery")
+ ClassLoader.getSystemResource("kotlin/jquery")
+ ?.file
+ ?.replace("file:", "")
+ ?.replaceAfter(".jar", "")
}
protected val commonStdlibPath: String? by lazy {
@@ -195,7 +202,7 @@ open class CoreTestMethods(
open val documentablesTransformationStage: (DModule) -> Unit,
open val pagesGenerationStage: (RootPageNode) -> Unit,
open val pagesTransformationStage: (RootPageNode) -> Unit,
- open val renderingStage: (RootPageNode, DokkaContext) -> Unit
+ open val renderingStage: (RootPageNode, DokkaContext) -> Unit,
) : TestMethods
abstract class TestBuilder<M : TestMethods> {
@@ -206,7 +213,7 @@ abstract class DokkaTestGenerator<T : TestMethods>(
protected val configuration: DokkaConfiguration,
protected val logger: DokkaLogger,
protected val testMethods: T,
- protected val additionalPlugins: List<DokkaPlugin> = emptyList()
+ protected val additionalPlugins: List<DokkaPlugin> = emptyList(),
) {
abstract fun generate()
}