From 37f384d065d3d9bab2c22f545e34e6add4d071fb Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Tue, 18 Apr 2023 17:47:32 +0200 Subject: [PATCH 01/14] Update KGP to 1.8.20 --- core/api/core.api | 2 +- core/src/main/kotlin/utilities/json.kt | 3 ++- gradle/libs.versions.toml | 2 +- plugins/base/api/base.api | 2 +- .../src/main/kotlin/signatures/KotlinSignatureProvider.kt | 2 +- .../base/src/main/kotlin/templating/jsonMapperForPlugins.kt | 6 ++++-- .../src/main/kotlin/transformers/documentables/utils.kt | 2 ++ .../kotlin/translators/documentables/DefaultPageCreator.kt | 2 +- .../src/main/kotlin/converters/KotlinToJavaConverter.kt | 3 ++- plugins/kotlin-as-java/src/main/kotlin/jvmField.kt | 3 ++- plugins/kotlin-as-java/src/main/kotlin/jvmName.kt | 4 +++- plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt | 3 ++- plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt | 3 ++- plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt | 3 ++- 14 files changed, 26 insertions(+), 14 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index d66c5d9ecf..52a612d5be 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -4687,7 +4687,7 @@ public final class org/jetbrains/dokka/utilities/ServiceLookupException : java/l public final class org/jetbrains/dokka/utilities/TypeReference { public static final field Companion Lorg/jetbrains/dokka/utilities/TypeReference$Companion; - public synthetic fun (Lcom/fasterxml/jackson/core/type/TypeReference;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Lcom/fasterxml/jackson/core/type/TypeReference;)V } public final class org/jetbrains/dokka/utilities/TypeReference$Companion { diff --git a/core/src/main/kotlin/utilities/json.kt b/core/src/main/kotlin/utilities/json.kt index 61736a99c3..eb666d31e3 100644 --- a/core/src/main/kotlin/utilities/json.kt +++ b/core/src/main/kotlin/utilities/json.kt @@ -20,10 +20,11 @@ private val objectMapper = run { } @PublishedApi -internal class TypeReference private constructor( +internal class TypeReference @PublishedApi internal constructor( internal val jackson: JacksonTypeReference ) { companion object { + @PublishedApi internal inline operator fun invoke(): TypeReference = TypeReference(jacksonTypeRef()) } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index db3d79af6b..45cf852bd6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -gradlePlugin-kotlin = "1.8.10" +gradlePlugin-kotlin = "1.8.20" gradlePlugin-android = "4.0.1" gradlePlugin-dokka = "1.7.10" diff --git a/plugins/base/api/base.api b/plugins/base/api/base.api index 5e36f375bf..7875800efe 100644 --- a/plugins/base/api/base.api +++ b/plugins/base/api/base.api @@ -1109,7 +1109,7 @@ public abstract class org/jetbrains/dokka/base/templating/SubstitutionCommand : public final class org/jetbrains/dokka/base/templating/TypeReference { public static final field Companion Lorg/jetbrains/dokka/base/templating/TypeReference$Companion; - public synthetic fun (Lcom/fasterxml/jackson/core/type/TypeReference;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Lcom/fasterxml/jackson/core/type/TypeReference;)V } public final class org/jetbrains/dokka/base/templating/TypeReference$Companion { diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index 45a735c64a..54e99ff94c 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -103,7 +103,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog } private fun classlikeSignature(c: T): List { - @Suppress("UNCHECKED_CAST") + @Suppress("UNCHECKED_CAST", "TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") val typeAliasUnderlyingType = (c as? WithExtraProperties) ?.extra ?.get(ActualTypealias) diff --git a/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt b/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt index 98cabd72e8..903063d3d5 100644 --- a/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt +++ b/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt @@ -11,6 +11,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import org.jetbrains.dokka.base.DokkaBase import java.io.File +// TODO [beresnev] try to get rid of this copy-paste in #2933 // THIS IS COPIED FROM BASE SINCE IT NEEDS TO BE INSTANTIATED ON THE SAME CLASS LOADER AS PLUGINS private val objectMapper = run { @@ -26,10 +27,11 @@ private val objectMapper = run { } @PublishedApi -internal class TypeReference private constructor( +internal class TypeReference @PublishedApi internal constructor( internal val jackson: com.fasterxml.jackson.core.type.TypeReference ) { companion object { + @PublishedApi internal inline operator fun invoke(): TypeReference = TypeReference(jacksonTypeRef()) } } @@ -53,4 +55,4 @@ private object FileSerializer : StdScalarSerializer(File::class.java) { private class PluginTypeFactory: TypeFactory(null) { override fun findClass(className: String): Class? = Class.forName(className, true, DokkaBase::class.java.classLoader) ?: super.findClass(className) -} \ No newline at end of file +} diff --git a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt index 079cebea03..2526b50aed 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt @@ -5,10 +5,12 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.ExceptionInSupertypes import org.jetbrains.dokka.model.properties.WithExtraProperties +@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") val > T.isException: Boolean get() = extra[ExceptionInSupertypes] != null +@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") val T.deprecatedAnnotation where T : WithExtraProperties get() = extra[Annotations]?.let { annotations -> annotations.directAnnotations.values.flatten().firstOrNull { diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index 98cf6ab678..409d8b215d 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -722,7 +722,7 @@ private val divergentDocumentableComparator = ) ) { it.dri.callable } -@Suppress("UNCHECKED_CAST") +@Suppress("UNCHECKED_CAST", "TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") private fun T.nameAfterClash(): String = ((this as? WithExtraProperties)?.extra?.get(DriClashAwareName)?.value ?: name).orEmpty() diff --git a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt index 5f98494e55..81f590eb41 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt @@ -482,6 +482,7 @@ internal fun ClassKind.asJava(): ClassKind { } } +@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") private fun PropertyContainer.mergeAdditionalModifiers(second: SourceSetDependent>) = this[AdditionalModifiers]?.squash(AdditionalModifiers(second)) ?: AdditionalModifiers(second) @@ -494,4 +495,4 @@ internal fun ClassId.classNames(): String = private fun DProperty.hasModifier(modifier: ExtraModifiers.KotlinOnlyModifiers): Boolean = extra[AdditionalModifiers] ?.content - ?.any { (_, modifiers) -> modifier in modifiers } == true \ No newline at end of file + ?.any { (_, modifiers) -> modifier in modifiers } == true diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt index b421bd3d8b..e485f512a8 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt @@ -5,8 +5,9 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.kotlin.util.firstNotNullResult +@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") internal fun WithExtraProperties.jvmField(): Annotations.Annotation? = extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations) -> annotations.jvmFieldAnnotation() } internal fun List.jvmFieldAnnotation(): Annotations.Annotation? = - firstOrNull { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmField" } \ No newline at end of file + firstOrNull { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmField" } diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt index 44271f2cb0..ebdf85e5b7 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt @@ -7,13 +7,15 @@ import org.jetbrains.dokka.model.isJvmName import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.kotlin.util.firstNotNullResult +@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") internal fun WithExtraProperties.directlyAnnotatedJvmName(): Annotations.Annotation? = extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations)-> annotations.jvmNameAnnotation() } +@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") internal fun WithExtraProperties.fileLevelJvmName(): Annotations.Annotation? = extra[Annotations]?.fileLevelAnnotations?.entries?.firstNotNullResult { (_, annotations) -> annotations.jvmNameAnnotation() } internal fun List.jvmNameAnnotation(): Annotations.Annotation? = firstOrNull { it.isJvmName() } -internal fun Annotations.Annotation.jvmNameAsString(): String? = (params["name"] as? StringValue)?.value \ No newline at end of file +internal fun Annotations.Annotation.jvmNameAsString(): String? = (params["name"] as? StringValue)?.value diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt index d8e4f67ce9..ea55d6e361 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt @@ -5,10 +5,11 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties internal fun WithExtraProperties.hasJvmOverloads(): Boolean { + @Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") return extra[Annotations] ?.directAnnotations ?.entries ?.any { (_, annotations) -> annotations.any { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmOverloads" } } == true -} \ No newline at end of file +} diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt index 10372ac9df..e4f66fbeea 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt @@ -5,8 +5,9 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.kotlin.util.firstNotNullResult +@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") internal fun WithExtraProperties.jvmStatic(): Annotations.Annotation? = extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations) -> annotations.jvmStaticAnnotation() } internal fun List.jvmStaticAnnotation(): Annotations.Annotation? = - firstOrNull { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmStatic" } \ No newline at end of file + firstOrNull { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmStatic" } diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt index e866ec8bb0..1353ca1b46 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt @@ -5,10 +5,11 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties internal fun WithExtraProperties.hasJvmSynthetic(): Boolean { + @Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") return extra[Annotations] ?.directAnnotations ?.entries ?.any { (_, annotations) -> annotations.any { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmSynthetic" } } == true -} \ No newline at end of file +} From 4badfe91f450c64b3ec9ee522342d7e50e7c0b82 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Tue, 18 Apr 2023 21:19:52 +0200 Subject: [PATCH 02/14] Update AGP to be compatible with KGP --- gradle/libs.versions.toml | 2 +- .../org/jetbrains/dokka/gradle/AndroidAutoConfigurationTest.kt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 45cf852bd6..9bdb7901e4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] gradlePlugin-kotlin = "1.8.20" -gradlePlugin-android = "4.0.1" +gradlePlugin-android = "4.1.3" gradlePlugin-dokka = "1.7.10" kotlinx-coroutines = "1.6.3" 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 116104e828..5e1c55805b 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 @@ -26,6 +26,7 @@ class AndroidAutoConfigurationTest { } @Test + @Ignore // TODO fails because of a new source set androidTestRelease, which is not in the list fun `all default source sets are present in dokka`() { val dokkaTasks = project.tasks.withType().toList() dokkaTasks.forEach { task -> @@ -42,6 +43,7 @@ class AndroidAutoConfigurationTest { } @Test + @Ignore // TODO fails because of a new source set androidTestRelease, it is NOT suppressed fun `test source sets are suppressed`() { val dokkaTasks = project.tasks.withType().toList() project as ProjectInternal @@ -62,6 +64,7 @@ class AndroidAutoConfigurationTest { } @Test + @Ignore // TODO fails because of a new source set androidTestRelease, it its classpath is empty fun `source sets have non-empty classpath`() { val dokkaTasks = project.tasks.withType().toList() project as ProjectInternal From eaa4b20d2c81d0a8e41c26eb86b9963bf9b4905a Mon Sep 17 00:00:00 2001 From: vmishenev Date: Tue, 25 Apr 2023 19:34:49 +0300 Subject: [PATCH 03/14] Replace `AndroidSourceSet` --- .../dokka/gradle/GradleDokkaSourceSetBuilderExtensions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5c7c523b93..b9eee37332 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,6 @@ package org.jetbrains.dokka.gradle -import com.android.build.gradle.api.AndroidSourceSet +import com.android.build.api.dsl.AndroidSourceSet import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet /** From a73e7b5e32b092fd78c5ffc4847caa6152daa554 Mon Sep 17 00:00:00 2001 From: vmishenev Date: Mon, 1 May 2023 23:34:45 +0300 Subject: [PATCH 04/14] Dump API --- runners/gradle-plugin/api/gradle-plugin.api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runners/gradle-plugin/api/gradle-plugin.api b/runners/gradle-plugin/api/gradle-plugin.api index fead39f93b..d8cc5bf904 100644 --- a/runners/gradle-plugin/api/gradle-plugin.api +++ b/runners/gradle-plugin/api/gradle-plugin.api @@ -131,7 +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/gradle/api/AndroidSourceSet;)V + 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;Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSet;)V public static final fun kotlinSourceSet (Lorg/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder;Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSet;)V } From 821aa0bd3f9fe93a0db293d1d9af482d70495b40 Mon Sep 17 00:00:00 2001 From: vmishenev Date: Wed, 3 May 2023 23:49:13 +0300 Subject: [PATCH 05/14] Update integration tests --- .../gradle/projects/it-android-0/gradle.properties | 2 +- .../gradle/projects/it-multiplatform-0/build.gradle.kts | 5 ++++- .../dokka/it/gradle/SequentialTasksExecutionStressTest.kt | 2 +- .../kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/integration-tests/gradle/projects/it-android-0/gradle.properties b/integration-tests/gradle/projects/it-android-0/gradle.properties index 8f0204a104..b139fef92e 100644 --- a/integration-tests/gradle/projects/it-android-0/gradle.properties +++ b/integration-tests/gradle/projects/it-android-0/gradle.properties @@ -1,3 +1,3 @@ dokka_it_kotlin_version=1.8.10 -dokka_it_android_gradle_plugin_version=4.0.0 +dokka_it_android_gradle_plugin_version=4.1.3 android.useAndroidX=true diff --git a/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts b/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts index ec24e720db..8605537fb3 100644 --- a/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts +++ b/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts @@ -25,7 +25,10 @@ kotlin { } named("commonMain") { dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9") + if (properties["dokka_it_kotlin_version"] in listOf("1.4.32", "1.5.31")) + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9") + else + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") } } } diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt index 32ed27f4e4..62eea6bf20 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt @@ -37,7 +37,7 @@ class SequentialTasksExecutionStressTest(override val versions: BuildVersions) : "--info", "--stacktrace", "-Ptask_number=100", - jvmArgs = listOf("-Xmx1G", "-XX:MaxMetaspaceSize=350m") + jvmArgs = listOf("-Xmx1G", "-XX:MaxMetaspaceSize=400m") ).buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":runTasks")).outcome) diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt index 82dc79e20e..0b56d6ef68 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt @@ -2,7 +2,7 @@ package org.jetbrains.dokka.it.gradle internal object TestedVersions { - val LATEST = BuildVersions("7.4.2", "1.8.10") + val LATEST = BuildVersions("7.4.2", "1.8.20") /** * All supported Gradle/Kotlin versions, including [LATEST] @@ -46,5 +46,6 @@ internal object TestedVersions { "1.7.20" to "18.2.0-pre.391", "1.8.0" to "18.2.0-pre.467", "1.8.10" to "18.2.0-pre.490", + "1.8.20" to "18.2.0-pre.546" ) } From 6665b3dc1ba9607eb3608a0a2e1e3a317b41c332 Mon Sep 17 00:00:00 2001 From: vmishenev Date: Fri, 5 May 2023 12:27:47 +0300 Subject: [PATCH 06/14] Update GH actions tests --- .github/workflows/preview-publish-ga.yml | 4 ++-- .github/workflows/preview-publish-web-s3.yml | 4 ++-- .github/workflows/tests-smoke.yml | 2 +- .github/workflows/tests-thorough.yml | 2 +- .../it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt | 5 ++++- .../dokka/it/gradle/AbstractGradleIntegrationTest.kt | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/preview-publish-ga.yml b/.github/workflows/preview-publish-ga.yml index 8b428d7ab8..2137d9d802 100644 --- a/.github/workflows/preview-publish-ga.yml +++ b/.github/workflows/preview-publish-ga.yml @@ -27,7 +27,7 @@ jobs: uses: gradle/gradle-build-action@v2 with: gradle-home-cache-cleanup: true - arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest --stacktrace + arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m" env: DOKKA_TEST_OUTPUT_PATH: /home/runner/work/dokka/coroutines - name: Copy files to GitHub Actions Artifacts @@ -56,7 +56,7 @@ jobs: uses: gradle/gradle-build-action@v2 with: gradle-home-cache-cleanup: true - arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.SerializationGradleIntegrationTest --stacktrace + arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.SerializationGradleIntegrationTest --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m" env: DOKKA_TEST_OUTPUT_PATH: /home/runner/work/dokka/serialization - name: Copy files to GitHub Actions Artifacts diff --git a/.github/workflows/preview-publish-web-s3.yml b/.github/workflows/preview-publish-web-s3.yml index a9d34e28db..15bf9477f7 100644 --- a/.github/workflows/preview-publish-web-s3.yml +++ b/.github/workflows/preview-publish-web-s3.yml @@ -24,7 +24,7 @@ jobs: uses: gradle/gradle-build-action@v2 with: gradle-home-cache-cleanup: true - arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest --stacktrace + arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m" env: DOKKA_TEST_OUTPUT_PATH: /home/runner/work/dokka/coroutines - name: Configure AWS credentials for S3 access @@ -55,7 +55,7 @@ jobs: uses: gradle/gradle-build-action@v2 with: gradle-home-cache-cleanup: true - arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.SerializationGradleIntegrationTest --stacktrace + arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.SerializationGradleIntegrationTest --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m" env: DOKKA_TEST_OUTPUT_PATH: /home/runner/work/dokka/serialization - name: Configure AWS credentials for S3 access diff --git a/.github/workflows/tests-smoke.yml b/.github/workflows/tests-smoke.yml index 96ab0196a8..1177c111f3 100644 --- a/.github/workflows/tests-smoke.yml +++ b/.github/workflows/tests-smoke.yml @@ -29,7 +29,7 @@ jobs: if: matrix.os == 'windows-latest' # Running tests with the Gradle daemon on windows agents leads to some very strange # JVM crashes for some reason. Most likely a problem of Gradle/GitHub/Windows server - run: ./gradlew clean test --stacktrace --no-daemon + run: ./gradlew clean test --stacktrace --no-daemon --no-parallel "-Dorg.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=500m" - name: Run tests under Ubuntu if: matrix.os != 'windows-latest' run: ./gradlew clean test --stacktrace diff --git a/.github/workflows/tests-thorough.yml b/.github/workflows/tests-thorough.yml index 6e54f9a3f6..7684277eb4 100644 --- a/.github/workflows/tests-thorough.yml +++ b/.github/workflows/tests-thorough.yml @@ -30,7 +30,7 @@ jobs: if: matrix.os == 'windows-latest' # Running tests with the Gradle daemon on windows agents leads to some very strange # JVM crashes for some reason. Most likely a problem of Gradle/GitHub/Windows server - run: ./gradlew clean test --stacktrace --no-daemon + run: ./gradlew clean test --stacktrace --no-daemon --no-parallel "-Dorg.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=500m" - name: Run tests under Ubuntu/Macos if: matrix.os != 'windows-latest' run: ./gradlew clean test --stacktrace diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt index 650556233d..24b2378db8 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt @@ -33,7 +33,10 @@ class CoroutinesGradleIntegrationTest(override val versions: BuildVersions) : Ab @Test fun execute() { - val result = createGradleRunner(":dokkaHtmlMultiModule", "-i", "-s").buildRelaxed() + val result = createGradleRunner( + ":dokkaHtmlMultiModule", "-i", "-s", + jvmArgs = listOf("-Xmx2G", "-XX:MaxMetaspaceSize=500m") + ).buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtmlMultiModule")).outcome) diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt index 84efac939d..43cc575bec 100644 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt @@ -28,7 +28,7 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { fun createGradleRunner( vararg arguments: String, - jvmArgs: List = listOf("-Xmx4G", "-XX:MaxMetaspaceSize=2G") + jvmArgs: List = listOf("-Xmx2G", "-XX:MaxMetaspaceSize=1G") ): GradleRunner { return GradleRunner.create() .withProjectDir(projectDir) From 0b957c062b02b267ba8ebc049a15f103ab68dbde Mon Sep 17 00:00:00 2001 From: vmishenev Date: Mon, 8 May 2023 16:59:56 +0300 Subject: [PATCH 07/14] Refactor Gradle Runner --- runners/gradle-plugin/api/gradle-plugin.api | 2 +- .../dokka/gradle/GradleDokkaSourceSetBuilderExtensions.kt | 3 +-- .../org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runners/gradle-plugin/api/gradle-plugin.api b/runners/gradle-plugin/api/gradle-plugin.api index d8cc5bf904..fead39f93b 100644 --- a/runners/gradle-plugin/api/gradle-plugin.api +++ b/runners/gradle-plugin/api/gradle-plugin.api @@ -131,7 +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 b9eee37332..a8935086ac 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.api.dsl.AndroidSourceSet import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet /** @@ -13,7 +12,7 @@ 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)) } 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 ed77324fca..54765b6ada 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 @@ -39,6 +39,7 @@ private fun KotlinCompilation.compileClasspathOf(project: Project): FileCollecti return this.classpathOf(project) } + @Suppress("DEPRECATION") val platformDependencyFiles: FileCollection = (this as? AbstractKotlinNativeCompilation) ?.target?.project?.configurations ?.findByName(this.defaultSourceSet.implementationMetadataConfigurationName) From dd23815819ef2f63ffed7c895ae94ede451c893f Mon Sep 17 00:00:00 2001 From: vmishenev Date: Thu, 11 May 2023 16:00:00 +0300 Subject: [PATCH 08/14] Fix `TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION` --- .../src/main/kotlin/signatures/KotlinSignatureProvider.kt | 6 +++--- plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index 54e99ff94c..67e9407f58 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -102,9 +102,9 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog } } - private fun classlikeSignature(c: T): List { - @Suppress("UNCHECKED_CAST", "TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") - val typeAliasUnderlyingType = (c as? WithExtraProperties) + private fun classlikeSignature(c: DClasslike): List { + @Suppress("UNCHECKED_CAST") + val typeAliasUnderlyingType = (c as? WithExtraProperties) ?.extra ?.get(ActualTypealias) ?.underlyingType diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt index 1353ca1b46..9629db0cc9 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt @@ -1,11 +1,9 @@ package org.jetbrains.dokka.kotlinAsJava import org.jetbrains.dokka.model.Annotations -import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties -internal fun WithExtraProperties.hasJvmSynthetic(): Boolean { - @Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") +internal fun WithExtraProperties.hasJvmSynthetic(): Boolean { return extra[Annotations] ?.directAnnotations ?.entries From e4d609e7df28048a0521abb4a5aae2207702c865 Mon Sep 17 00:00:00 2001 From: vmishenev Date: Thu, 11 May 2023 16:05:41 +0300 Subject: [PATCH 09/14] 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 --- .../dokka/gradle/kotlin/isMainSourceSet.kt | 1 - .../dokka/gradle/kotlin/kotlinClasspathUtils.kt | 5 +++-- .../dokka/gradle/AndroidAutoConfigurationTest.kt | 12 +++++------- .../jetbrains/dokka/gradle/IsMainSourceSetTest.kt | 15 --------------- 4 files changed, 8 insertions(+), 25 deletions(-) delete mode 100644 runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/IsMainSourceSetTest.kt 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 15989217b3..c8b7836775 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): 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 54765b6ada..08429cc0e6 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 } @@ -39,10 +41,9 @@ private fun KotlinCompilation.compileClasspathOf(project: Project): FileCollecti return this.classpathOf(project) } - @Suppress("DEPRECATION") val platformDependencyFiles: FileCollection = (this as? AbstractKotlinNativeCompilation) ?.target?.project?.configurations - ?.findByName(this.defaultSourceSet.implementationMetadataConfigurationName) + ?.findByName(@Suppress("DEPRECATION") this.defaultSourceSet.implementationMetadataConfigurationName) ?: project.files() return this.compileDependencyFiles + platformDependencyFiles + this.classpathOf(project) 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 5e1c55805b..7bd6986e5a 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 @@ -26,7 +26,6 @@ class AndroidAutoConfigurationTest { } @Test - @Ignore // TODO fails because of a new source set androidTestRelease, which is not in the list fun `all default source sets are present in dokka`() { val dokkaTasks = project.tasks.withType().toList() dokkaTasks.forEach { task -> @@ -34,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" @@ -43,7 +42,6 @@ class AndroidAutoConfigurationTest { } @Test - @Ignore // TODO fails because of a new source set androidTestRelease, it is NOT suppressed fun `test source sets are suppressed`() { val dokkaTasks = project.tasks.withType().toList() project as ProjectInternal @@ -64,21 +62,21 @@ class AndroidAutoConfigurationTest { } @Test - @Ignore // TODO fails because of a new source set androidTestRelease, it its classpath is empty fun `source sets have non-empty classpath`() { val dokkaTasks = project.tasks.withType().toList() 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 { sourceSet.classpath.files } + assertFailsWith("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 c354c62f44..0000000000 --- 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" - ) - } -} From 86ade28f8bd480efa3caf7931df05fd082472b39 Mon Sep 17 00:00:00 2001 From: vmishenev Date: Thu, 11 May 2023 16:07:29 +0300 Subject: [PATCH 10/14] Introduce `dependsOn` for a new `com.android.build.api.dsl.AndroidSourceSet` --- .../dokka/gradle/GradleDokkaSourceSetBuilderExtensions.kt | 7 +++++++ .../jetbrains/dokka/gradle/tasks/DokkaMultiModuleTask.kt | 4 ++-- 2 files changed, 9 insertions(+), 2 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 a8935086ac..196691af2c 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 @@ -16,6 +16,13 @@ fun GradleDokkaSourceSetBuilder.dependsOn(@Suppress("DEPRECATION") sourceSet: co 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)) +} + /** * Extension allowing configuration of Dokka source sets via Kotlin Gradle plugin source sets. */ 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 c1697ac1ad..7d6f60d2de 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( From 48c32ca28788ba9efe35f1474d4182da3c7ebdcb Mon Sep 17 00:00:00 2001 From: vmishenev Date: Thu, 11 May 2023 16:16:26 +0300 Subject: [PATCH 11/14] API dump --- runners/gradle-plugin/api/gradle-plugin.api | 1 + 1 file changed, 1 insertion(+) diff --git a/runners/gradle-plugin/api/gradle-plugin.api b/runners/gradle-plugin/api/gradle-plugin.api index fead39f93b..b082f22b86 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 From aebc0073db058ea519aba1e22ed6cfca1c8b8ea4 Mon Sep 17 00:00:00 2001 From: vmishenev Date: Thu, 11 May 2023 17:18:17 +0300 Subject: [PATCH 12/14] Add comment --- .../org/jetbrains/dokka/gradle/kotlin/kotlinClasspathUtils.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 08429cc0e6..e05b207523 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 @@ -43,7 +43,7 @@ private fun KotlinCompilation.compileClasspathOf(project: Project): FileCollecti val platformDependencyFiles: FileCollection = (this as? AbstractKotlinNativeCompilation) ?.target?.project?.configurations - ?.findByName(@Suppress("DEPRECATION") this.defaultSourceSet.implementationMetadataConfigurationName) + ?.findByName(@Suppress("DEPRECATION") this.defaultSourceSet.implementationMetadataConfigurationName) // KT-58640 ?: project.files() return this.compileDependencyFiles + platformDependencyFiles + this.classpathOf(project) From 33c511e5c13e175aac47ef0f622e0fde76a7eb40 Mon Sep 17 00:00:00 2001 From: vmishenev Date: Wed, 17 May 2023 17:18:13 +0300 Subject: [PATCH 13/14] Suppress remaining `TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION` --- .../src/main/kotlin/transformers/documentables/utils.kt | 8 +++----- .../translators/documentables/DefaultPageCreator.kt | 4 ++-- .../jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt | 7 ++++--- .../src/main/kotlin/converters/KotlinToJavaConverter.kt | 3 +-- plugins/kotlin-as-java/src/main/kotlin/jvmField.kt | 3 +-- plugins/kotlin-as-java/src/main/kotlin/jvmName.kt | 6 ++---- plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt | 3 +-- plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt | 3 +-- .../src/main/kotlin/transformers/JvmNameProvider.kt | 4 ++-- 9 files changed, 17 insertions(+), 24 deletions(-) diff --git a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt index 2526b50aed..379855ea76 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt @@ -5,13 +5,11 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.ExceptionInSupertypes import org.jetbrains.dokka.model.properties.WithExtraProperties -@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") -val > T.isException: Boolean +val WithExtraProperties.isException: Boolean get() = extra[ExceptionInSupertypes] != null -@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") -val T.deprecatedAnnotation where T : WithExtraProperties +val WithExtraProperties.deprecatedAnnotation get() = extra[Annotations]?.let { annotations -> annotations.directAnnotations.values.flatten().firstOrNull { it.isDeprecated() @@ -22,7 +20,7 @@ val T.deprecatedAnnotation where T : WithExtraProperties * @return true if [T] has [kotlin.Deprecated] or [java.lang.Deprecated] * annotation for **any** source set */ -fun T.isDeprecated() where T : WithExtraProperties = deprecatedAnnotation != null +fun WithExtraProperties.isDeprecated() = deprecatedAnnotation != null /** * @return true for [kotlin.Deprecated] and [java.lang.Deprecated] diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index 409d8b215d..1abd344111 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -722,9 +722,9 @@ private val divergentDocumentableComparator = ) ) { it.dri.callable } -@Suppress("UNCHECKED_CAST", "TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") +@Suppress("UNCHECKED_CAST") private fun T.nameAfterClash(): String = - ((this as? WithExtraProperties)?.extra?.get(DriClashAwareName)?.value ?: name).orEmpty() + ((this as? WithExtraProperties)?.extra?.get(DriClashAwareName)?.value ?: name).orEmpty() @Suppress("UNCHECKED_CAST") internal inline fun GroupedTags.withTypeUnnamed(): SourceSetDependent = diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt index 39e2525e13..e6e0e03725 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt @@ -119,9 +119,10 @@ object DeprecatedPageCreator : PageTransformer { override fun invoke(input: RootPageNode): RootPageNode { val elements = HashMap>().apply { - fun T.putAs(deprecatedPageSection: DeprecatedPageSection) where + fun T.putAs(deprecatedPageSection: DeprecatedPageSection) where T : NavigableJavadocNode, - T : WithJavadocExtra { + V : Documentable, + T : WithJavadocExtra { val deprecatedNode = DeprecatedNode( listOfNotNull( getDRI().packageName?.takeUnless { it.isBlank() }, @@ -159,7 +160,7 @@ object DeprecatedPageCreator : PageTransformer { it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedEnumConstants) } node.takeIf { it.isDeprecated() }?.putAs( - if ((node as? WithJavadocExtra)?.isException == true) DeprecatedPageSection.DeprecatedExceptions + if ((node as? WithJavadocExtra<*>)?.isException == true) DeprecatedPageSection.DeprecatedExceptions else when (node.kind) { "enum" -> DeprecatedPageSection.DeprecatedEnums "interface" -> DeprecatedPageSection.DeprecatedInterfaces diff --git a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt index 81f590eb41..4df0d3c576 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt @@ -482,8 +482,7 @@ internal fun ClassKind.asJava(): ClassKind { } } -@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") -private fun PropertyContainer.mergeAdditionalModifiers(second: SourceSetDependent>) = +private fun PropertyContainer.mergeAdditionalModifiers(second: SourceSetDependent>) = this[AdditionalModifiers]?.squash(AdditionalModifiers(second)) ?: AdditionalModifiers(second) private fun AdditionalModifiers.squash(second: AdditionalModifiers) = diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt index e485f512a8..fea78abbaf 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt @@ -5,8 +5,7 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.kotlin.util.firstNotNullResult -@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") -internal fun WithExtraProperties.jvmField(): Annotations.Annotation? = +internal fun WithExtraProperties.jvmField(): Annotations.Annotation? = extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations) -> annotations.jvmFieldAnnotation() } internal fun List.jvmFieldAnnotation(): Annotations.Annotation? = diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt index ebdf85e5b7..600318e5d1 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt @@ -7,12 +7,10 @@ import org.jetbrains.dokka.model.isJvmName import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.kotlin.util.firstNotNullResult -@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") -internal fun WithExtraProperties.directlyAnnotatedJvmName(): Annotations.Annotation? = +internal fun WithExtraProperties.directlyAnnotatedJvmName(): Annotations.Annotation? = extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations)-> annotations.jvmNameAnnotation() } -@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") -internal fun WithExtraProperties.fileLevelJvmName(): Annotations.Annotation? = +internal fun WithExtraProperties.fileLevelJvmName(): Annotations.Annotation? = extra[Annotations]?.fileLevelAnnotations?.entries?.firstNotNullResult { (_, annotations) -> annotations.jvmNameAnnotation() } internal fun List.jvmNameAnnotation(): Annotations.Annotation? = diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt index ea55d6e361..9913d017c8 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt @@ -4,8 +4,7 @@ import org.jetbrains.dokka.model.Annotations import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties -internal fun WithExtraProperties.hasJvmOverloads(): Boolean { - @Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") +internal fun WithExtraProperties.hasJvmOverloads(): Boolean { return extra[Annotations] ?.directAnnotations ?.entries diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt index e4f66fbeea..50ea77957d 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt @@ -5,8 +5,7 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.kotlin.util.firstNotNullResult -@Suppress("TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION") -internal fun WithExtraProperties.jvmStatic(): Annotations.Annotation? = +internal fun WithExtraProperties.jvmStatic(): Annotations.Annotation? = extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations) -> annotations.jvmStaticAnnotation() } internal fun List.jvmStaticAnnotation(): Annotations.Annotation? = diff --git a/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameProvider.kt b/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameProvider.kt index c928ea675b..4c35def762 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameProvider.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameProvider.kt @@ -11,12 +11,12 @@ data class Name(val fqName: String) { } class JvmNameProvider { - fun nameFor(entry: T): String where T : Documentable, T : WithExtraProperties = + fun nameFor(entry: T): String where T : Documentable, T : WithExtraProperties = entry.directlyAnnotatedJvmName()?.jvmNameAsString() ?: entry.name ?: throw IllegalStateException("Failed to provide a name for ${entry.javaClass.canonicalName}") - fun nameForSyntheticClass(entry: T): Name where T : WithSources, T : WithExtraProperties, T : Documentable { + fun nameForSyntheticClass(entry: T): Name where T : WithSources, T : WithExtraProperties, T : Documentable { val name: String = (entry.fileLevelJvmName()?.params?.get("name") as? StringValue)?.value ?: (entry.sources.entries.first().value.path.split("/").last().split(".").first().capitalize() + "Kt") return Name("${entry.dri.packageName}.$name") From 4525420d8c696ffbe037388e662cea8e77c3ae92 Mon Sep 17 00:00:00 2001 From: vmishenev Date: Wed, 17 May 2023 17:18:25 +0300 Subject: [PATCH 14/14] Add comment --- .../gradle/projects/it-multiplatform-0/build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts b/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts index 8605537fb3..4a58526bcb 100644 --- a/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts +++ b/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts @@ -26,6 +26,8 @@ kotlin { named("commonMain") { dependencies { if (properties["dokka_it_kotlin_version"] in listOf("1.4.32", "1.5.31")) + // otherwise for a modern versin of coroutines: + // Failed to resolve Kotlin library: project/build/kotlinSourceSetMetadata/commonMain/org.jetbrains.kotlinx-kotlinx-coroutines-core/org.jetbrains.kotlinx-kotlinx-coroutines-core-commonMain.klib implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9") else implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")