From 2b0a63f3565f620f7212a822aee2575a46f44897 Mon Sep 17 00:00:00 2001 From: Vadim Mishenev Date: Wed, 1 Nov 2023 18:46:55 +0200 Subject: [PATCH] Update Kotlin compiler and KGP to 1.9.20-RC2 (#3262) * Update Kotlin compiler to 1.9.20-RC2 The current changes are related to https://github.com/JetBrains/kotlin/commit/d797505f06d640b666829bbfb4b7d7c67f812026 * Update KGP to 1.9.20-RC2 * Replace common stdlib in unit tests * Update Kotlin version in integration tests * Fix `Multiplatform0GradleIntegrationTest` * Turn WasmGradleIntegrationTest off for Kotlin 1.9.20-RC2 --- .../main/kotlin/testApi/testRunner/TestRunner.kt | 11 +++++------ gradle/libs.versions.toml | 4 ++-- .../projects/it-multiplatform-0/build.gradle.kts | 2 +- .../projects/it-multiplatform-0/gradle.properties | 4 ---- .../gradle/Multiplatform0GradleIntegrationTest.kt | 14 +++++++++++++- .../jetbrains/dokka/it/gradle/TestedVersions.kt | 5 +++-- .../dokka/it/gradle/WasmGradleIntegrationTest.kt | 3 ++- integration-tests/maven/projects/it-maven/pom.xml | 2 +- .../resolve/DokkaJsResolverForModuleFactory.kt | 1 - .../DokkaKlibMetadataCommonDependencyContainer.kt | 7 ++----- 10 files changed, 29 insertions(+), 24 deletions(-) diff --git a/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt b/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt index 0958ea14ae..1f7ee060f4 100644 --- a/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt +++ b/core/test-api/src/main/kotlin/testApi/testRunner/TestRunner.kt @@ -191,12 +191,11 @@ public abstract class AbstractTest, D : Dokk ?.replaceAfter(".jar", "") } - protected val commonStdlibPath: String? by lazy { - // TODO: feels hacky, find a better way to do it - ClassLoader.getSystemResource("kotlin/UInt.kotlin_metadata") - ?.file - ?.replace("file:", "") - ?.replaceAfter(".jar", "") + protected val commonStdlibPath: String? by lazy { + // `kotlin-stdlib-common` is legacy + // we can use any platform dependency + // since common code should be resolved with all platform + jvmStdlibPath } protected val stdlibExternalDocumentationLink: ExternalDocumentationLinkImpl = ExternalDocumentationLinkImpl( diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e3f190fb82..034c09cb1f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -gradlePlugin-kotlin = "1.9.10" +gradlePlugin-kotlin = "1.9.20-RC2" # See: https://kotlinlang.org/docs/gradle-configure-project.html#apply-the-plugin gradlePlugin-android = "4.2.2" gradlePlugin-dokka = "1.9.10" @@ -10,7 +10,7 @@ kotlinx-collections-immutable = "0.3.6" kotlinx-bcv = "0.13.2" ## Analysis -kotlin-compiler = "1.9.10" +kotlin-compiler = "1.9.20-RC2" kotlin-compiler-k2 = "2.0.0-dev-5387" # MUST match the version of the intellij platform used in the kotlin compiler, 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 ab7a8fb5ab..a00b4b8d45 100644 --- a/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts +++ b/integration-tests/gradle/projects/it-multiplatform-0/build.gradle.kts @@ -16,7 +16,7 @@ kotlin { jvm() linuxX64("linux") macosX64("macos") - js(BOTH) + js(IR) // Starting with Kotlin 1.9.0, using compiler types LEGACY or BOTH leads to an error. //TODO Add wasm when kx.coroutines will be supported and published into the main repo sourceSets { val commonMain by sourceSets.getting diff --git a/integration-tests/gradle/projects/it-multiplatform-0/gradle.properties b/integration-tests/gradle/projects/it-multiplatform-0/gradle.properties index 4d8f284781..1e2686effb 100644 --- a/integration-tests/gradle/projects/it-multiplatform-0/gradle.properties +++ b/integration-tests/gradle/projects/it-multiplatform-0/gradle.properties @@ -3,7 +3,3 @@ # dokka_it_kotlin_version=1.9.10 -#these flags are enabled by default since 1.6.20. -#remove when this test is executed with Kotlin >= 1.6.20 -kotlin.mpp.enableGranularSourceSetsMetadata=true -kotlin.native.enableDependencyPropagation=false diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt index e43bc05985..d8f5cee254 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt @@ -27,7 +27,19 @@ class Multiplatform0GradleIntegrationTest : AbstractGradleIntegrationTest() { @ParameterizedTest(name = "{0}") @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) fun execute(buildVersions: BuildVersions) { - val result = createGradleRunner(buildVersions, "dokkaHtml", "-i", "-s").buildRelaxed() + // `enableGranularSourceSetsMetadata` and `enableDependencyPropagation` flags are enabled by default since 1.6.20. + // remove when this test is executed with Kotlin >= 1.6.20 + val result = if (buildVersions.kotlinVersion < "1.6.20") + createGradleRunner( + buildVersions, + "dokkaHtml", + "-i", + "-s", + "-Pkotlin.mpp.enableGranularSourceSetsMetadata=true", + "-Pkotlin.native.enableDependencyPropagation=false" + ).buildRelaxed() + else + createGradleRunner(buildVersions, "dokkaHtml", "-i", "-s").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).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 3493879a97..e4634c0911 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 @@ -14,7 +14,7 @@ internal open class AllSupportedTestedVersionsArgumentsProvider : TestedVersions internal object TestedVersions { - val LATEST = BuildVersions("7.6.2", "1.9.10") + val LATEST = BuildVersions("7.6.2", "1.9.20-RC2") /** * All supported Gradle/Kotlin versions, including [LATEST] @@ -24,7 +24,7 @@ internal object TestedVersions { val ALL_SUPPORTED = BuildVersions.permutations( gradleVersions = listOf("7.6.2"), - kotlinVersions = listOf("1.9.0", "1.8.20", "1.7.20", "1.6.21", "1.5.31"), + kotlinVersions = listOf("1.9.10", "1.8.20", "1.7.20", "1.6.21", "1.5.31"), ) + BuildVersions.permutations( gradleVersions = listOf(*ifExhaustive("7.0", "6.1.1")), kotlinVersions = listOf(*ifExhaustive( "1.8.0", "1.7.0", "1.6.0", "1.5.0")) @@ -61,6 +61,7 @@ internal object TestedVersions { "1.8.20" to "18.2.0-pre.546", "1.9.0" to "18.2.0-pre.597", "1.9.10" to "18.2.0-pre.597", + "1.9.20-RC2" to "18.2.0-pre.635", ) } diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/WasmGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/WasmGradleIntegrationTest.kt index aa3a2278ce..4280459c76 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/WasmGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/WasmGradleIntegrationTest.kt @@ -20,7 +20,8 @@ internal class WasmTestedVersionsArgumentsProvider : AllSupportedTestedVersionsA override fun provideArguments(context: ExtensionContext?): Stream { return super.provideArguments(context).filter { val buildVersions = it.get().single() as BuildVersions - buildVersions.kotlinVersion >= "1.8.20" // 1.8.20 is the first public version that can be tested with wasm + buildVersions.kotlinVersion >= "1.8.20" && // 1.8.20 is the first public version that can be tested with wasm + buildVersions.kotlinVersion <= "1.9.10"// in 1.9.20 wasm target was split into `wasm-js` and `wasm-wasi` } } } diff --git a/integration-tests/maven/projects/it-maven/pom.xml b/integration-tests/maven/projects/it-maven/pom.xml index c426fb3605..3e20bf5395 100644 --- a/integration-tests/maven/projects/it-maven/pom.xml +++ b/integration-tests/maven/projects/it-maven/pom.xml @@ -11,7 +11,7 @@ 1.0-SNAPSHOT - 1.9.10 + 1.9.20-RC diff --git a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaJsResolverForModuleFactory.kt b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaJsResolverForModuleFactory.kt index 6957bcbf03..98f9c64a0e 100644 --- a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaJsResolverForModuleFactory.kt +++ b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaJsResolverForModuleFactory.kt @@ -44,7 +44,6 @@ internal class DokkaJsResolverForModuleFactory( metadataFactories.DefaultDescriptorFactory, metadataFactories.DefaultPackageFragmentsFactory, metadataFactories.flexibleTypeDeserializer, - metadataFactories.platformDependentTypeTransformer ) } diff --git a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaKlibMetadataCommonDependencyContainer.kt b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaKlibMetadataCommonDependencyContainer.kt index 8016683070..09f4e48a84 100644 --- a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaKlibMetadataCommonDependencyContainer.kt +++ b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaKlibMetadataCommonDependencyContainer.kt @@ -16,7 +16,6 @@ import org.jetbrains.kotlin.library.metadata.DeserializedKlibModuleOrigin import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.library.metadata.KlibMetadataFactories import org.jetbrains.kotlin.library.KotlinLibrary -import org.jetbrains.kotlin.library.metadata.NativeTypeTransformer import org.jetbrains.kotlin.library.metadata.NullFlexibleTypeDeserializer import org.jetbrains.kotlin.library.metadata.parseModuleHeader import org.jetbrains.kotlin.name.Name @@ -107,8 +106,7 @@ internal class DokkaKlibMetadataCommonDependencyContainer( KlibMetadataModuleDescriptorFactoryImpl( MetadataFactories.DefaultDescriptorFactory, MetadataFactories.DefaultPackageFragmentsFactory, - MetadataFactories.flexibleTypeDeserializer, - MetadataFactories.platformDependentTypeTransformer + MetadataFactories.flexibleTypeDeserializer ) } @@ -138,6 +136,5 @@ internal class DokkaKlibMetadataCommonDependencyContainer( private val MetadataFactories = KlibMetadataFactories( { DefaultBuiltIns.Instance }, - NullFlexibleTypeDeserializer, - NativeTypeTransformer() + NullFlexibleTypeDeserializer )