aboutsummaryrefslogtreecommitdiff
path: root/core/src
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 /core/src
parent645e02fb42bbf1cd3ee2773a014ea1e553e09229 (diff)
downloaddokka-f3baf10b4c882230d382bfcdd94163d070bd0e25.tar.gz
dokka-f3baf10b4c882230d382bfcdd94163d070bd0e25.tar.bz2
dokka-f3baf10b4c882230d382bfcdd94163d070bd0e25.zip
Rework dokka configuration and Gradle plugin
Diffstat (limited to 'core/src')
-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
4 files changed, 35 insertions, 26 deletions
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