diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2023-05-17 21:07:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 21:07:19 +0300 |
commit | a9b3ee192ac09e2e1569a828a9da05d502fb2c75 (patch) | |
tree | dde2db404c95dd06176ce6cfebf5db131bd05538 /runners/gradle-plugin/src/main/kotlin/org | |
parent | 3fc8b83aa53a83e8e2915b22ff79acd6e6bb8d28 (diff) | |
download | dokka-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/gradle-plugin/src/main/kotlin/org')
4 files changed, 13 insertions, 6 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( |