aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt14
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt12
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt2
4 files changed, 17 insertions, 13 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 528b7d16..6d9d8f1f 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -205,7 +205,7 @@ open class HtmlRenderer(
}.map {
it to createHTML(prettyPrint = false).div(classes = "content sourceset-depenent-content") {
if (counter++ == 0) attributes["data-active"] = ""
- attributes["data-togglable"] = it.sourceSetName
+ attributes["data-togglable"] = it.sourceSetID
unsafe {
+html
}
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 8c4e0c4c..cef3695a 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,14 +20,14 @@ open class DokkaCollectorTask : DefaultTask() {
@TaskAction
fun collect() {
- val passesConfigurations = getProjects(project).filter { it.name in modules }.mapNotNull {
- val task = try {
- it.tasks.getByName(DOKKA_TASK_NAME, DokkaTask::class)
+ val passesConfigurations = getProjects(project).filter { it.name in modules }.flatMap {
+ val tasks = try {
+ it.tasks.withType(DokkaTask::class.java)
} catch (e: UnknownTaskException) {
throw IllegalStateException("No dokka task declared in module ${it.name}")
}
- task.getConfiguration()
- }
+ tasks.map { it.getConfiguration() }
+ }.filterNotNull()
val initial = GradleDokkaConfigurationImpl().apply {
outputDir = outputDirectory
@@ -42,7 +42,7 @@ open class DokkaCollectorTask : DefaultTask() {
acc.pluginsClasspath = (acc.pluginsClasspath + it.pluginsClasspath).distinct()
acc
}
- project.tasks.getByName(DOKKA_TASK_NAME).setProperty("config", configuration)
+ project.tasks.withType(DokkaTask::class.java).configureEach { it.config = configuration }
}
init {
@@ -50,6 +50,6 @@ open class DokkaCollectorTask : DefaultTask() {
}
private fun getProjects(project: Project): Set<Project> =
- project.subprojects + project.subprojects.flatMap { getProjects(it) }
+ project.subprojects + project.subprojects.flatMap { getProjects(it) }
} \ No newline at end of file
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 82cba6c1..bedbad18 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
@@ -67,6 +67,8 @@ open class DokkaTask : DefaultTask(), Configurable {
@Classpath
lateinit var pluginsClasspathConfiguration: Configuration
+ internal var config: GradleDokkaConfigurationImpl? = null
+
var dokkaSourceSets: NamedDomainObjectContainer<GradlePassConfigurationImpl>
@Suppress("UNCHECKED_CAST")
@Nested get() = (DslObject(this).extensions.getByName(SOURCE_SETS_EXTENSION_NAME) as NamedDomainObjectContainer<GradlePassConfigurationImpl>)
@@ -138,13 +140,12 @@ open class DokkaTask : DefaultTask(), Configurable {
}
@TaskAction
- fun generate() = getConfiguration()?.let { generate(it) } ?: exitProcess(0)
+ fun generate() = config?.let { generate(it) } ?: getConfiguration()?.let { generate(it) } ?: exitProcess(0)
protected open fun generate(configuration: GradleDokkaConfigurationImpl) {
outputDiagnosticInfo = true
val kotlinColorsEnabledBefore = System.getProperty(COLORS_ENABLED_PROPERTY) ?: "false"
System.setProperty(COLORS_ENABLED_PROPERTY, "false")
- configuration.passesConfigurations.flatMap { it.sourceRoots }.also(::println)
try {
loadCore()
@@ -286,7 +287,10 @@ open class DokkaTask : DefaultTask(), Configurable {
if (config.sourceSetID.isBlank()) {
config.sourceSetID = config.name.takeIf(String::isNotBlank) ?: config.analysisPlatform.key
}
- config.displayName = config.moduleName + config.sourceSetID.substringBeforeLast("Main")
+ config.dependentSourceSets = config.dependentSourceSets.map { config.moduleName + "/" + it }.toMutableList()
+ if (config.displayName.isBlank()) {
+ config.displayName = config.sourceSetID.substringBeforeLast("Main", config.platform.toString())
+ }
config.classpath =
(config.classpath as List<Any>).map { it.toString() }.distinct() // Workaround for Groovy's GStringImpl
config.sourceRoots = config.sourceRoots.distinct().toMutableList()
@@ -322,7 +326,7 @@ open class DokkaTask : DefaultTask(), Configurable {
// Needed for Gradle incremental build
@InputFiles
fun getInputFiles(): FileCollection = passConfigurations.let { config ->
- project.files(config.flatMap { it.sourceRoots }.map { project.fileTree(File(it.path)) }) +
+ 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)) })
}
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 d2a0f043..b62774f8 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
@@ -60,7 +60,7 @@ open class DokkaPlugin : Plugin<Project> {
task.dokkaSourceSets = project.container(GradlePassConfigurationImpl::class.java)
task.dokkaRuntime = runtimeConfiguration
task.pluginsClasspathConfiguration = pluginsConfiguration
- task.outputDirectory = File(project.rootProject.buildDir, "$DOKKA_TASK_NAME/${project.name}").absolutePath
+ task.outputDirectory = File(project.buildDir, DOKKA_TASK_NAME).absolutePath
}
}