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/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..9bdb7901e4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] -gradlePlugin-kotlin = "1.8.10" -gradlePlugin-android = "4.0.1" +gradlePlugin-kotlin = "1.8.20" +gradlePlugin-android = "4.1.3" gradlePlugin-dokka = "1.7.10" kotlinx-coroutines = "1.6.3" 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..4a58526bcb 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,12 @@ 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")) + // 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") } } } 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" ) } 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) 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..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 { + private fun classlikeSignature(c: DClasslike): List { @Suppress("UNCHECKED_CAST") - val typeAliasUnderlyingType = (c as? WithExtraProperties) + val typeAliasUnderlyingType = (c as? WithExtraProperties) ?.extra ?.get(ActualTypealias) ?.underlyingType 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..379855ea76 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt @@ -5,11 +5,11 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.ExceptionInSupertypes import org.jetbrains.dokka.model.properties.WithExtraProperties -val > T.isException: Boolean +val WithExtraProperties.isException: Boolean get() = extra[ExceptionInSupertypes] != null -val T.deprecatedAnnotation where T : WithExtraProperties +val WithExtraProperties.deprecatedAnnotation get() = extra[Annotations]?.let { annotations -> annotations.directAnnotations.values.flatten().firstOrNull { it.isDeprecated() @@ -20,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 98cf6ab678..1abd344111 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -724,7 +724,7 @@ private val divergentDocumentableComparator = @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 5f98494e55..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,7 +482,7 @@ internal fun ClassKind.asJava(): ClassKind { } } -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) = @@ -494,4 +494,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..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,8 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.kotlin.util.firstNotNullResult -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? = - 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..600318e5d1 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt @@ -7,13 +7,13 @@ import org.jetbrains.dokka.model.isJvmName import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.kotlin.util.firstNotNullResult -internal fun WithExtraProperties.directlyAnnotatedJvmName(): Annotations.Annotation? = +internal fun WithExtraProperties.directlyAnnotatedJvmName(): Annotations.Annotation? = extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations)-> annotations.jvmNameAnnotation() } -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? = 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..9913d017c8 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt @@ -4,11 +4,11 @@ import org.jetbrains.dokka.model.Annotations import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties -internal fun WithExtraProperties.hasJvmOverloads(): Boolean { +internal fun WithExtraProperties.hasJvmOverloads(): Boolean { 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..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,8 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.WithExtraProperties import org.jetbrains.kotlin.util.firstNotNullResult -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? = - 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..9629db0cc9 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt @@ -1,14 +1,13 @@ 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 { +internal fun WithExtraProperties.hasJvmSynthetic(): Boolean { 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 +} 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") 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 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..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 @@ -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 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 ed77324fca..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 @@ -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 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( 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..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 @@ -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 { 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" - ) - } -}