aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-05-20 12:05:26 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-06-15 13:15:30 +0200
commitf3baf10b4c882230d382bfcdd94163d070bd0e25 (patch)
tree128b63b10f05242cfce88da6714d9e04987b5651
parent645e02fb42bbf1cd3ee2773a014ea1e553e09229 (diff)
downloaddokka-f3baf10b4c882230d382bfcdd94163d070bd0e25.tar.gz
dokka-f3baf10b4c882230d382bfcdd94163d070bd0e25.tar.bz2
dokka-f3baf10b4c882230d382bfcdd94163d070bd0e25.zip
Rework dokka configuration and Gradle plugin
-rw-r--r--.idea/compiler.xml148
-rw-r--r--build.gradle.kts7
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt14
-rw-r--r--core/src/main/kotlin/configuration.kt10
-rw-r--r--core/src/main/kotlin/defaultConfiguration.kt14
-rw-r--r--core/src/main/kotlin/model/SourceSetData.kt23
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt29
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt2
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt17
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt4
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt2
-rw-r--r--plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt1
-rw-r--r--plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt1
-rw-r--r--plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt3
-rw-r--r--plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt1
-rw-r--r--plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt8
-rw-r--r--plugins/base/src/test/kotlin/markdown/LinkTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/model/InheritorsTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/model/PackagesTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt6
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt6
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt6
-rw-r--r--plugins/base/src/test/kotlin/utils/ModelUtils.kt2
-rw-r--r--plugins/gfm/src/main/kotlin/GfmPlugin.kt2
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt64
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt152
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt7
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt10
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt169
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt11
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt24
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt17
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt55
-rw-r--r--settings.gradle.kts5
-rw-r--r--testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt25
35 files changed, 319 insertions, 534 deletions
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index dd174dd7..a6b0adf4 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -12,148 +12,12 @@
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<bytecodeTargetLevel target="1.8">
- <module name="android-gradle-plugin_main" target="1.8" />
- <module name="android-gradle-plugin_test" target="1.8" />
- <module name="ant_main" target="1.8" />
- <module name="ant_test" target="1.8" />
- <module name="base.dokka.plugins.base.main" target="1.8" />
- <module name="base.dokka.plugins.base.test" target="1.8" />
- <module name="blazejkardys.Workspace.dokka.buildSrc.main" target="1.8" />
- <module name="blazejkardys.Workspace.dokka.buildSrc.test" target="1.8" />
- <module name="buildSrc_main" target="1.8" />
- <module name="buildSrc_test" target="1.8" />
- <module name="cli.dokka.runners.cli.main" target="1.8" />
- <module name="cli.dokka.runners.cli.test" target="1.8" />
- <module name="cli_main" target="1.8" />
- <module name="cli_test" target="1.8" />
- <module name="core_main" target="1.8" />
- <module name="core_test" target="1.8" />
- <module name="dokka.core.search-component.main" target="1.8" />
- <module name="dokka.core.search-component.test" target="1.8" />
- <module name="dokka.core.testApi.main" target="1.8" />
- <module name="dokka.core.testApi.test" target="1.8" />
- <module name="dokka.integration.main" target="1.8" />
- <module name="dokka.integration.test" target="1.8" />
- <module name="dokka.plugins.base.search-component.main" target="1.8" />
- <module name="dokka.plugins.base.search-component.test" target="1.8" />
- <module name="dokka.plugins.javadoc8.main" target="1.8" />
- <module name="dokka.plugins.javadoc8.test" target="1.8" />
- <module name="dokka.plugins.ma.main" target="1.8" />
- <module name="dokka.plugins.ma.test" target="1.8" />
- <module name="dokka.plugins.xml.main" target="1.8" />
- <module name="dokka.plugins.xml.test" target="1.8" />
- <module name="dokka.runners.android-gradle-plugin.main" target="1.8" />
- <module name="dokka.runners.android-gradle-plugin.test" target="1.8" />
- <module name="dokka.runners.ant.main" target="1.8" />
- <module name="dokka.runners.ant.test" target="1.8" />
- <module name="dokka.runners.fatjar.main" target="1.8" />
- <module name="dokka.runners.fatjar.test" target="1.8" />
- <module name="dokka.runners.gradle-integration-tests.main" target="1.8" />
- <module name="dokka.runners.gradle-integration-tests.test" target="1.8" />
- <module name="fatjar_main" target="1.8" />
- <module name="fatjar_test" target="1.8" />
- <module name="gradle-integration-tests.dokka.integration-tests.gradle-integration-tests.main" target="1.8" />
- <module name="gradle-integration-tests.dokka.integration-tests.gradle-integration-tests.test" target="1.8" />
- <module name="gradle-integration-tests.org.jetbrains.dokka.gradle-integration-tests.main" target="1.8" />
- <module name="gradle-integration-tests.org.jetbrains.dokka.gradle-integration-tests.test" target="1.8" />
- <module name="gradle-integration-tests_main" target="1.8" />
- <module name="gradle-integration-tests_test" target="1.8" />
- <module name="gradle-plugin.dokka.runners.gradle-plugin.main" target="1.8" />
- <module name="gradle-plugin.dokka.runners.gradle-plugin.test" target="1.8" />
- <module name="gradle-plugin_main" target="1.8" />
- <module name="gradle-plugin_test" target="1.8" />
- <module name="integration_main" target="1.8" />
- <module name="integration_test" target="1.8" />
- <module name="kotlin-as-java.dokka.plugins.kotlin-as-java.main" target="1.8" />
- <module name="kotlin-as-java.dokka.plugins.kotlin-as-java.test" target="1.8" />
- <module name="mathjax.dokka.plugins.mathjax.main" target="1.8" />
- <module name="mathjax.dokka.plugins.mathjax.test" target="1.8" />
- <module name="maven-plugin.dokka.runners.maven-plugin.main" target="1.8" />
- <module name="maven-plugin.dokka.runners.maven-plugin.test" target="1.8" />
- <module name="maven-plugin_main" target="1.8" />
- <module name="maven-plugin_test" target="1.8" />
- <module name="org.jetbrains.dokka.android-gradle-plugin.main" target="1.8" />
- <module name="org.jetbrains.dokka.android-gradle-plugin.test" target="1.8" />
- <module name="org.jetbrains.dokka.ant.main" target="1.8" />
- <module name="org.jetbrains.dokka.ant.test" target="1.8" />
- <module name="org.jetbrains.dokka.buildSrc.main" target="1.8" />
- <module name="org.jetbrains.dokka.buildSrc.test" target="1.8" />
- <module name="org.jetbrains.dokka.cli.main" target="1.8" />
- <module name="org.jetbrains.dokka.cli.test" target="1.8" />
- <module name="org.jetbrains.dokka.core.main" target="1.8" />
- <module name="org.jetbrains.dokka.core.test" target="1.8" />
- <module name="org.jetbrains.dokka.coreDependencies.main" target="1.8" />
- <module name="org.jetbrains.dokka.coreDependencies.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.core.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.core.search-component.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.core.search-component.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.core.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.coreDependencies.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.coreDependencies.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.integration-tests.gradle-integration-tests.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.integration-tests.gradle-integration-tests.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.integration-tests.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.integration-tests.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.base.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.base.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.gfm.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.gfm.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.jekyll.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.jekyll.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.kotlin-as-java.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.kotlin-as-java.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.mathjax.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.mathjax.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.plugins.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.runners.cli.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.runners.cli.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.runners.gradle-plugin.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.runners.gradle-plugin.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.runners.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.runners.maven-plugin.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.runners.maven-plugin.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.runners.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.search-component.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.search-component.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.test-tools.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.test-tools.test" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.testApi.main" target="1.8" />
- <module name="org.jetbrains.dokka.dokka.testApi.test" target="1.8" />
- <module name="org.jetbrains.dokka.fatjar.main" target="1.8" />
- <module name="org.jetbrains.dokka.fatjar.test" target="1.8" />
- <module name="org.jetbrains.dokka.gradle-integration-tests.main" target="1.8" />
- <module name="org.jetbrains.dokka.gradle-integration-tests.test" target="1.8" />
- <module name="org.jetbrains.dokka.gradle-plugin.main" target="1.8" />
- <module name="org.jetbrains.dokka.gradle-plugin.test" target="1.8" />
- <module name="org.jetbrains.dokka.integration.main" target="1.8" />
- <module name="org.jetbrains.dokka.integration.test" target="1.8" />
- <module name="org.jetbrains.dokka.javadoc8.main" target="1.8" />
- <module name="org.jetbrains.dokka.javadoc8.test" target="1.8" />
- <module name="org.jetbrains.dokka.mathjax.main" target="1.8" />
- <module name="org.jetbrains.dokka.mathjax.test" target="1.8" />
- <module name="org.jetbrains.dokka.maven-plugin.main" target="1.8" />
- <module name="org.jetbrains.dokka.maven-plugin.test" target="1.8" />
- <module name="org.jetbrains.dokka.plugins.main" target="1.8" />
- <module name="org.jetbrains.dokka.plugins.test" target="1.8" />
- <module name="org.jetbrains.dokka.testApi.main" target="1.8" />
- <module name="org.jetbrains.dokka.testApi.test" target="1.8" />
- <module name="org.jetbrains.dokka.xml.main" target="1.8" />
- <module name="org.jetbrains.dokka.xml.test" target="1.8" />
- <module name="Workspace.dokka.buildSrc.main" target="1.8" />
- <module name="Workspace.dokka.buildSrc.test" target="1.8" />
- <module name="Workspace.dokka.core.main" target="1.8" />
- <module name="Workspace.dokka.core.test" target="1.8" />
- <module name="Workspace.dokka.coreDependencies.main" target="1.8" />
- <module name="Workspace.dokka.coreDependencies.test" target="1.8" />
- <module name="Workspace.dokka.integration-tests.main" target="1.8" />
- <module name="Workspace.dokka.integration-tests.test" target="1.8" />
- <module name="Workspace.dokka.plugins.main" target="1.8" />
- <module name="Workspace.dokka.plugins.test" target="1.8" />
- <module name="Workspace.dokka.runners.main" target="1.8" />
- <module name="Workspace.dokka.runners.test" target="1.8" />
- <module name="Workspace.dokka.testApi.main" target="1.8" />
- <module name="Workspace.dokka.testApi.test" target="1.8" />
+ <module name="dokka" target="12" />
+ <module name="dokka.buildSrc" target="12" />
+ <module name="dokka.buildSrc.main" target="12" />
+ <module name="dokka.buildSrc.test" target="12" />
+ <module name="dokka.main" target="12" />
+ <module name="dokka.test" target="12" />
</bytecodeTargetLevel>
</component>
</project> \ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 0b3c0da8..c94faa77 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -5,6 +5,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") apply false
id("com.jfrog.bintray") apply false
+ id("java")
}
val dokka_version: String by project
@@ -39,6 +40,12 @@ allprojects {
subprojects {
apply {
plugin("org.jetbrains.kotlin.jvm")
+ plugin("java")
+ }
+
+ // Gradle metadata
+ java {
+ targetCompatibility = JavaVersion.VERSION_1_8
}
}
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
index 61fb7324..c8a892d7 100644
--- a/core/src/main/kotlin/DokkaGenerator.kt
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -5,7 +5,6 @@ import org.jetbrains.dokka.analysis.DokkaResolutionFacade
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.model.SourceSetCache
import org.jetbrains.dokka.model.SourceSetData
-import org.jetbrains.dokka.model.sourceSet
import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.DokkaPlugin
@@ -81,7 +80,7 @@ class DokkaGenerator(
sourceSetsCache: SourceSetCache
): Map<SourceSetData, EnvironmentAndFacade> =
configuration.passesConfigurations.map {
- sourceSetsCache.getSourceSet(it) to createEnvironmentAndFacade(it)
+ sourceSetsCache.getSourceSet(it) to createEnvironmentAndFacade(configuration, it)
}.toMap()
fun initializePlugins(
@@ -139,14 +138,21 @@ class DokkaGenerator(
renderer.render(transformedPages)
}
- private fun createEnvironmentAndFacade(pass: DokkaConfiguration.PassConfiguration): EnvironmentAndFacade =
+ private fun createEnvironmentAndFacade(
+ configuration: DokkaConfiguration,
+ pass: DokkaConfiguration.PassConfiguration
+ ): EnvironmentAndFacade =
AnalysisEnvironment(DokkaMessageCollector(logger), pass.analysisPlatform).run {
if (analysisPlatform == Platform.jvm) {
addClasspath(PathUtil.getJdkClassesRootsFromCurrentJre())
}
pass.classpath.forEach { addClasspath(File(it)) }
- addSources((pass.sourceRoots + pass.dependentSourceRoots).map { it.path })
+ addSources(
+ (pass.sourceRoots + configuration.passesConfigurations.filter { it.sourceSetID in pass.dependentSourceSets }
+ .flatMap { it.sourceRoots })
+ .map { it.path }
+ )
loadLanguageVersionSettings(pass.languageVersion, pass.apiVersion)
diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt
index 0b59f301..fab7af37 100644
--- a/core/src/main/kotlin/configuration.kt
+++ b/core/src/main/kotlin/configuration.kt
@@ -27,20 +27,19 @@ enum class Platform(val key: String) {
interface DokkaConfiguration {
val outputDir: String
val format: String
- val generateIndexPages: Boolean
val cacheRoot: String?
+ val offlineMode: Boolean
val passesConfigurations: List<PassConfiguration>
val modules: List<DokkaModuleDescription>
- val impliedPlatforms: List<String>
val pluginsClasspath: List<File>
val pluginsConfiguration: Map<String, String>
interface PassConfiguration {
val moduleName: String
- val sourceSetName: String
+ val displayName: String
+ val sourceSetID: String
val classpath: List<String>
val sourceRoots: List<SourceRoot>
- val dependentSourceRoots: List<SourceRoot>
val dependentSourceSets: List<String>
val samples: List<String>
val includes: List<String>
@@ -58,10 +57,7 @@ interface DokkaConfiguration {
val noStdlibLink: Boolean
val noJdkLink: Boolean
val suppressedFiles: List<String>
- val collectInheritedExtensionsFromLibraries: Boolean
val analysisPlatform: Platform
- val targets: List<String>
- val sinceKotlin: String?
}
interface SourceRoot {
diff --git a/core/src/main/kotlin/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt
index 7aaa1c89..23cf7e2d 100644
--- a/core/src/main/kotlin/defaultConfiguration.kt
+++ b/core/src/main/kotlin/defaultConfiguration.kt
@@ -6,21 +6,20 @@ import java.net.URL
data class DokkaConfigurationImpl(
override val outputDir: String,
override val format: String,
- override val generateIndexPages: Boolean,
override val cacheRoot: String?,
- override val impliedPlatforms: List<String>,
+ override val offlineMode: Boolean,
override val passesConfigurations: List<PassConfigurationImpl>,
override val pluginsClasspath: List<File>,
override val pluginsConfiguration: Map<String, String>,
override val modules: List<DokkaModuleDescriptionImpl>
) : DokkaConfiguration
-data class PassConfigurationImpl (
+data class PassConfigurationImpl(
override val moduleName: String,
- override val sourceSetName: String,
+ override val displayName: String,
+ override val sourceSetID: String,
override val classpath: List<String>,
override val sourceRoots: List<SourceRootImpl>,
- override val dependentSourceRoots: List<SourceRootImpl>,
override val dependentSourceSets: List<String>,
override val samples: List<String>,
override val includes: List<String>,
@@ -38,10 +37,7 @@ data class PassConfigurationImpl (
override val noStdlibLink: Boolean,
override val noJdkLink: Boolean,
override val suppressedFiles: List<String>,
- override val collectInheritedExtensionsFromLibraries: Boolean,
- override val analysisPlatform: Platform,
- override val targets: List<String>,
- override val sinceKotlin: String?
+ override val analysisPlatform: Platform
) : DokkaConfiguration.PassConfiguration
data class DokkaModuleDescriptionImpl(
diff --git a/core/src/main/kotlin/model/SourceSetData.kt b/core/src/main/kotlin/model/SourceSetData.kt
index 964d5ca9..7d118470 100644
--- a/core/src/main/kotlin/model/SourceSetData.kt
+++ b/core/src/main/kotlin/model/SourceSetData.kt
@@ -6,22 +6,33 @@ import org.jetbrains.dokka.plugability.DokkaContext
data class SourceSetData(
val moduleName: String,
- val sourceSetName: String,
+ val sourceSetID: String,
+ val displayName: String,
val platform: Platform,
val sourceRoots: List<DokkaConfiguration.SourceRoot> = emptyList(),
- val dependentSourceSets: List<String> = emptyList()
+ val dependentSourceSets: List<String> = emptyList()
)
class SourceSetCache {
private val sourceSets = HashMap<String, SourceSetData>()
val allSourceSets: List<SourceSetData>
- get() = sourceSets.values.toList()
+ get() = sourceSets.values.toList()
fun getSourceSet(pass: DokkaConfiguration.PassConfiguration) =
- sourceSets.getOrPut("${pass.moduleName}/${pass.sourceSetName}",
- { SourceSetData(pass.moduleName, pass.sourceSetName, pass.analysisPlatform, pass.sourceRoots, pass.dependentSourceSets) }
+ sourceSets.getOrPut("${pass.moduleName}/${pass.sourceSetID}",
+ {
+ SourceSetData(
+ pass.moduleName,
+ pass.sourceSetID,
+ pass.displayName,
+ pass.analysisPlatform,
+ pass.sourceRoots,
+ pass.dependentSourceSets
+ )
+ }
)
}
-fun DokkaContext.sourceSet(pass: DokkaConfiguration.PassConfiguration) : SourceSetData = sourceSetCache.getSourceSet(pass) \ No newline at end of file
+fun DokkaContext.sourceSet(pass: DokkaConfiguration.PassConfiguration): SourceSetData =
+ sourceSetCache.getSourceSet(pass) \ No newline at end of file
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 42273d20..528b7d16 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -22,7 +22,7 @@ open class HtmlRenderer(
private val sourceSetDependencyMap = with(context.sourceSetCache) {
allSourceSets.map { sourceSet ->
- sourceSet to allSourceSets.filter { sourceSet.dependentSourceSets.contains(it.sourceSetName) }
+ sourceSet to allSourceSets.filter { sourceSet.dependentSourceSets.contains(it.sourceSetID ) }
}.toMap()
}
@@ -93,14 +93,14 @@ open class HtmlRenderer(
group.sourceSets.forEach {
button(classes = "platform-tag platform-selector") {
attributes["data-active"] = ""
- attributes["data-filter"] = it.sourceSetName
- when (it.platform.key) {
+ attributes["data-filter"] = it.sourceSetID
+ when(it.platform.key) {
"common" -> classes = classes + "common-like"
"native" -> classes = classes + "native-like"
"jvm" -> classes = classes + "jvm-like"
"js" -> classes = classes + "js-like"
}
- text(it.sourceSetName)
+ text(it.displayName)
}
}
}
@@ -161,10 +161,10 @@ open class HtmlRenderer(
attributes["data-toggle-list"] = "data-toggle-list"
contents.forEachIndexed { index, pair ->
button(classes = "platform-bookmark") {
- attributes["data-filterable-current"] = pair.first.sourceSetName
- attributes["data-filterable-set"] = pair.first.sourceSetName
+ attributes["data-filterable-current"] = pair.first.sourceSetID
+ attributes["data-filterable-set"] = pair.first.sourceSetID
if (index == 0) attributes["data-active"] = ""
- attributes["data-toggle"] = pair.first.sourceSetName
+ attributes["data-toggle"] = pair.first.sourceSetID
when (
pair.first.platform.key
) {
@@ -173,8 +173,8 @@ open class HtmlRenderer(
"jvm" -> classes = classes + "jvm-like"
"js" -> classes = classes + "js-like"
}
- attributes["data-toggle"] = pair.first.sourceSetName
- text(pair.first.sourceSetName)
+ attributes["data-toggle"] = pair.first.sourceSetID
+ text(pair.first.displayName)
}
}
}
@@ -242,10 +242,10 @@ open class HtmlRenderer(
consumer.onTagContentUnsafe {
+createHTML().div("divergent-group") {
attributes["data-filterable-current"] = groupedDivergent.keys.joinToString(" ") {
- it.sourceSetName
+ it.sourceSetID
}
attributes["data-filterable-set"] = groupedDivergent.keys.joinToString(" ") {
- it.sourceSetName
+ it.sourceSetID
}
val divergentForPlatformDependent = groupedDivergent.map { (sourceSet, elements) ->
@@ -346,12 +346,13 @@ open class HtmlRenderer(
div(classes = "table-row") {
if (!style.contains(MultimoduleTable)) {
attributes["data-filterable-current"] = node.sourceSets.joinToString(" ") {
- it.sourceSetName
+ it.sourceSetID
}
attributes["data-filterable-set"] = node.sourceSets.joinToString(" ") {
- it.sourceSetName
+ it.sourceSetID
}
}
+
it.filterIsInstance<ContentLink>().takeIf { it.isNotEmpty() }?.let {
div("main-subrow " + node.style.joinToString(" ")) {
it.filter { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } }
@@ -396,7 +397,7 @@ open class HtmlRenderer(
"jvm" -> classes = classes + "jvm-like"
"js" -> classes = classes + "js-like"
}
- text(it.sourceSetName)
+ text(it.displayName)
}
}
}
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
index f10c85d5..cdb30555 100644
--- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
@@ -87,7 +87,7 @@ object StyleAndScriptsAppender : PageTransformer {
class SourcesetDependencyAppender(val context: DokkaContext) : PageTransformer{
override fun invoke(input: RootPageNode): RootPageNode {
val dependenciesMap = context.configuration.passesConfigurations.map {
- it.sourceSetName to it.dependentSourceSets
+ it.sourceSetID to it.dependentSourceSets
}.toMap()
fun createDependenciesJson() : String = "sourceset_dependencies = '{${
dependenciesMap.entries.joinToString(", ") {
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
index 322f4927..a9e58f17 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
@@ -98,26 +98,19 @@ open class DefaultLocationProvider(
if (info == null) {
toResolve.getOrPut(jdk) { mutableListOf() }.add(link)
} else if (info.packages.contains(dri.packageName)) {
- return link.url.toExternalForm() + getLink(
- dri,
- info
- )
+ return link.url.toExternalForm() + getLink(dri, info)
}
}
}
// Not in cache, resolve packageLists
for ((jdk, links) in toResolve) {
for (link in links) {
+ if(dokkaContext.configuration.offlineMode && link.packageListUrl.protocol.toLowerCase() != "file")
+ continue
val locationInfo =
- loadPackageList(
- jdk,
- link.packageListUrl
- )
+ loadPackageList(jdk, link.packageListUrl)
if (locationInfo.packages.contains(dri.packageName)) {
- return link.url.toExternalForm() + getLink(
- dri,
- locationInfo
- )
+ return link.url.toExternalForm() + getLink(dri, locationInfo)
}
}
toResolve.remove(jdk)
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
index 04b2636c..2aab6018 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
@@ -53,7 +53,7 @@ internal class ModuleAndPackageDocumentationTransformer(val context: DokkaContex
module.sourceSets.mapNotNull { pd ->
val doc = modulesAndPackagesDocumentation[Pair(module.name, pd)]
val facade = context.platforms[pd]?.facade
- ?: return@mapNotNull null.also { context.logger.warn("Could not find platform data for ${pd.moduleName}/${pd.sourceSetName}") }
+ ?: return@mapNotNull null.also { context.logger.warn("Could not find platform data for ${pd.moduleName}/${pd.sourceSetID}") }
try {
doc?.get("Module")?.get(module.name)?.run {
pd to MarkdownParser(
@@ -72,7 +72,7 @@ internal class ModuleAndPackageDocumentationTransformer(val context: DokkaContex
it.name to it.sourceSets.mapNotNull { pd ->
val doc = modulesAndPackagesDocumentation[Pair(module.name, pd)]
val facade = context.platforms[pd]?.facade
- ?: return@mapNotNull null.also { context.logger.warn("Could not find platform data for ${pd.moduleName}/${pd.sourceSetName}") }
+ ?: return@mapNotNull null.also { context.logger.warn("Could not find platform data for ${pd.moduleName}/${pd.sourceSetID}") }
val descriptor = facade.moduleDescriptor.getPackage(FqName(it.name.let { if(it == "[JS root]") "" else it }))
doc?.get("Package")?.get(it.name)?.run {
pd to MarkdownParser(
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index bf92c849..33cad4f5 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -739,7 +739,7 @@ private class DokkaDescriptorVisitor(
private fun ConstantsEnumValue.fullEnumEntryName() =
"${this.enumClassId.relativeClassName.asString()}.${this.enumEntryName.identifier}"
- private fun fallbackPackageName(): String = "[${sourceSet.sourceSetName} root]"// TODO: error-prone, find a better way to do it
+ private fun fallbackPackageName(): String = "[${sourceSet.displayName} root]"// TODO: error-prone, find a better way to do it
}
private fun DRI.withPackageFallbackTo(fallbackPackage: String): DRI {
diff --git a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt
index d10bd151..f91b82d5 100644
--- a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt
+++ b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt
@@ -19,7 +19,6 @@ class ContentForAnnotationsTest : AbstractCoreTest() {
pass {
sourceRoots = listOf("src/")
analysisPlatform = "jvm"
- targets = listOf("jvm")
}
}
}
diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
index e25567e0..335d834e 100644
--- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
+++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
@@ -12,7 +12,6 @@ class ContentForParamsTest : AbstractCoreTest() {
pass {
sourceRoots = listOf("src/")
analysisPlatform = "jvm"
- targets = listOf("jvm")
}
}
}
diff --git a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
index c9adc0bf..696c3032 100644
--- a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
+++ b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
@@ -4,9 +4,9 @@ import matchers.content.*
import org.jetbrains.dokka.pages.ContentPage
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
import org.junit.jupiter.api.Test
+import utils.ParamAttributes
import utils.bareSignature
import utils.pWrapped
-import utils.ParamAttributes
import utils.unnamedTag
class ContentForSeeAlsoTest : AbstractCoreTest() {
@@ -15,7 +15,6 @@ class ContentForSeeAlsoTest : AbstractCoreTest() {
pass {
sourceRoots = listOf("src/")
analysisPlatform = "jvm"
- targets = listOf("jvm")
}
}
}
diff --git a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt
index bdefe45a..dc0488c8 100644
--- a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt
+++ b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt
@@ -16,7 +16,6 @@ class ContentForSignaturesTest : AbstractCoreTest() {
pass {
sourceRoots = listOf("src/")
analysisPlatform = "jvm"
- targets = listOf("jvm")
}
}
}
diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
index 7cdb0de3..d49ec8a5 100644
--- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
+++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
@@ -27,7 +27,6 @@ class LinkableContentTest : AbstractCoreTest() {
pass {
moduleName = "example"
analysisPlatform = "js"
- targets = listOf("js")
sourceRoots = listOf("jsMain", "commonMain", "jvmAndJsSecondCommonMain").map {
Paths.get("$testDataDir/$it/kotlin").toString()
}
@@ -37,7 +36,6 @@ class LinkableContentTest : AbstractCoreTest() {
pass {
moduleName = "example"
analysisPlatform = "jvm"
- targets = listOf("jvm")
sourceRoots = listOf("jvmMain", "commonMain", "jvmAndJsSecondCommonMain").map {
Paths.get("$testDataDir/$it/kotlin").toString()
}
@@ -68,7 +66,6 @@ class LinkableContentTest : AbstractCoreTest() {
pass {
moduleName = "example"
analysisPlatform = "js"
- targets = listOf("js")
sourceRoots = listOf("$testDataDir/jsMain/kotlin")
sourceLinks = listOf(
SourceLinkDefinitionImpl(
@@ -82,7 +79,6 @@ class LinkableContentTest : AbstractCoreTest() {
pass {
moduleName = "example"
analysisPlatform = "jvm"
- targets = listOf("jvm")
sourceRoots = listOf("$testDataDir/jvmMain/kotlin")
sourceLinks = listOf(
SourceLinkDefinitionImpl(
@@ -133,7 +129,6 @@ class LinkableContentTest : AbstractCoreTest() {
pass {
moduleName = "example"
analysisPlatform = "js"
- targets = listOf("js")
sourceRoots = listOf("$testDataDir/jsMain/kotlin")
sourceSetName = "js"
samples = listOf("$testDataDir/jsMain/resources/Samples.kt")
@@ -141,7 +136,6 @@ class LinkableContentTest : AbstractCoreTest() {
pass {
moduleName = "example"
analysisPlatform = "jvm"
- targets = listOf("jvm")
sourceRoots = listOf("$testDataDir/jvmMain/kotlin")
sourceSetName = "jvm"
samples = listOf("$testDataDir/jvmMain/resources/Samples.kt")
@@ -199,7 +193,7 @@ class LinkableContentTest : AbstractCoreTest() {
pass {
sourceRoots = listOf("src/")
analysisPlatform = "jvm"
- targets = listOf("jvm")
+ sourceSetName = "js"
}
}
}
diff --git a/plugins/base/src/test/kotlin/markdown/LinkTest.kt b/plugins/base/src/test/kotlin/markdown/LinkTest.kt
index 20bd24ee..ddcef5db 100644
--- a/plugins/base/src/test/kotlin/markdown/LinkTest.kt
+++ b/plugins/base/src/test/kotlin/markdown/LinkTest.kt
@@ -70,7 +70,7 @@ class LinkTest : AbstractCoreTest() {
val innerClass = root.children.first { it is ClasslikePageNode }
val foo = innerClass.children.first { it.name == "foo" } as MemberPageNode
- assertEquals(root.dri.first().toString(), "[main root]/Outer///PointingToDeclaration/")
+ assertEquals(root.dri.first().toString(), "[JVM root]/Outer///PointingToDeclaration/")
assertNotNull(foo.content.dfs { it is ContentDRILink && it.address.toString() == root.dri.first().toString() } )
}
}
diff --git a/plugins/base/src/test/kotlin/model/InheritorsTest.kt b/plugins/base/src/test/kotlin/model/InheritorsTest.kt
index ce8a87ca..5daebb73 100644
--- a/plugins/base/src/test/kotlin/model/InheritorsTest.kt
+++ b/plugins/base/src/test/kotlin/model/InheritorsTest.kt
@@ -48,12 +48,10 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt",
pass {
sourceRoots = listOf("common/src/", "jvm/src/")
analysisPlatform = "jvm"
- targets = listOf("jvm")
}
pass {
sourceRoots = listOf("common/src/", "js/src/")
analysisPlatform = "js"
- targets = listOf("js")
}
}
}
diff --git a/plugins/base/src/test/kotlin/model/PackagesTest.kt b/plugins/base/src/test/kotlin/model/PackagesTest.kt
index 676f034a..c777ad05 100644
--- a/plugins/base/src/test/kotlin/model/PackagesTest.kt
+++ b/plugins/base/src/test/kotlin/model/PackagesTest.kt
@@ -14,8 +14,8 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
""".trimIndent(),
prependPackage = false
) {
- with((this / "[main root]").cast<DPackage>()) {
- name equals "[main root]"
+ with((this / "[JVM root]").cast<DPackage>()) {
+ name equals "[JVM root]"
children counts 0
}
}
diff --git a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
index a3bf9188..a4d7bd04 100644
--- a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
+++ b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
@@ -33,10 +33,10 @@ abstract class RenderingOnlyTestBase {
DokkaBase().outputWriter to { _ -> files },
DokkaBase().locationProviderFactory to ::DefaultLocationProviderFactory,
DokkaBase().htmlPreprocessors to { _ -> RootCreator },
- DokkaBase().externalLocationProviderFactory to { _ -> ::JavadocExternalLocationProviderFactory },
- DokkaBase().externalLocationProviderFactory to { _ -> ::DokkaExternalLocationProviderFactory },
+ DokkaBase().externalLocationProviderFactory to { ::JavadocExternalLocationProviderFactory },
+ DokkaBase().externalLocationProviderFactory to { ::DokkaExternalLocationProviderFactory },
sourceSetCache = SourceSetCache(),
- testConfiguration = DokkaConfigurationImpl("", "", false, null, emptyList(), emptyList(), emptyList(), emptyMap(), emptyList())
+ testConfiguration = DokkaConfigurationImpl("", "", null, false, emptyList(), emptyList(), emptyMap(), emptyList())
)
protected val renderedContent: Element by lazy {
diff --git a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
index fa129760..b10202bb 100644
--- a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
@@ -10,9 +10,9 @@ import org.junit.jupiter.api.Test
import renderers.*
class DivergentTest : RenderingOnlyTestBase() {
- private val js = SourceSetData("root", "JS", Platform.js, listOf(SourceRootImpl("pl1")))
- private val jvm = SourceSetData("root", "JVM", Platform.jvm, listOf(SourceRootImpl("pl1")))
- private val native = SourceSetData("root", "NATIVE", Platform.native, listOf(SourceRootImpl("pl1")))
+ private val js = SourceSetData("root", "js", "JS", Platform.js, listOf(SourceRootImpl("pl1")))
+ private val jvm = SourceSetData("root", "jvm", "JVM", Platform.jvm, listOf(SourceRootImpl("pl1")))
+ private val native = SourceSetData("root", "native", "NATIVE", Platform.native, listOf(SourceRootImpl("pl1")))
@Test
fun simpleWrappingCase() {
diff --git a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt
index c1dc40a7..878f442b 100644
--- a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt
@@ -12,9 +12,9 @@ import renderers.TestPage
import renderers.match
class SourceSetDependentHintTest : RenderingOnlyTestBase() {
- private val pl1 = SourceSetData("root", "pl1", Platform.js, listOf(SourceRootImpl("pl1")))
- private val pl2 = SourceSetData("root","pl2", Platform.jvm, listOf(SourceRootImpl("pl1")))
- private val pl3 = SourceSetData("root","pl3", Platform.native, listOf(SourceRootImpl("pl1")))
+ private val pl1 = SourceSetData("root", "pl1", "pl3",Platform.js, listOf(SourceRootImpl("pl1")))
+ private val pl2 = SourceSetData("root","pl2", "pl3", Platform.jvm, listOf(SourceRootImpl("pl1")))
+ private val pl3 = SourceSetData("root","pl3", "pl3", Platform.native, listOf(SourceRootImpl("pl1")))
@Test
fun platformIndependentCase() {
diff --git a/plugins/base/src/test/kotlin/utils/ModelUtils.kt b/plugins/base/src/test/kotlin/utils/ModelUtils.kt
index f65258b1..9697a843 100644
--- a/plugins/base/src/test/kotlin/utils/ModelUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/ModelUtils.kt
@@ -9,7 +9,6 @@ abstract class AbstractModelTest(val path: String? = null, val pkg: String) : Mo
fun inlineModelTest(
query: String,
platform: String = "jvm",
- targetList: List<String> = listOf("jvm"),
prependPackage: Boolean = true,
cleanupOutput: Boolean = true,
pluginsOverrides: List<DokkaPlugin> = emptyList(),
@@ -21,7 +20,6 @@ abstract class AbstractModelTest(val path: String? = null, val pkg: String) : Mo
pass {
sourceRoots = listOf("src/")
analysisPlatform = platform
- targets = targetList
}
}
}
diff --git a/plugins/gfm/src/main/kotlin/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/GfmPlugin.kt
index cc79291c..b10a45b8 100644
--- a/plugins/gfm/src/main/kotlin/GfmPlugin.kt
+++ b/plugins/gfm/src/main/kotlin/GfmPlugin.kt
@@ -120,7 +120,7 @@ open class CommonmarkRenderer(
append(distinct.keys.single())
else
distinct.forEach { text, platforms ->
- append(platforms.joinToString(prefix = " [", postfix = "] $text") { "${it.moduleName}/${it.sourceSetName}" })
+ append(platforms.joinToString(prefix = " [", postfix = "] $text") { "${it.moduleName}/${it.sourceSetID}" })
}
}
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index be42bc79..d217f83e 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -35,24 +35,22 @@ open class GlobalArguments(parser: DokkaArgumentsParser) : DokkaConfiguration {
}
}
- override val generateIndexPages: Boolean by parser.singleFlag(
- listOf("-generateIndexPages"),
- "Generate index page"
- )
-
override val cacheRoot: String? by parser.stringOption(
listOf("-cacheRoot"),
"Path to cache folder, or 'default' to use ~/.cache/dokka, if not provided caching is disabled",
null
)
- override val impliedPlatforms: List<String> = emptyList()
+ override val offlineMode: Boolean by parser.singleFlag(
+ listOf("-offlineMode"),
+ "Offline mode (do not download package lists from the Internet)"
+ )
override val passesConfigurations: List<Arguments> by parser.repeatableFlag(
listOf("-pass"),
"Single dokka pass"
) {
- Arguments(parser).also { if(it.moduleName.isEmpty()) DokkaConsoleLogger.warn("Not specified module name. It can result in unexpected behaviour while including documentation for module") }
+ Arguments(parser).also { if (it.moduleName.isEmpty()) DokkaConsoleLogger.warn("Not specified module name. It can result in unexpected behaviour while including documentation for module") }
}
override val modules: List<DokkaConfiguration.DokkaModuleDescription> = emptyList()
@@ -67,12 +65,17 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi
""
)
- override val sourceSetName: String by parser.stringOption(
- listOf("-sourceSetName"),
- "Name of the source set",
- "main"
+ override val displayName: String by parser.stringOption(
+ listOf("-displayName"),
+ "Name displayed in the generated documentation",
+ ""
)
+ override val sourceSetID: String by parser.stringOption(
+ listOf("-sourceSetID"),
+ "Source set ID used for declaring dependent source sets",
+ "main"
+ )
override val classpath: List<String> by parser.repeatableOption<String>(
listOf("-classpath"),
@@ -84,11 +87,6 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi
"Source file or directory (allows many paths separated by the system path separator)"
) { SourceRootImpl(it) }
- override val dependentSourceRoots: List<DokkaConfiguration.SourceRoot> by parser.repeatableOption(
- listOf("-dependentRoots"),
- "Source roots of dependent source sets"
- ) { SourceRootImpl(it) }
-
override val dependentSourceSets: List<String> by parser.repeatableOption<String>(
listOf("-dependentSets"),
"Names of dependent source sets"
@@ -163,16 +161,6 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi
""
)
- override val sinceKotlin: String? by parser.stringOption(
- listOf("-sinceKotlin"),
- "Kotlin Api version to use as base version, if none specified",
- null
- )
-
- override val collectInheritedExtensionsFromLibraries: Boolean by parser.singleFlag(
- listOf("-collectInheritedExtensionsFromLibraries"),
- "Search for applicable extensions in libraries"
- )
override val analysisPlatform: Platform by parser.singleOption(
listOf("-analysisPlatform"),
@@ -181,10 +169,6 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi
{ Platform.DEFAULT }
)
- override val targets: List<String> by parser.repeatableOption<String>(
- listOf("-target"),
- "Generation targets"
- )
override val perPackageOptions: MutableList<DokkaConfiguration.PackageOptions> by parser.singleOption(
listOf("-packageOptions"),
@@ -215,16 +199,16 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi
object MainKt {
fun defaultLinks(config: DokkaConfiguration.PassConfiguration): MutableList<ExternalDocumentationLink> =
mutableListOf<ExternalDocumentationLink>().apply {
- if (!config.noJdkLink)
- this += DokkaConfiguration.ExternalDocumentationLink
- .Builder("https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/")
- .build()
-
- if (!config.noStdlibLink)
- this += DokkaConfiguration.ExternalDocumentationLink
- .Builder("https://kotlinlang.org/api/latest/jvm/stdlib/")
- .build()
- }
+ if (!config.noJdkLink)
+ this += DokkaConfiguration.ExternalDocumentationLink
+ .Builder("https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/")
+ .build()
+
+ if (!config.noStdlibLink)
+ this += DokkaConfiguration.ExternalDocumentationLink
+ .Builder("https://kotlinlang.org/api/latest/jvm/stdlib/")
+ .build()
+ }
fun parseLinks(links: String): List<ExternalDocumentationLink> {
val (parsedLinks, parsedOfflineLinks) = links.split("^^")
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
index c69c6f67..44a0635f 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ConfigurationExtractor.kt
@@ -1,9 +1,5 @@
package org.jetbrains.dokka.gradle
-import com.android.build.gradle.*
-import com.android.build.gradle.api.BaseVariant
-import com.android.builder.core.BuilderConstants
-import org.gradle.api.NamedDomainObjectCollection
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.UnknownDomainObjectException
@@ -13,57 +9,60 @@ import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.compile.AbstractCompile
import org.jetbrains.dokka.ReflectDsl
-import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinSingleTargetExtension
-import org.jetbrains.kotlin.gradle.plugin.*
+import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
+import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.File
import java.io.Serializable
class ConfigurationExtractor(private val project: Project) {
- fun extractConfiguration(targetName: String, variantName: String?) =
- extractFromKotlinProject(targetName, variantName)
-
- fun extractFromKotlinProject(sourceSetName: String, variantName: String?): PlatformData? {
+ fun extractConfiguration(sourceSetName: String): PlatformData? {
val projectExtension = project.extensions.getByType(KotlinProjectExtension::class.java)
val sourceSet = projectExtension.sourceSets.findByName(sourceSetName)
?: run { project.logger.error("No source set with name '$sourceSetName' found"); return null }
val compilation = when (projectExtension) {
- is KotlinMultiplatformExtension -> projectExtension.targets.flatMap { it.compilations }
- .find { it.kotlinSourceSets.contains(sourceSet) }
+ is KotlinMultiplatformExtension -> {
+ val targets = projectExtension.targets.flatMap { it.compilations }
+ targets.find { it.name == sourceSetName } ?: targets.find { it.kotlinSourceSets.contains(sourceSet) }
+ }
is KotlinSingleTargetExtension -> projectExtension.target.compilations.find {
it.kotlinSourceSets.contains(sourceSet)
}
else -> null
- } ?: run { project.logger.error("No compilation found for set with name '$sourceSetName'"); return null }
+ }
+
+ val sourceRoots = sourceSet.sourceFiles
+ val classpath = compilation?.classpath
+ ?: sourceRoots + sourceSet.allParentSourceFiles()
- val classpath = compilation.compileDependencyFiles.files.filter { it.exists() }
- val dependencies = (compilation.allKotlinSourceSets - sourceSet).flatMap { it.kotlin.sourceDirectories }
return PlatformData(
sourceSetName,
- classpath,
- sourceSet.kotlin.sourceDirectories.filter { it.exists() }.toList(),
- dependencies,
- sourceSet.dependsOn.map { it.name },
- compilation.target.targetName
+ classpath.filter { it.exists() },
+ sourceRoots,
+ sourceSet.dependsOn.map { it.name },
+ compilation?.target?.platformType?.name ?: "common"
)
}
+ private fun KotlinSourceSet.allParentSourceFiles(): List<File> =
+ sourceFiles + dependsOn.flatMap { it.allParentSourceFiles() }
+
fun extractFromJavaPlugin(): PlatformData? =
project.convention.findPlugin(JavaPluginConvention::class.java)
?.run { sourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME)?.allSource?.srcDirs }
- ?.let { PlatformData(null, emptyList(), it.toList(), emptyList(), emptyList(), "") }
+ ?.let { PlatformData(null, emptyList(), it.toList(), emptyList(), "") }
- fun extractFromKotlinTasks(passName: String, kotlinTasks: List<Task>): PlatformData? =
+ fun extractFromKotlinTasks(kotlinTasks: List<Task>): List<PlatformData> =
try {
- kotlinTasks.find { it.toString() == passName }?.let { extractFromKotlinTask(it) }
+ kotlinTasks.map { extractFromKotlinTask(it) }
} catch (e: Throwable) {
when (e) {
is UnknownDomainObjectException, is NoClassDefFoundError, is ClassNotFoundException ->
- extractFromKotlinTasksTheHardWay(passName, kotlinTasks)
+ listOfNotNull(extractFromKotlinTasksTheHardWay(kotlinTasks))
else -> throw e
}
}
@@ -80,18 +79,17 @@ class ConfigurationExtractor(private val project: Project) {
.flatMap { it.compilations }.firstOrNull { it.compileKotlinTask == task }
else -> throw e
}
- }.let {
+ }.let { compilation ->
PlatformData(
task.name,
- getClasspath(it),
- getSourceSet(it),
- getDependentSourceSetRoots(it),
- getDependentSourceSet(it).map { it.name },
- it?.platformType?.toString() ?: ""
+ compilation?.classpath.orEmpty(),
+ compilation?.sourceFiles.orEmpty(),
+ compilation?.dependentSourceSets?.map { it.name }.orEmpty(),
+ compilation?.platformType?.toString() ?: ""
)
}
- private fun extractFromKotlinTasksTheHardWay(passName: String, kotlinTasks: List<Task>): PlatformData? {
+ private fun extractFromKotlinTasksTheHardWay(kotlinTasks: List<Task>): PlatformData? {
val allClasspath = mutableSetOf<File>()
var allClasspathFileCollection: FileCollection = project.files()
val allSourceRoots = mutableSetOf<File>()
@@ -128,93 +126,41 @@ class ConfigurationExtractor(private val project: Project) {
}
classpath.addAll(project.files(allClasspath).toList())
- return PlatformData(null, classpath, allSourceRoots.toList(), emptyList(), emptyList(),"")
+ return PlatformData(null, classpath, allSourceRoots.toList(), emptyList(), "")
}
- private fun getSourceSet(target: KotlinTarget, variantName: String? = null): List<File> =
- if (variantName != null)
- getSourceSet(getCompilation(target, variantName))
- else
- getSourceSet(getMainCompilation(target))
-
- private fun getClasspath(target: KotlinTarget, variantName: String? = null): List<File> =
- if (target.isAndroidTarget()) {
- if (variantName != null)
- getClasspathFromAndroidTask(getCompilation(target, variantName))
- else
- getClasspathFromAndroidTask(getMainCompilation(target))
- } else {
- getClasspath(getMainCompilation(target))
- }
-
- private fun getSourceSet(compilation: KotlinCompilation<*>?): List<File> = compilation
- ?.kotlinSourceSets
- ?.flatMap { it.kotlin.sourceDirectories }
- ?.filter { it.exists() }
- .orEmpty()
+ private val KotlinCompilation<*>.sourceFiles: List<File>
+ get() = kotlinSourceSets.flatMap { it.sourceFiles }
- private fun getDependentSourceSet(compilation: KotlinCompilation<*>?) = compilation
- ?.let { it.allKotlinSourceSets - it.kotlinSourceSets }.orEmpty()
+ private val KotlinSourceSet.sourceFiles: List<File>
+ get() = kotlin.sourceDirectories.filter { it.exists() }.toList()
- private fun getDependentSourceSetRoots(compilation: KotlinCompilation<*>?): List<File> =
- getDependentSourceSet(compilation)?.flatMap { it.kotlin.sourceDirectories }
- .filter { it.exists() }
+ private val KotlinCompilation<*>.dependentSourceSets: Set<KotlinSourceSet>
+ get() = (allKotlinSourceSets - kotlinSourceSets)
- private fun getClasspath(compilation: KotlinCompilation<*>?): List<File> = compilation
- ?.compileDependencyFiles
- ?.files
- ?.toList()
- ?.filter { it.exists() }
- .orEmpty()
+ private val KotlinCompilation<*>.classpath: List<File>
+ get() = if (target.isAndroidTarget()) {
+ getClasspathFromAndroidTask(this)
+ } else {
+ getClasspathFromRegularTask(this)
+ }
// This is a workaround for KT-33893
private fun getClasspathFromAndroidTask(compilation: KotlinCompilation<*>): List<File> = (compilation
.compileKotlinTask as? KotlinCompile)
- ?.classpath?.files?.toList() ?: getClasspath(compilation)
-
- private fun getMainCompilation(target: KotlinTarget) =
- getCompilation(target, getMainCompilationName(target))
-
- private fun getCompilation(target: KotlinTarget, name: String) =
- target.compilations.getByName(name)
-
- private fun getMainCompilationName(target: KotlinTarget) = if (target.isAndroidTarget())
- getVariants(project).filter { it.buildType.name == BuilderConstants.RELEASE }.map { it.name }.first()
- else
- KotlinCompilation.MAIN_COMPILATION_NAME
-
- private fun getVariants(project: Project): Set<BaseVariant> {
- val androidExtension = project.extensions.getByName("android")
- val baseVariants = when (androidExtension) {
- is AppExtension -> androidExtension.applicationVariants.toSet()
- is LibraryExtension -> {
- androidExtension.libraryVariants.toSet() +
- if (androidExtension is FeatureExtension) {
- androidExtension.featureVariants.toSet()
- } else {
- emptySet<BaseVariant>()
- }
- }
- is TestExtension -> androidExtension.applicationVariants.toSet()
- else -> emptySet()
- }
- val testVariants = if (androidExtension is TestedExtension) {
- androidExtension.testVariants.toSet() + androidExtension.unitTestVariants.toSet()
- } else {
- emptySet<BaseVariant>()
- }
-
- return baseVariants + testVariants
- }
+ ?.classpath?.files?.toList() ?: getClasspathFromRegularTask(compilation)
- private fun getPlatformName(platform: KotlinPlatformType): String =
- if (platform == KotlinPlatformType.androidJvm) KotlinPlatformType.jvm.toString() else platform.toString()
+ private fun getClasspathFromRegularTask(compilation: KotlinCompilation<*>): List<File> =
+ compilation
+ .compileDependencyFiles
+ .files
+ .toList()
+ .filter { it.exists() }
data class PlatformData(
val name: String?,
val classpath: List<File>,
val sourceRoots: List<File>,
- val dependentSourceRoots: List<File>,
val dependentSourceSets: List<String>,
val platform: String
) : Serializable
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
index f4fa7aaa..8c4e0c4c 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
@@ -20,7 +20,7 @@ open class DokkaCollectorTask : DefaultTask() {
@TaskAction
fun collect() {
- val passesConfigurations = getProjects(project).filter { it.name in modules }.map {
+ val passesConfigurations = getProjects(project).filter { it.name in modules }.mapNotNull {
val task = try {
it.tasks.getByName(DOKKA_TASK_NAME, DokkaTask::class)
} catch (e: UnknownTaskException) {
@@ -33,12 +33,11 @@ open class DokkaCollectorTask : DefaultTask() {
outputDir = outputDirectory
cacheRoot = passesConfigurations.first().cacheRoot
format = passesConfigurations.first().format
- generateIndexPages = passesConfigurations.first().generateIndexPages
}
configuration = passesConfigurations.fold(initial) { acc, it: GradleDokkaConfigurationImpl ->
- if(acc.format != it.format || acc.generateIndexPages != it.generateIndexPages || acc.cacheRoot != it.cacheRoot)
- throw IllegalStateException("Dokka task configurations differ on core arguments (format, generateIndexPages, cacheRoot)")
+ if(acc.format != it.format || acc.cacheRoot != it.cacheRoot)
+ throw IllegalStateException("Dokka task configurations differ on core arguments (format, cacheRoot)")
acc.passesConfigurations = acc.passesConfigurations + it.passesConfigurations
acc.pluginsClasspath = (acc.pluginsClasspath + it.pluginsClasspath).distinct()
acc
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt
index a1bfdb96..2ef85de2 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt
@@ -35,9 +35,9 @@ open class DokkaMultimoduleTask : DefaultTask(), Configurable {
System.setProperty(DokkaTask.COLORS_ENABLED_PROPERTY, "false")
try {
- loadFatJar()
+ loadCore()
val bootstrapClass =
- ClassloaderContainer.fatJarClassLoader!!.loadClass("org.jetbrains.dokka.DokkaMultimoduleBootstrapImpl")
+ ClassloaderContainer.coreClassLoader!!.loadClass("org.jetbrains.dokka.DokkaMultimoduleBootstrapImpl")
val bootstrapInstance = bootstrapClass.constructors.first().newInstance()
val bootstrapProxy: DokkaBootstrap = automagicTypedProxy(
javaClass.classLoader,
@@ -85,10 +85,10 @@ open class DokkaMultimoduleTask : DefaultTask(), Configurable {
}
}
- private fun loadFatJar() {
- if (ClassloaderContainer.fatJarClassLoader == null) {
+ private fun loadCore() {
+ if (ClassloaderContainer.coreClassLoader == null) {
val jars = dokkaRuntime!!.resolve()
- ClassloaderContainer.fatJarClassLoader = URLClassLoader(
+ ClassloaderContainer.coreClassLoader = URLClassLoader(
jars.map { it.toURI().toURL() }.toTypedArray(),
ClassLoader.getSystemClassLoader().parent
)
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
index 2de95493..5a420d4d 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
@@ -15,15 +15,16 @@ import org.jetbrains.dokka.ReflectDsl
import org.jetbrains.dokka.ReflectDsl.isNotInstance
import org.jetbrains.dokka.gradle.ConfigurationExtractor.PlatformData
import org.jetbrains.dokka.plugability.Configurable
-import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import java.io.File
import java.net.URLClassLoader
import java.util.concurrent.Callable
import java.util.function.BiConsumer
+import kotlin.system.exitProcess
open class DokkaTask : DefaultTask(), Configurable {
private val ANDROID_REFERENCE_URL = Builder("https://developer.android.com/reference/").build()
private val GLOBAL_CONFIGURATION_NAME = "global" // Used for copying perPackageOptions to other platforms
+ private val configExtractor = ConfigurationExtractor(project)
@Suppress("MemberVisibilityCanBePrivate")
fun defaultKotlinTasks(): List<Task> = with(ReflectDsl) {
@@ -57,8 +58,6 @@ open class DokkaTask : DefaultTask(), Configurable {
var subProjects: List<String> = emptyList()
@Input
- var impliedPlatforms: MutableList<String> = arrayListOf()
-
override val pluginsConfiguration: Map<String, String> = mutableMapOf()
@Optional
@@ -66,54 +65,47 @@ open class DokkaTask : DefaultTask(), Configurable {
var cacheRoot: String? = null
@Classpath
- lateinit var pluginsConfig: Configuration
+ lateinit var pluginsClasspathConfiguration: Configuration
var dokkaSourceSets: NamedDomainObjectContainer<GradlePassConfigurationImpl>
@Suppress("UNCHECKED_CAST")
@Nested get() = (DslObject(this).extensions.getByName(SOURCE_SETS_EXTENSION_NAME) as NamedDomainObjectContainer<GradlePassConfigurationImpl>)
internal set(value) = DslObject(this).extensions.add(SOURCE_SETS_EXTENSION_NAME, value)
- var configuration: GradlePassConfigurationImpl
- @Suppress("UNCHECKED_CAST")
- @Nested get() = DslObject(this).extensions.getByType(GradlePassConfigurationImpl::class.java)
- internal set(value) = DslObject(this).extensions.add(CONFIGURATION_EXTENSION_NAME, value)
-
- var config: GradleDokkaConfigurationImpl? = null
-
- // Configure Dokka with closure in Gradle Kotlin DSL
- fun configuration(action: Action<in GradlePassConfigurationImpl>) = action.execute(configuration)
-
private val kotlinTasks: List<Task> by lazy {
- extractKotlinCompileTasks(
- configuration.collectKotlinTasks ?: { defaultKotlinTasks() })
+ extractKotlinCompileTasks({
+ dokkaSourceSets.map {
+ it.collectKotlinTasks?.invoke()
+ }
+ }.takeIf { it().isNotEmpty() } ?: { defaultKotlinTasks() }
+ )
}
- private val configExtractor = ConfigurationExtractor(project)
-
@Input
var disableAutoconfiguration: Boolean = false
+ @Input
+ var offlineMode: Boolean = false
+
private var outputDiagnosticInfo: Boolean =
false // Workaround for Gradle, which fires some methods (like collectConfigurations()) multiple times in its lifecycle
- private fun loadFatJar() {
- if (ClassloaderContainer.fatJarClassLoader == null) {
+ private fun loadCore() {
+ if (ClassloaderContainer.coreClassLoader == null) {
val jars = dokkaRuntime!!.resolve()
- ClassloaderContainer.fatJarClassLoader = URLClassLoader(
+ ClassloaderContainer.coreClassLoader = URLClassLoader(
jars.map { it.toURI().toURL() }.toTypedArray(),
ClassLoader.getSystemClassLoader().parent
)
}
}
- private fun extractKotlinCompileTasks(collectTasks: () -> List<Any?>?): List<Task> {
+ protected fun extractKotlinCompileTasks(collectTasks: () -> List<Any?>?): List<Task> {
val inputList = (collectTasks.invoke() ?: emptyList()).filterNotNull()
val (paths, other) = inputList.partition { it is String }
- val taskContainer = project.tasks
-
val tasksByPath = paths.map {
- taskContainer.findByPath(it as String) ?: throw IllegalArgumentException("Task with path '$it' not found")
+ project.tasks.findByPath(it as String) ?: throw IllegalArgumentException("Task with path '$it' not found")
}
other
@@ -134,7 +126,7 @@ open class DokkaTask : DefaultTask(), Configurable {
private fun Iterable<String>.toProjects(): List<Project> =
project.subprojects.toList().filter { this.contains(it.name) }
- private fun collectSuppressedFiles(sourceRoots: List<SourceRoot>) =
+ protected open fun collectSuppressedFiles(sourceRoots: List<SourceRoot>) =
if (project.isAndroidProject()) {
val generatedRoot = project.buildDir.resolve("generated").absoluteFile
sourceRoots
@@ -147,25 +139,21 @@ open class DokkaTask : DefaultTask(), Configurable {
}
@TaskAction
- fun generate() {
- generateForConfig(config ?: getConfiguration())
- }
+ fun generate() = getConfiguration()?.let { generate(it) } ?: exitProcess(0)
- internal fun generateForConfig(configuration: GradleDokkaConfigurationImpl) {
+ protected open fun generate(configuration: GradleDokkaConfigurationImpl) {
outputDiagnosticInfo = true
val kotlinColorsEnabledBefore = System.getProperty(COLORS_ENABLED_PROPERTY) ?: "false"
System.setProperty(COLORS_ENABLED_PROPERTY, "false")
try {
- loadFatJar()
+ loadCore()
val bootstrapClass =
- ClassloaderContainer.fatJarClassLoader!!.loadClass("org.jetbrains.dokka.DokkaBootstrapImpl")
+ ClassloaderContainer.coreClassLoader!!.loadClass("org.jetbrains.dokka.DokkaBootstrapImpl")
val bootstrapInstance = bootstrapClass.constructors.first().newInstance()
val bootstrapProxy: DokkaBootstrap =
automagicTypedProxy(javaClass.classLoader, bootstrapInstance)
- val gson = GsonBuilder().setPrettyPrinting().create()
-
bootstrapProxy.configure(
BiConsumer { level, message ->
when (level) {
@@ -176,7 +164,7 @@ open class DokkaTask : DefaultTask(), Configurable {
"error" -> logger.error(message)
}
},
- gson.toJson(configuration)
+ GsonBuilder().setPrettyPrinting().create().toJson(configuration)
)
bootstrapProxy.generate()
@@ -186,68 +174,78 @@ open class DokkaTask : DefaultTask(), Configurable {
}
}
- internal fun getConfiguration(): GradleDokkaConfigurationImpl {
+ internal open fun getConfiguration(): GradleDokkaConfigurationImpl? {
val globalConfig = dokkaSourceSets.toList().find { it.name.toLowerCase() == GLOBAL_CONFIGURATION_NAME }
- val defaultModulesConfiguration = collectConfigurations()
- .map { defaultPassConfiguration(it, globalConfig) }
+ val defaultModulesConfiguration = passConfigurations
+ .map { defaultPassConfiguration(it, globalConfig) }.takeIf { it.isNotEmpty() }
+ ?: listOf(
+ defaultPassConfiguration(
+ collectSinglePassConfiguration(GradlePassConfigurationImpl("main")),
+ null
+ )
+ ).takeIf { project.isNotMultiplatformProject() } ?: emptyList()
+
+ if (defaultModulesConfiguration.isEmpty()) {
+ logger.error("No source sets to document found, exiting")
+ return null
+ }
+
return GradleDokkaConfigurationImpl().apply {
outputDir = project.file(outputDirectory).absolutePath
format = outputFormat
- generateIndexPages = true
- cacheRoot = cacheRoot
- impliedPlatforms = impliedPlatforms
+ cacheRoot = this@DokkaTask.cacheRoot
+ offlineMode = this@DokkaTask.offlineMode
passesConfigurations = defaultModulesConfiguration
- pluginsClasspath = pluginsConfig.resolve().toList()
+ pluginsClasspath = pluginsClasspathConfiguration.resolve().toList()
pluginsConfiguration = this@DokkaTask.pluginsConfiguration
}
}
- private fun collectConfigurations() =
- if (this.dokkaSourceSets.isNotEmpty()) collectMultipassConfiguration() else listOf(collectSinglePassConfiguration(configuration))
- private fun collectMultipassConfiguration() = dokkaSourceSets
- .filterNot { it.name.toLowerCase() == GLOBAL_CONFIGURATION_NAME }
- .map { collectSinglePassConfiguration(it) }
+ protected val passConfigurations: List<GradlePassConfigurationImpl>
+ get() = dokkaSourceSets
+ .filterNot { it.name.toLowerCase() == GLOBAL_CONFIGURATION_NAME }
+ .map { collectSinglePassConfiguration(it) }
- private fun collectSinglePassConfiguration(config: GradlePassConfigurationImpl): GradlePassConfigurationImpl {
+ protected fun collectSinglePassConfiguration(config: GradlePassConfigurationImpl): GradlePassConfigurationImpl {
val userConfig = config
- /*.let {
- if (it.collectKotlinTasks != null) {
- configExtractor.extractFromKotlinTasks(extractKotlinCompileTasks(it.collectKotlinTasks!!))
- ?.let { platformData -> mergeUserConfigurationAndPlatformData(it, platformData) } ?: it
- } else {
- it
+ .apply {
+ collectKotlinTasks?.let {
+ configExtractor.extractFromKotlinTasks(extractKotlinCompileTasks(it))
+ .fold(this) { config, platformData ->
+ mergeUserConfigurationAndPlatformData(config, platformData)
+ }
+ }
}
- }*/
if (disableAutoconfiguration) return userConfig
- val baseConfig = configExtractor.extractConfiguration(userConfig.name, userConfig.androidVariant)
+ val baseConfig = configExtractor.extractConfiguration(userConfig.name)
?.let { mergeUserConfigurationAndPlatformData(userConfig, it) }
?: if (this.dokkaSourceSets.isNotEmpty()) {
if (outputDiagnosticInfo)
logger.warn(
- "Could not find target with name: ${userConfig.name} in Kotlin Gradle Plugin, " +
- "using only user provided configuration for this target"
+ "Could not find source set with name: ${userConfig.name} in Kotlin Gradle Plugin, " +
+ "using only user provided configuration for this source set"
)
userConfig
} else {
- logger.warn("Could not find target with name: ${userConfig.name} in Kotlin Gradle Plugin")
- collectFromSinglePlatformOldPlugin(userConfig.name)
+ if (outputDiagnosticInfo)
+ logger.warn("Could not find source set with name: ${userConfig.name} in Kotlin Gradle Plugin")
+ collectFromSinglePlatformOldPlugin(userConfig.name, userConfig)
}
return if (subProjects.isNotEmpty()) {
try {
- subProjects.toProjects().fold(baseConfig) { config, subProject ->
+ subProjects.toProjects().fold(baseConfig) { configAcc, subProject ->
mergeUserConfigurationAndPlatformData(
- config,
- ConfigurationExtractor(subProject).extractConfiguration(config.name, config.androidVariant)!!
+ configAcc,
+ ConfigurationExtractor(subProject).extractConfiguration(userConfig.name)!!
)
}
} catch (e: NullPointerException) {
logger.warn(
- "Cannot extract sources from subProjects. Do you have the Kotlin plugin in version 1.3.30+ " +
- "and the Kotlin plugin applied in the root project?"
+ "Cannot extract sources from subProjects. Do you have the Kotlin plugin applied in the root project?"
)
baseConfig
}
@@ -256,49 +254,52 @@ open class DokkaTask : DefaultTask(), Configurable {
}
}
- private fun collectFromSinglePlatformOldPlugin(name: String) =
- configExtractor.extractFromKotlinTasks(name, kotlinTasks)
- ?.let { mergeUserConfigurationAndPlatformData(configuration, it) }
+ protected fun collectFromSinglePlatformOldPlugin(name: String, userConfig: GradlePassConfigurationImpl) =
+ kotlinTasks.find { it.name == name }
+ ?.let { configExtractor.extractFromKotlinTasks(listOf(it)) }
+ ?.singleOrNull()
+ ?.let { mergeUserConfigurationAndPlatformData(userConfig, it) }
?: configExtractor.extractFromJavaPlugin()
- ?.let { mergeUserConfigurationAndPlatformData(configuration, it) }
- ?: configuration
+ ?.let { mergeUserConfigurationAndPlatformData(userConfig, it) }
+ ?: userConfig
- private fun mergeUserConfigurationAndPlatformData(
+ protected fun mergeUserConfigurationAndPlatformData(
userConfig: GradlePassConfigurationImpl,
autoConfig: PlatformData
) =
userConfig.copy().apply {
- sourceSetName = autoConfig.name ?: ""
+ sourceSetID = autoConfig.name ?: ""
sourceRoots.addAll(userConfig.sourceRoots.union(autoConfig.sourceRoots.toSourceRoots()).distinct())
- dependentSourceRoots.addAll(userConfig.dependentSourceRoots.union(autoConfig.dependentSourceRoots.toSourceRoots()).distinct())
dependentSourceSets.addAll(userConfig.dependentSourceSets.union(autoConfig.dependentSourceSets).distinct())
classpath = userConfig.classpath.union(autoConfig.classpath.map { it.absolutePath }).distinct()
if (userConfig.platform == null && autoConfig.platform != "")
platform = autoConfig.platform
}
- private fun defaultPassConfiguration(
+ protected fun defaultPassConfiguration(
config: GradlePassConfigurationImpl,
globalConfig: GradlePassConfigurationImpl?
): GradlePassConfigurationImpl {
- if (config.moduleName == "") {
+ if (config.moduleName.isBlank()) {
config.moduleName = project.name
}
- if (config.sourceSetName.isEmpty()) {
- config.sourceSetName = config.name.substringBeforeLast("Main").takeIf(String::isNotBlank) ?: config.platform.toString()
+ if (config.sourceSetID.isBlank()) {
+ config.sourceSetID = config.name.takeIf(String::isNotBlank) ?: config.analysisPlatform.key
}
- config.classpath = (config.classpath as List<Any>).map { it.toString() }.distinct() // Workaround for Groovy's GStringImpl
+ config.displayName = config.sourceSetID.substringBeforeLast("Main")
+ config.classpath =
+ (config.classpath as List<Any>).map { it.toString() }.distinct() // Workaround for Groovy's GStringImpl
config.sourceRoots = config.sourceRoots.distinct().toMutableList()
config.samples = config.samples.map { project.file(it).absolutePath }
config.includes = config.includes.map { project.file(it).absolutePath }
config.suppressedFiles += collectSuppressedFiles(config.sourceRoots)
- if (project.isAndroidProject() && !config.noAndroidSdkLink) { // TODO: introduce Android as a separate Dokka platform?
+ if (project.isAndroidProject() && !config.noAndroidSdkLink) {
config.externalDocumentationLinks.add(ANDROID_REFERENCE_URL)
}
- if (config.platform != null && config.platform.toString().isNotBlank()) {
+ if (config.platform?.isNotBlank() == true) {
config.analysisPlatform = dokkaPlatformFromString(config.platform.toString())
}
- if (globalConfig != null) {
+ globalConfig?.let {
config.perPackageOptions.addAll(globalConfig.perPackageOptions)
config.externalDocumentationLinks.addAll(globalConfig.externalDocumentationLinks)
config.sourceLinks.addAll(globalConfig.sourceLinks)
@@ -309,7 +310,7 @@ open class DokkaTask : DefaultTask(), Configurable {
}
private fun dokkaPlatformFromString(platform: String) = when (platform.toLowerCase()) {
- KotlinPlatformType.androidJvm.toString().toLowerCase(), "androidjvm", "android" -> Platform.jvm
+ "androidjvm", "android" -> Platform.jvm
"metadata" -> Platform.common
else -> Platform.fromString(platform)
}
@@ -321,7 +322,7 @@ open class DokkaTask : DefaultTask(), Configurable {
// Needed for Gradle incremental build
@InputFiles
fun getInputFiles(): FileCollection {
- val config = collectConfigurations()
+ val config = passConfigurations
return project.files(config.flatMap { it.sourceRoots }.map { project.fileTree(File(it.path)) }) +
project.files(config.flatMap { it.includes }) +
project.files(config.flatMap { it.samples }.map { project.fileTree(File(it)) })
@@ -329,7 +330,7 @@ open class DokkaTask : DefaultTask(), Configurable {
@Classpath
fun getInputClasspath(): FileCollection =
- project.files((collectConfigurations().flatMap { it.classpath } as List<Any>).map { project.fileTree(File(it.toString())) })
+ project.files((passConfigurations.flatMap { it.classpath } as List<Any>).map { project.fileTree(File(it.toString())) })
companion object {
const val COLORS_ENABLED_PROPERTY = "kotlin.colors.enabled"
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
index 7fdadd41..2787bb4e 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
@@ -27,9 +27,9 @@ class GradleSourceRootImpl: SourceRoot, Serializable {
open class GradlePassConfigurationImpl(@Transient val name: String = ""): PassConfiguration {
@Input @Optional override var classpath: List<String> = emptyList()
@Input override var moduleName: String = ""
- @Input override var sourceSetName: String = ""
+ @Input override var displayName: String = ""
+ @Input override var sourceSetID: String = ""
@Input override var sourceRoots: MutableList<SourceRoot> = mutableListOf()
- @Input override var dependentSourceRoots: MutableList<SourceRoot> = mutableListOf()
@Input override var dependentSourceSets: MutableList<String> = mutableListOf()
@Input override var samples: List<String> = emptyList()
@Input override var includes: List<String> = emptyList()
@@ -48,13 +48,9 @@ open class GradlePassConfigurationImpl(@Transient val name: String = ""): PassCo
@Input override var noJdkLink: Boolean = false
@Input var noAndroidSdkLink: Boolean = false
@Input override var suppressedFiles: List<String> = emptyList()
- @Input override var collectInheritedExtensionsFromLibraries: Boolean = false
@Input override var analysisPlatform: Platform = Platform.DEFAULT
@Input @Optional var platform: String? = null
- @Input override var targets: List<String> = emptyList()
- @Input @Optional override var sinceKotlin: String? = null
@Transient var collectKotlinTasks: (() -> List<Any?>?)? = null
- @Input @Optional @Transient var androidVariant: String? = null
fun kotlinTasks(taskSupplier: Callable<List<Any>>) {
collectKotlinTasks = { taskSupplier.call() }
@@ -129,9 +125,8 @@ class GradleDokkaModuleDescription: DokkaModuleDescription {
class GradleDokkaConfigurationImpl: DokkaConfiguration {
override var outputDir: String = ""
override var format: String = "html"
- override var generateIndexPages: Boolean = false
override var cacheRoot: String? = null
- override var impliedPlatforms: List<String> = emptyList()
+ override var offlineMode: Boolean = false
override var passesConfigurations: List<GradlePassConfigurationImpl> = emptyList()
override var pluginsClasspath: List<File> = emptyList()
override var pluginsConfiguration: Map<String, String> = mutableMapOf()
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
index 1049656e..d2a0f043 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
@@ -8,23 +8,31 @@ import java.io.File
import java.io.InputStream
import java.util.*
-internal const val CONFIGURATION_EXTENSION_NAME = "configuration"
internal const val SOURCE_SETS_EXTENSION_NAME = "dokkaSourceSets"
internal const val DOKKA_TASK_NAME = "dokka"
internal const val DOKKA_COLLECTOR_TASK_NAME = "dokkaCollector"
internal const val DOKKA_MULTIMODULE_TASK_NAME = "dokkaMultimodule"
open class DokkaPlugin : Plugin<Project> {
-
override fun apply(project: Project) {
loadDokkaVersion()
val dokkaRuntimeConfiguration = addConfiguration(project)
val pluginsConfiguration = project.configurations.create("dokkaPlugins").apply {
dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-base:${DokkaVersion.version}"))
+ attributes.attribute(
+ org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE,
+ project.objects.named(org.gradle.api.attributes.Usage::class.java, "java-runtime")
+ )
+ isCanBeConsumed = false
}
addDokkaTasks(project, dokkaRuntimeConfiguration, pluginsConfiguration, DokkaTask::class.java)
addDokkaCollectorTasks(project, DokkaCollectorTask::class.java)
- addDokkaMultimoduleTasks(project.rootProject, dokkaRuntimeConfiguration, pluginsConfiguration, DokkaMultimoduleTask::class.java)
+ addDokkaMultimoduleTasks(
+ project.rootProject,
+ dokkaRuntimeConfiguration,
+ pluginsConfiguration,
+ DokkaMultimoduleTask::class.java
+ )
}
private fun loadDokkaVersion() =
@@ -32,7 +40,9 @@ open class DokkaPlugin : Plugin<Project> {
private fun addConfiguration(project: Project) =
project.configurations.create("dokkaRuntime").apply {
- defaultDependencies { dependencies -> dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-core:${DokkaVersion.version}")) }
+ defaultDependencies { dependencies ->
+ dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-core:${DokkaVersion.version}"))
+ }
}
private fun addDokkaTasks(
@@ -48,9 +58,8 @@ open class DokkaPlugin : Plugin<Project> {
}
project.tasks.withType(taskClass) { task ->
task.dokkaSourceSets = project.container(GradlePassConfigurationImpl::class.java)
- task.configuration = GradlePassConfigurationImpl()
task.dokkaRuntime = runtimeConfiguration
- task.pluginsConfig = pluginsConfiguration
+ task.pluginsClasspathConfiguration = pluginsConfiguration
task.outputDirectory = File(project.rootProject.buildDir, "$DOKKA_TASK_NAME/${project.name}").absolutePath
}
}
@@ -65,7 +74,6 @@ open class DokkaPlugin : Plugin<Project> {
project.tasks.create(DOKKA_COLLECTOR_TASK_NAME, taskClass)
}
project.tasks.withType(taskClass) { task ->
- task.modules = emptyList()
task.outputDirectory = File(project.buildDir, DOKKA_TASK_NAME).absolutePath
}
}
@@ -103,5 +111,5 @@ object DokkaVersion {
object ClassloaderContainer {
@JvmField
- var fatJarClassLoader: ClassLoader? = null
+ var coreClassLoader: ClassLoader? = null
} \ No newline at end of file
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt
index 3369a640..a4bf65ee 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt
@@ -7,7 +7,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
-fun Project.isAndroidProject() = try {
+internal fun Project.isAndroidProject() = try {
project.extensions.getByName("android")
true
} catch(e: UnknownDomainObjectException) {
@@ -16,4 +16,17 @@ fun Project.isAndroidProject() = try {
false
}
-fun KotlinTarget.isAndroidTarget() = this.platformType == KotlinPlatformType.androidJvm \ No newline at end of file
+internal fun Project.isNotMultiplatformProject() = !isMultiplatformProject()
+
+internal fun Project.isMultiplatformProject() = try {
+ project.extensions.getByType(KotlinMultiplatformExtension::class.java)
+ true
+} catch(e: UnknownDomainObjectException) {
+ false
+} catch (e: NoClassDefFoundError){
+ false
+} catch(e: ClassNotFoundException) {
+ false
+}
+
+internal fun KotlinTarget.isAndroidTarget() = this.platformType == KotlinPlatformType.androidJvm \ No newline at end of file
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
index 8242d0d1..71fe5b40 100644
--- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
+++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
@@ -29,11 +29,9 @@ import org.eclipse.aether.transport.file.FileTransporterFactory
import org.eclipse.aether.transport.http.HttpTransporterFactory
import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator
import org.jetbrains.dokka.*
-import org.jetbrains.dokka.utilities.DokkaConsoleLogger
import java.io.File
import java.net.URL
-
class SourceLinkMapItem {
@Parameter(name = "path", required = true)
var path: String = ""
@@ -92,8 +90,6 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
@Parameter
var sourceRoots: List<SourceRoot> = emptyList()
- @Parameter
- var dependentSourceRoots: List<SourceRoot> = emptyList()
@Parameter
var dependentSourceSets: List<String> = emptyList()
@@ -146,6 +142,12 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
@Parameter
var cacheRoot: String? = null
+ @Parameter(defaultValue = "JVM")
+ var displayName: String = "JVM"
+
+ @Parameter(defaultValue = "false")
+ var offlineMode: Boolean = false
+
@Parameter
var languageVersion: String? = null
@@ -158,25 +160,14 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
@Parameter
var suppressedFiles: List<String> = emptyList()
- @Parameter
- var collectInheritedExtensionsFromLibraries: Boolean = false
@Parameter
var platform: String = ""
@Parameter
- var targets: List<String> = emptyList()
-
- @Parameter
- var sinceKotlin: String? = null
-
- @Parameter
var includeNonPublic: Boolean = false
@Parameter
- var generateIndexPages: Boolean = false
-
- @Parameter
var dokkaPlugins: List<Dependency> = emptyList()
protected abstract fun getOutDir(): String
@@ -209,19 +200,21 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
}
val passConfiguration = PassConfigurationImpl(
+ moduleName = moduleName,
+ displayName = displayName,
+ sourceSetID = sourceSetName,
classpath = classpath,
- sourceSetName = sourceSetName,
sourceRoots = sourceDirectories.map { SourceRootImpl(it) },
- dependentSourceRoots = dependentSourceRoots.map { SourceRootImpl(path = it.path) },
dependentSourceSets = dependentSourceSets,
samples = samples,
includes = includes,
- collectInheritedExtensionsFromLibraries = collectInheritedExtensionsFromLibraries, // TODO: Should we implement this?
- sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.path, it.url, it.lineSuffix) },
- jdkVersion = jdkVersion,
- skipDeprecated = skipDeprecated,
- skipEmptyPackages = skipEmptyPackages,
+ includeNonPublic = includeNonPublic,
+ includeRootPackage = includeRootPackage,
reportUndocumented = reportUndocumented,
+ skipEmptyPackages = skipEmptyPackages,
+ skipDeprecated = skipDeprecated,
+ jdkVersion = jdkVersion,
+ sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.path, it.url, it.lineSuffix) },
perPackageOptions = perPackageOptions.map {
PackageOptionsImpl(
prefix = it.prefix,
@@ -232,18 +225,13 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
)
},
externalDocumentationLinks = externalDocumentationLinks.map { it.build() as ExternalDocumentationLinkImpl },
- noStdlibLink = noStdlibLink,
- noJdkLink = noJdkLink,
languageVersion = languageVersion,
apiVersion = apiVersion,
- moduleName = moduleName,
+ noStdlibLink = noStdlibLink,
+ noJdkLink = noJdkLink,
suppressedFiles = suppressedFiles,
- sinceKotlin = sinceKotlin,
- analysisPlatform = if (platform.isNotEmpty()) Platform.fromString(platform) else Platform.DEFAULT,
- targets = targets,
- includeNonPublic = includeNonPublic,
- includeRootPackage = includeRootPackage
- ).let{
+ analysisPlatform = if (platform.isNotEmpty()) Platform.fromString(platform) else Platform.DEFAULT
+ ).let {
it.copy(
externalDocumentationLinks = defaultLinks(it) + it.externalDocumentationLinks
)
@@ -254,12 +242,11 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
val configuration = DokkaConfigurationImpl(
outputDir = getOutDir(),
format = getOutFormat(),
- impliedPlatforms = impliedPlatforms,
+ offlineMode = offlineMode,
cacheRoot = cacheRoot,
passesConfigurations = listOf(passConfiguration).also {
- if(passConfiguration.moduleName.isEmpty()) logger.warn("Not specified module name. It can result in unexpected behaviour while including documentation for module")
+ if (passConfiguration.moduleName.isEmpty()) logger.warn("Not specified module name. It can result in unexpected behaviour while including documentation for module")
},
- generateIndexPages = generateIndexPages,
pluginsClasspath = getArtifactByAether("org.jetbrains.dokka", "dokka-base", dokkaVersion) +
dokkaPlugins.map { getArtifactByAether(it.groupId, it.artifactId, it.version) }.flatten(),
pluginsConfiguration = mutableMapOf(), //TODO implement as it is in Gradle
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 39a82007..b3e15ade 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,6 +1,7 @@
rootProject.name = "dokka"
include("core")
+include("plugins:base:search-component")
include("coreDependencies")
include("testApi")
include("test-tools")
@@ -31,6 +32,4 @@ pluginManagement {
jcenter()
gradlePluginPortal()
}
-}
-include("plugins:base:frontend")
-findProject(":plugins:base:frontend")?.name = "frontend"
+} \ No newline at end of file
diff --git a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
index 7f1be6b5..3aec2909 100644
--- a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
+++ b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
@@ -139,7 +139,7 @@ abstract class AbstractCoreTest {
protected class DokkaConfigurationBuilder {
var outputDir: String = "out"
var format: String = "html"
- var generateIndexPages: Boolean = true
+ var offlineMode: Boolean = false
var cacheRoot: String? = null
var pluginsClasspath: List<File> = emptyList()
var pluginsConfigurations: Map<String, String> = emptyMap()
@@ -147,9 +147,8 @@ abstract class AbstractCoreTest {
fun build() = DokkaConfigurationImpl(
outputDir = outputDir,
format = format,
- generateIndexPages = generateIndexPages,
cacheRoot = cacheRoot,
- impliedPlatforms = emptyList(),
+ offlineMode = offlineMode,
passesConfigurations = passesConfigurations,
pluginsClasspath = pluginsClasspath,
pluginsConfiguration = pluginsConfigurations,
@@ -171,9 +170,9 @@ abstract class AbstractCoreTest {
protected class DokkaPassConfigurationBuilder(
var moduleName: String = "root",
var sourceSetName: String = "main",
+ var displayName: String = "JVM",
var classpath: List<String> = emptyList(),
var sourceRoots: List<String> = emptyList(),
- var dependentSourceRoots: List<String> = emptyList(),
var dependentSourceSets: List<String> = emptyList(),
var samples: List<String> = emptyList(),
var includes: List<String> = emptyList(),
@@ -188,20 +187,17 @@ abstract class AbstractCoreTest {
var noStdlibLink: Boolean = false,
var noJdkLink: Boolean = false,
var suppressedFiles: List<String> = emptyList(),
- var collectInheritedExtensionsFromLibraries: Boolean = true,
var analysisPlatform: String = "jvm",
- var targets: List<String> = listOf("jvm"),
- var sinceKotlin: String? = null,
var perPackageOptions: List<PackageOptionsImpl> = emptyList(),
var externalDocumentationLinks: List<ExternalDocumentationLinkImpl> = emptyList(),
var sourceLinks: List<SourceLinkDefinitionImpl> = emptyList()
) {
fun build() = PassConfigurationImpl(
moduleName = moduleName,
- sourceSetName = sourceSetName,
+ displayName = displayName,
+ sourceSetID = sourceSetName,
classpath = classpath,
sourceRoots = sourceRoots.map { SourceRootImpl(it) },
- dependentSourceRoots = dependentSourceRoots.map { SourceRootImpl(it) },
dependentSourceSets = dependentSourceSets,
samples = samples,
includes = includes,
@@ -211,18 +207,15 @@ abstract class AbstractCoreTest {
skipEmptyPackages = skipEmptyPackages,
skipDeprecated = skipDeprecated,
jdkVersion = jdkVersion,
+ sourceLinks = sourceLinks,
+ perPackageOptions = perPackageOptions,
+ externalDocumentationLinks = externalDocumentationLinks,
languageVersion = languageVersion,
apiVersion = apiVersion,
noStdlibLink = noStdlibLink,
noJdkLink = noJdkLink,
suppressedFiles = suppressedFiles,
- collectInheritedExtensionsFromLibraries = collectInheritedExtensionsFromLibraries,
- analysisPlatform = Platform.fromString(analysisPlatform),
- targets = targets,
- sinceKotlin = sinceKotlin,
- perPackageOptions = perPackageOptions,
- externalDocumentationLinks = externalDocumentationLinks,
- sourceLinks = sourceLinks
+ analysisPlatform = Platform.fromString(analysisPlatform)
)
}