aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2023-05-17 21:07:19 +0300
committerGitHub <noreply@github.com>2023-05-17 21:07:19 +0300
commita9b3ee192ac09e2e1569a828a9da05d502fb2c75 (patch)
treedde2db404c95dd06176ce6cfebf5db131bd05538 /runners
parent3fc8b83aa53a83e8e2915b22ff79acd6e6bb8d28 (diff)
downloaddokka-a9b3ee192ac09e2e1569a828a9da05d502fb2c75.tar.gz
dokka-a9b3ee192ac09e2e1569a828a9da05d502fb2c75.tar.bz2
dokka-a9b3ee192ac09e2e1569a828a9da05d502fb2c75.zip
Update KGP to 1.8.20 (#2989)
* Update KGP to 1.8.20 * Update AGP to be compatible with KGP * Replace `AndroidSourceSet` * Dump API * Update integration tests * Update GH actions tests * Refactor Gradle Runner * Fix `TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION` * Suppress source sets without compilations Dokka suppresses source sets that do no have compilation since such configuration is invalid, it reports a warning or an error * Introduce `dependsOn` for a new `com.android.build.api.dsl.AndroidSourceSet` * API dump * Add comment * Suppress remaining `TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION` * Add comment --------- Co-authored-by: Ignat Beresnev <ignat.beresnev@jetbrains.com>
Diffstat (limited to 'runners')
-rw-r--r--runners/gradle-plugin/api/gradle-plugin.api1
-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
7 files changed, 19 insertions, 25 deletions
diff --git a/runners/gradle-plugin/api/gradle-plugin.api b/runners/gradle-plugin/api/gradle-plugin.api
index fead39f9..b082f22b 100644
--- a/runners/gradle-plugin/api/gradle-plugin.api
+++ b/runners/gradle-plugin/api/gradle-plugin.api
@@ -131,6 +131,7 @@ public class org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder : org/jetbra
}
public final class org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderExtensionsKt {
+ public static final fun dependsOn (Lorg/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder;Lcom/android/build/api/dsl/AndroidSourceSet;)V
public static final fun dependsOn (Lorg/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder;Lcom/android/build/gradle/api/AndroidSourceSet;)V
public static final fun dependsOn (Lorg/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder;Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSet;)V
public static final fun kotlinSourceSet (Lorg/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder;Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSet;)V
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"
- )
- }
-}