diff --git a/.space/CODEOWNERS b/.space/CODEOWNERS index 65dc5cf1b3769..e8db052ba5aa6 100644 --- a/.space/CODEOWNERS +++ b/.space/CODEOWNERS @@ -277,6 +277,7 @@ /libraries/tools/binary-compatibility-validator/ "Kotlin Libraries" /libraries/tools/dukat/ "Kotlin JS" /libraries/kotlin-dom-api-compat/ "Kotlin JS" +/libraries/tools/kotlin-build-tools-enum-compat/ "Kotlin Build Tools" /libraries/tools/gradle/ "Kotlin Build Tools" /libraries/tools/kotlin-allopen/ "Kotlin Build Tools" /libraries/tools/kotlin-annotations-jvm/ "Kotlin Libraries" diff --git a/build-common/build.gradle.kts b/build-common/build.gradle.kts index f113a7d2a5fab..91af78ef459dd 100644 --- a/build-common/build.gradle.kts +++ b/build-common/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion as GradleKotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - description = "Kotlin Build Common" plugins { @@ -50,10 +47,3 @@ projectTest(parallel = true) projectTest("testJUnit5", jUnitMode = JUnitMode.JUnit5, parallel = true) { useJUnitPlatform() } - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(GradleKotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(GradleKotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} diff --git a/build.gradle.kts b/build.gradle.kts index 9b2dc4dd0519f..fccf9d69e2451 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -230,6 +230,7 @@ extra["compilerModules"] = // They are embedded just because we don't publish those dependencies as separate Maven artifacts (yet) extra["kotlinJpsPluginEmbeddedDependencies"] = listOf( ":compiler:cli-common", + ":kotlin-build-tools-enum-compat", ":kotlin-compiler-runner-unshaded", ":daemon-common", ":core:compiler.common", diff --git a/buildSrc/src/main/kotlin/GradleCommon.kt b/buildSrc/src/main/kotlin/GradleCommon.kt index 0e5076497cbeb..6a79f8f249a44 100644 --- a/buildSrc/src/main/kotlin/GradleCommon.kt +++ b/buildSrc/src/main/kotlin/GradleCommon.kt @@ -13,7 +13,6 @@ import org.gradle.api.attributes.* import org.gradle.api.attributes.java.TargetJvmEnvironment import org.gradle.api.attributes.java.TargetJvmVersion import org.gradle.api.attributes.plugin.GradlePluginApiVersion -import org.gradle.api.file.FileCollection import org.gradle.api.component.AdhocComponentWithVariants import org.gradle.api.plugins.JavaLibraryPlugin import org.gradle.api.plugins.JavaPlugin @@ -31,12 +30,10 @@ import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.dokka.gradle.GradleExternalDocumentationLinkBuilder import org.jetbrains.kotlin.gradle.dsl.KotlinSingleJavaTargetExtension import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType -import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import plugins.configureDefaultPublishing import plugins.configureKotlinPomAttributes import java.net.URL -import java.util.* /** * Gradle's plugins common variants. @@ -251,6 +248,7 @@ fun Project.wireGradleVariantToCommonGradleVariant( from(wireSourceSet.output, commonSourceSet.output) setupPublicJar(archiveBaseName.get()) addEmbeddedRuntime() + addEmbeddedRuntime(wireSourceSet.embeddedConfigurationName) } else if (name == wireSourceSet.sourcesJarTaskName) { from(wireSourceSet.allSource, commonSourceSet.allSource) } @@ -302,6 +300,15 @@ fun Project.reconfigureMainSourcesSetForGradlePlugin( withJavadocJar() } } + + configurations.create(sourceSets.getByName("main").embeddedConfigurationName) { + isCanBeConsumed = false + isCanBeResolved = true + attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) + attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR)) + } + } } // Workaround for https://youtrack.jetbrains.com/issue/KT-52987 @@ -423,10 +430,20 @@ fun Project.createGradlePluginVariant( configurations.named(variantSourceSet.apiElementsConfigurationName, commonVariantAttributes()) configurations.named(variantSourceSet.runtimeElementsConfigurationName, commonVariantAttributes()) + + configurations.create(variantSourceSet.embeddedConfigurationName) { + isCanBeConsumed = false + isCanBeResolved = true + attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) + attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR)) + } + } } tasks.named(variantSourceSet.sourcesJarTaskName) { addEmbeddedSources() + addEmbeddedSources(variantSourceSet.embeddedConfigurationName) } } @@ -513,6 +530,7 @@ fun Project.publishShadowedJar( jarTask.flatMap { it.archiveClassifier } ) addEmbeddedRuntime() + addEmbeddedRuntime(sourceSet.embeddedConfigurationName) from(sourceSet.output) from(commonSourceSet.output) @@ -701,3 +719,5 @@ private fun GradleExternalDocumentationLinkBuilder.addWorkaroundForElementList(p packageListUrl.set(URL("${pluginVariant.gradleApiJavadocUrl}element-list")) } } + +private val SourceSet.embeddedConfigurationName get() = "${name}Embedded" diff --git a/buildSrc/src/main/kotlin/artifacts.kt b/buildSrc/src/main/kotlin/artifacts.kt index 3329be75fa7bb..e4ccc581fb69c 100644 --- a/buildSrc/src/main/kotlin/artifacts.kt +++ b/buildSrc/src/main/kotlin/artifacts.kt @@ -73,8 +73,9 @@ fun Project.noDefaultJar() { configurations.named("archives", removeJarTaskArtifact(jarTask)) } -fun Jar.addEmbeddedRuntime() { - project.configurations.findByName("embedded")?.let { embedded -> +@JvmOverloads +fun Jar.addEmbeddedRuntime(embeddedConfigurationName: String = "embedded") { + project.configurations.findByName(embeddedConfigurationName)?.let { embedded -> dependsOn(embedded) val archiveOperations = project.serviceOf() from { @@ -203,8 +204,9 @@ fun Project.sourcesJarWithSourcesFromEmbedded( return sourcesJarTask } -fun Jar.addEmbeddedSources() { - project.configurations.findByName("embedded")?.let { embedded -> +@JvmOverloads +fun Jar.addEmbeddedSources(configurationName: String = "embedded") { + project.configurations.findByName(configurationName)?.let { embedded -> val allSources by lazy { embedded.resolvedConfiguration .resolvedArtifacts diff --git a/compiler/cli/cli-common/build.gradle.kts b/compiler/cli/cli-common/build.gradle.kts index 01db8a3d5f5e8..550cd181f1dc6 100644 --- a/compiler/cli/cli-common/build.gradle.kts +++ b/compiler/cli/cli-common/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - plugins { kotlin("jvm") id("jps-compatible") @@ -33,10 +30,3 @@ tasks.getByName("jar") { //excludes unused bunch files exclude("META-INF/extensions/*.xml.**") } - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} diff --git a/compiler/config.jvm/build.gradle.kts b/compiler/config.jvm/build.gradle.kts index c8564261562f3..52e0265427c6a 100644 --- a/compiler/config.jvm/build.gradle.kts +++ b/compiler/config.jvm/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - plugins { kotlin("jvm") id("jps-compatible") @@ -16,10 +13,3 @@ sourceSets { "main" { projectDefault() } "test" { } } - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} diff --git a/compiler/daemon/daemon-common/build.gradle.kts b/compiler/daemon/daemon-common/build.gradle.kts index 1efee8c06f61d..5770ecee21ac8 100644 --- a/compiler/daemon/daemon-common/build.gradle.kts +++ b/compiler/daemon/daemon-common/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - plugins { kotlin("jvm") id("jps-compatible") @@ -16,11 +13,3 @@ sourceSets { "main" { projectDefault() } "test" {} } - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} - diff --git a/compiler/frontend.common/build.gradle.kts b/compiler/frontend.common/build.gradle.kts index ce2f074fabef6..179df840a88d6 100644 --- a/compiler/frontend.common/build.gradle.kts +++ b/compiler/frontend.common/build.gradle.kts @@ -1,7 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - - plugins { kotlin("jvm") id("jps-compatible") @@ -18,10 +14,3 @@ sourceSets { "main" { projectDefault() } "test" {} } - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} diff --git a/compiler/incremental-compilation-impl/build.gradle.kts b/compiler/incremental-compilation-impl/build.gradle.kts index e804f16fa236e..a20ed6f4733c9 100644 --- a/compiler/incremental-compilation-impl/build.gradle.kts +++ b/compiler/incremental-compilation-impl/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - plugins { kotlin("jvm") id("jps-compatible") @@ -56,10 +53,3 @@ projectTest("testJvmICWithJdk11", parallel = true) { } testsJar() - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} diff --git a/compiler/util/build.gradle.kts b/compiler/util/build.gradle.kts index 835a9f7ce696d..bfe49e7021457 100644 --- a/compiler/util/build.gradle.kts +++ b/compiler/util/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion as GradleKotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - plugins { kotlin("jvm") id("jps-compatible") @@ -24,10 +21,3 @@ sourceSets { } "test" {} } - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(GradleKotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(GradleKotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} diff --git a/core/deserialization.common.jvm/build.gradle.kts b/core/deserialization.common.jvm/build.gradle.kts index 9f2a00ba503f4..b028bc4d89e17 100644 --- a/core/deserialization.common.jvm/build.gradle.kts +++ b/core/deserialization.common.jvm/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - plugins { kotlin("jvm") id("jps-compatible") @@ -18,10 +15,3 @@ sourceSets { "main" { projectDefault() } "test" {} } - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} diff --git a/core/util.runtime/build.gradle.kts b/core/util.runtime/build.gradle.kts index 49345040c2625..75d285f5606bb 100644 --- a/core/util.runtime/build.gradle.kts +++ b/core/util.runtime/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - plugins { kotlin("jvm") id("jps-compatible") @@ -16,10 +13,3 @@ sourceSets { "main" { projectDefault() } "test" {} } - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 3b0487ed9e530..36f85c75ce39b 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -17,6 +17,7 @@ + diff --git a/jps/jps-common/build.gradle.kts b/jps/jps-common/build.gradle.kts index 39cf0a4e3d9d6..9ff10c5ee9aca 100644 --- a/jps/jps-common/build.gradle.kts +++ b/jps/jps-common/build.gradle.kts @@ -48,4 +48,4 @@ runtimeJar() tasks.withType>().configureEach { compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} \ No newline at end of file +} diff --git a/libraries/scripting/common/build.gradle.kts b/libraries/scripting/common/build.gradle.kts index 423721cd0ba9c..ddabe603dfbc2 100644 --- a/libraries/scripting/common/build.gradle.kts +++ b/libraries/scripting/common/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - plugins { kotlin("jvm") id("jps-compatible") @@ -30,10 +27,3 @@ publish() runtimeJar() sourcesJar() javadocJar() - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} diff --git a/libraries/tools/kotlin-build-tools-enum-compat/Readme.md b/libraries/tools/kotlin-build-tools-enum-compat/Readme.md new file mode 100644 index 0000000000000..8e34ea7e5a18e --- /dev/null +++ b/libraries/tools/kotlin-build-tools-enum-compat/Readme.md @@ -0,0 +1,7 @@ +## Description + +Backport of `EnumEntries` runtime support API ([KT-48872](https://youtrack.jetbrains.com/issue/KT-48872)) + +This should help with the case when code was compiled using newer `kotlin-stdlib` version as a `compileOnly` dependency, but at a runtime +older version of `kotlin-stdlib` is provided ([KT-57317](https://youtrack.jetbrains.com/issue/KT-57317)). Mostly it is needed for Kotlin +build tools artifacts. \ No newline at end of file diff --git a/libraries/tools/kotlin-build-tools-enum-compat/build.gradle.kts b/libraries/tools/kotlin-build-tools-enum-compat/build.gradle.kts new file mode 100644 index 0000000000000..e127997ebc9ba --- /dev/null +++ b/libraries/tools/kotlin-build-tools-enum-compat/build.gradle.kts @@ -0,0 +1,17 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile + +plugins { + id("org.jetbrains.kotlin.jvm") + id("jps-compatible") +} + +configureKotlinCompileTasksGradleCompatibility() +extensions.extraProperties["kotlin.stdlib.default.dependency"] = "false" + +dependencies { + compileOnly(project(":kotlin-stdlib")) +} + +tasks.withType().configureEach { + compilerOptions.freeCompilerArgs.add("-Xallow-kotlin-package") +} diff --git a/libraries/tools/kotlin-build-tools-enum-compat/src/main/kotlin/kotlin/enums/EnumEntries.kt b/libraries/tools/kotlin-build-tools-enum-compat/src/main/kotlin/kotlin/enums/EnumEntries.kt new file mode 100644 index 0000000000000..55c6eb15de92a --- /dev/null +++ b/libraries/tools/kotlin-build-tools-enum-compat/src/main/kotlin/kotlin/enums/EnumEntries.kt @@ -0,0 +1,79 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package kotlin.enums + +import java.io.Serializable + +/** + * A specialized immutable implementation of [List] interface that + * contains all enum entries of the specified enum type [E]. + * [EnumEntries] contains all enum entries in the order they are declared in the source code, + * consistently with the corresponding [Enum.ordinal] values. + * + * An instance of this interface can only be obtained from `EnumClass.entries` property. + */ +@ExperimentalStdlibApi +interface EnumEntries> : List + +@Suppress("unused") +@PublishedApi +@ExperimentalStdlibApi +internal fun > enumEntries(entriesProvider: () -> Array): EnumEntries = EnumEntriesList(entriesProvider()) + +@PublishedApi +@ExperimentalStdlibApi +internal fun > enumEntries(entries: Array): EnumEntries = EnumEntriesList(entries) + +@ExperimentalStdlibApi +private class EnumEntriesList>(private val entries: Array) : EnumEntries, AbstractList(), Serializable { +// WA for JS IR bug: +// class type parameter name MUST be different from E (AbstractList type parameter), +// otherwise the bridge names for contains() and indexOf() will be clashed with the original method names, +// and produced JS code will not contain type checks and will not work correctly. + + override val size: Int + get() = entries.size + + override fun get(index: Int): T { + checkElementIndex(index, entries.size) + return entries[index] + } + + // Ported from kotlin-stdlib-common AbstractList.kt + private fun checkElementIndex(index: Int, size: Int) { + if (index < 0 || index >= size) { + throw IndexOutOfBoundsException("index: $index, size: $size") + } + } + + // By definition, EnumEntries contains **all** enums in declaration order, + // thus we are able to short-circuit the implementation here + + override fun contains(element: T): Boolean { + @Suppress("SENSELESS_COMPARISON") + if (element === null) return false // WA for JS IR bug + // Check identity due to UnsafeVariance + val target = entries.getOrNull(element.ordinal) + return target === element + } + + override fun indexOf(element: T): Int { + @Suppress("SENSELESS_COMPARISON") + if (element === null) return -1 // WA for JS IR bug + // Check identity due to UnsafeVariance + val ordinal = element.ordinal + val target = entries.getOrNull(ordinal) + return if (target === element) ordinal else -1 + } + + override fun lastIndexOf(element: T): Int = indexOf(element) + + @Suppress("unused") + private fun writeReplace(): Any { + // Used for Java serialization: EESP ensures that deserialized object **always** reflects the state of the enum on the target classpath + return EnumEntriesSerializationProxy(entries) + } +} diff --git a/libraries/tools/kotlin-build-tools-enum-compat/src/main/kotlin/kotlin/enums/EnumEntriesSerializationProxy.kt b/libraries/tools/kotlin-build-tools-enum-compat/src/main/kotlin/kotlin/enums/EnumEntriesSerializationProxy.kt new file mode 100644 index 0000000000000..8abf5bfac9cee --- /dev/null +++ b/libraries/tools/kotlin-build-tools-enum-compat/src/main/kotlin/kotlin/enums/EnumEntriesSerializationProxy.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +@file:Suppress("EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE") // for building kotlin-stdlib-jvm-minimal-for-test + +package kotlin.enums + +import java.io.Serializable + +@Suppress("UNCHECKED_CAST", "unused") +internal class EnumEntriesSerializationProxy>(entries: Array) : Serializable { + private val c: Class = entries.javaClass.componentType!! as Class + + private companion object { + private const val serialVersionUID: Long = 0L + } + + @OptIn(ExperimentalStdlibApi::class) + private fun readResolve(): Any { + return enumEntries(c.enumConstants) + } +} diff --git a/libraries/tools/kotlin-gradle-plugin/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin/build.gradle.kts index 9c82d8bca8642..9e6aa31cb12ec 100644 --- a/libraries/tools/kotlin-gradle-plugin/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin/build.gradle.kts @@ -89,6 +89,14 @@ dependencies { exclude(group = "*") } + // Adding workaround KT-57317 for Gradle versions where Kotlin runtime <1.8.0 + mainEmbedded(project(":kotlin-build-tools-enum-compat")) + gradle70Embedded(project(":kotlin-build-tools-enum-compat")) + gradle71Embedded(project(":kotlin-build-tools-enum-compat")) + gradle74Embedded(project(":kotlin-build-tools-enum-compat")) + gradle75Embedded(project(":kotlin-build-tools-enum-compat")) + gradle76Embedded(project(":kotlin-build-tools-enum-compat")) + testCompileOnly(project(":compiler")) testCompileOnly(project(":kotlin-annotation-processing")) diff --git a/native/commonizer-api/build.gradle.kts b/native/commonizer-api/build.gradle.kts index c42a4cd39861f..1d4b96a6d2c99 100644 --- a/native/commonizer-api/build.gradle.kts +++ b/native/commonizer-api/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - plugins { kotlin("jvm") } @@ -39,10 +36,3 @@ projectTest(parallel = false) { runtimeJar() sourcesJar() javadocJar() - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} diff --git a/plugins/pill/pill-importer/build.gradle.kts b/plugins/pill/pill-importer/build.gradle.kts index b6542cfc5fbe9..09a4589b88019 100644 --- a/plugins/pill/pill-importer/build.gradle.kts +++ b/plugins/pill/pill-importer/build.gradle.kts @@ -51,10 +51,3 @@ val unpill by tasks.creating { dependsOn(jar) doLast { runPillTask("unpill") } } - -// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872) -tasks.withType>().configureEach { - compilerOptions.apiVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() - compilerOptions.languageVersion.value(KotlinVersion.KOTLIN_1_8).finalizeValueOnRead() -} - diff --git a/prepare/kotlin-jps-plugin/build.gradle.kts b/prepare/kotlin-jps-plugin/build.gradle.kts index afd14965b78c9..0034f180220d1 100644 --- a/prepare/kotlin-jps-plugin/build.gradle.kts +++ b/prepare/kotlin-jps-plugin/build.gradle.kts @@ -16,4 +16,7 @@ dependencies { @Suppress("UNCHECKED_CAST") val embeddedDependencies = rootProject.extra["kotlinJpsPluginEmbeddedDependencies"] as List -publishProjectJars(embeddedDependencies + listOf(":jps:jps-plugin", ":jps:jps-common"), libraryDependencies = listOf(protobufFull())) +publishProjectJars( + embeddedDependencies + listOf(":jps:jps-plugin", ":jps:jps-common"), + libraryDependencies = listOf(protobufFull()) +) diff --git a/settings.gradle b/settings.gradle index 8b51c7d68ea36..01b1fb38de8a1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -185,6 +185,7 @@ include ":kotlin-imports-dumper-compiler-plugin", ":generators:ide-iml-to-gradle-generator", ":generators:test-generator", ":tools:kotlinp", + ":kotlin-build-tools-enum-compat", ":kotlin-project-model", ":kotlin-project-model-tests-generator", ":kotlin-gradle-compiler-types", @@ -710,6 +711,7 @@ project(':kotlin-assignment-compiler-plugin.cli').projectDir = "$rootDir/plugins project(':kotlin-assignment-compiler-plugin.embeddable').projectDir = "$rootDir/plugins/assign-plugin/assign-plugin.embeddable" as File project(':tools:kotlinp').projectDir = "$rootDir/libraries/tools/kotlinp" as File +project(":kotlin-build-tools-enum-compat").projectDir = "$rootDir/libraries/tools/kotlin-build-tools-enum-compat" as File project(':kotlin-project-model').projectDir = "$rootDir/libraries/tools/kotlin-project-model" as File project(':kotlin-project-model-tests-generator').projectDir = "$rootDir/libraries/tools/kotlin-project-model-tests-generator" as File project(':kotlin-gradle-compiler-types').projectDir = "$rootDir/libraries/tools/kotlin-gradle-compiler-types" as File