aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src
diff options
context:
space:
mode:
Diffstat (limited to 'runners/gradle-plugin/src')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderExtensions.kt10
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/isMainSourceSet.kt1
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt4
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaMultiModuleTask.kt4
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAutoConfigurationTest.kt9
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/IsMainSourceSetTest.kt15
6 files changed, 18 insertions, 25 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderExtensions.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderExtensions.kt
index 5c7c523b..196691af 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderExtensions.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderExtensions.kt
@@ -1,6 +1,5 @@
package org.jetbrains.dokka.gradle
-import com.android.build.gradle.api.AndroidSourceSet
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
/**
@@ -13,7 +12,14 @@ fun GradleDokkaSourceSetBuilder.dependsOn(sourceSet: KotlinSourceSet) {
/**
* Convenient override to **append** source sets to [GradleDokkaSourceSetBuilder.dependentSourceSets]
*/
-fun GradleDokkaSourceSetBuilder.dependsOn(sourceSet: AndroidSourceSet) {
+fun GradleDokkaSourceSetBuilder.dependsOn(@Suppress("DEPRECATION") sourceSet: com.android.build.gradle.api.AndroidSourceSet) {
+ dependsOn(DokkaSourceSetID(sourceSet.name))
+}
+
+/**
+ * Convenient override to **append** source sets to [GradleDokkaSourceSetBuilder.dependentSourceSets]
+ */
+fun GradleDokkaSourceSetBuilder.dependsOn(@Suppress("UnstableApiUsage") sourceSet: com.android.build.api.dsl.AndroidSourceSet) {
dependsOn(DokkaSourceSetID(sourceSet.name))
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/isMainSourceSet.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/isMainSourceSet.kt
index 15989217..c8b78367 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/isMainSourceSet.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/isMainSourceSet.kt
@@ -11,7 +11,6 @@ internal fun Project.isMainSourceSet(sourceSet: KotlinSourceSet): Boolean {
}
internal fun isMainSourceSet(compilations: List<KotlinCompilation>): Boolean {
- if (compilations.isEmpty()) return true
return compilations.any { compilation -> isMainCompilation(compilation) }
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt
index ed77324f..e05b2075 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt
@@ -27,6 +27,8 @@ internal fun Project.classpathOf(sourceSet: KotlinSourceSet): FileCollection {
.map { compilation -> compilation.compileClasspathOf(project = this) }
.reduce { acc, fileCollection -> acc + fileCollection }
} else {
+ // Dokka suppresses source sets that do no have compilations
+ // since such configuration is invalid, it reports a warning or an error
sourceSet.withAllDependentSourceSets()
.toList()
.map { it.kotlin.sourceDirectories }
@@ -41,7 +43,7 @@ private fun KotlinCompilation.compileClasspathOf(project: Project): FileCollecti
val platformDependencyFiles: FileCollection = (this as? AbstractKotlinNativeCompilation)
?.target?.project?.configurations
- ?.findByName(this.defaultSourceSet.implementationMetadataConfigurationName)
+ ?.findByName(@Suppress("DEPRECATION") this.defaultSourceSet.implementationMetadataConfigurationName) // KT-58640
?: project.files()
return this.compileDependencyFiles + platformDependencyFiles + this.classpathOf(project)
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaMultiModuleTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaMultiModuleTask.kt
index c1697ac1..7d6f60d2 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaMultiModuleTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/DokkaMultiModuleTask.kt
@@ -92,8 +92,8 @@ abstract class DokkaMultiModuleTask : AbstractDokkaParentTask() {
outputDir = outputDirectory.asFile.get(),
cacheRoot = cacheRoot.asFile.orNull,
pluginsConfiguration = buildPluginsConfiguration(),
- failOnWarning = failOnWarning.get(),
- offlineMode = offlineMode.get(),
+ failOnWarning = failOnWarning.get(),
+ offlineMode = offlineMode.get(),
pluginsClasspath = plugins.resolve().toList(),
modules = childDokkaTasks.map { dokkaTask ->
DokkaModuleDescriptionImpl(
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAutoConfigurationTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAutoConfigurationTest.kt
index 116104e8..7bd6986e 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAutoConfigurationTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAutoConfigurationTest.kt
@@ -33,7 +33,7 @@ class AndroidAutoConfigurationTest {
assertEquals(
listOf(
"androidTest", "androidTestDebug", "debug", "main",
- "release", "test", "testDebug", "testRelease"
+ "release", "test", "testDebug", "testRelease", "androidTestRelease"
).sorted(),
sourceSets.map { it.name }.sorted(),
"Expected all default source sets being registered"
@@ -67,15 +67,16 @@ class AndroidAutoConfigurationTest {
project as ProjectInternal
project.evaluate()
- dokkaTasks.flatMap { it.dokkaSourceSets }.forEach { sourceSet ->
+ dokkaTasks.flatMap { it.dokkaSourceSets }
+ .filterNot { it.name == "androidTestRelease" && it.suppress.get() } // androidTestRelease has empty classpath, but it makes no sense for suppressed source set
+ .forEach { sourceSet ->
/*
There is no better way of checking for empty classpath at the moment (without resolving dependencies).
We assume, that an empty classpath can be resolved
We assume, that a non-empty classpath will not be able to resolve (no repositories defined)
*/
-
- assertFailsWith<ResolveException> { sourceSet.classpath.files }
+ assertFailsWith<ResolveException>("SourceSet: " + sourceSet.name) { sourceSet.classpath.files }
}
}
}
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/IsMainSourceSetTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/IsMainSourceSetTest.kt
deleted file mode 100644
index c354c62f..00000000
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/IsMainSourceSetTest.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.jetbrains.dokka.gradle
-
-import org.jetbrains.dokka.gradle.kotlin.isMainSourceSet
-import kotlin.test.Test
-import kotlin.test.assertTrue
-
-class IsMainSourceSetTest {
- @Test
- fun `missing compilations will return true`() {
- assertTrue(
- isMainSourceSet(emptyList()),
- "Expected 'isMainSourceSet' to return 'true' when no compilations are found"
- )
- }
-}