Remove experimental.coroutines DSL
And 'kotlin.coroutines' property as well. ^KT-50494 Fixed
This commit is contained in:
-18
@@ -9,8 +9,6 @@ package org.jetbrains.kotlin.gradle.dsl
|
||||
* DSL extension that is used to configure Kotlin options for the entire project.
|
||||
*/
|
||||
interface KotlinTopLevelExtensionConfig {
|
||||
val experimental: ExperimentalExtensionConfig
|
||||
|
||||
/**
|
||||
* Version of the core Kotlin libraries that are added to Kotlin compile classpath, unless there is already a dependency added to this
|
||||
* project. By default, this version is the same as the version of the used Kotlin Gradle plugin.
|
||||
@@ -33,10 +31,6 @@ interface KotlinTopLevelExtensionConfig {
|
||||
fun explicitApiWarning()
|
||||
}
|
||||
|
||||
interface ExperimentalExtensionConfig {
|
||||
var coroutines: Coroutines?
|
||||
}
|
||||
|
||||
/**
|
||||
* Different modes that can be used to set the level of issue reporting for [KotlinTopLevelExtensionConfig.explicitApi] option.
|
||||
*/
|
||||
@@ -52,15 +46,3 @@ enum class ExplicitApiMode(val cliOption: String) {
|
||||
|
||||
fun toCompilerArg() = "-Xexplicit-api=$cliOption"
|
||||
}
|
||||
|
||||
enum class Coroutines {
|
||||
ENABLE,
|
||||
WARN,
|
||||
ERROR,
|
||||
DEFAULT;
|
||||
|
||||
companion object {
|
||||
fun byCompilerArgument(argument: String): Coroutines? =
|
||||
values().firstOrNull { it.name.equals(argument, ignoreCase = true) }
|
||||
}
|
||||
}
|
||||
|
||||
-24
@@ -31,7 +31,6 @@ class KotlinProjectIT : KGPBaseTest() {
|
||||
"kotlinProject",
|
||||
defaultBuildOptions.kotlinVersion,
|
||||
KotlinProject.ProjectType.PLATFORM_JVM,
|
||||
"DEFAULT"
|
||||
)
|
||||
assertTrue(expectedByDependencies.isEmpty())
|
||||
|
||||
@@ -94,7 +93,6 @@ class KotlinProjectIT : KGPBaseTest() {
|
||||
"kotlinJavaProject",
|
||||
defaultBuildOptions.kotlinVersion,
|
||||
KotlinProject.ProjectType.PLATFORM_JVM,
|
||||
"DEFAULT"
|
||||
)
|
||||
|
||||
assertEquals(3, sourceSets.size)
|
||||
@@ -123,19 +121,16 @@ class KotlinProjectIT : KGPBaseTest() {
|
||||
"lib",
|
||||
defaultBuildOptions.kotlinVersion,
|
||||
KotlinProject.ProjectType.PLATFORM_COMMON,
|
||||
"DEFAULT"
|
||||
)
|
||||
libJsKotlinProject.assertBasics(
|
||||
"libJs",
|
||||
defaultBuildOptions.kotlinVersion,
|
||||
KotlinProject.ProjectType.PLATFORM_JS,
|
||||
"DEFAULT"
|
||||
)
|
||||
libJvmKotlinProject.assertBasics(
|
||||
"libJvm",
|
||||
defaultBuildOptions.kotlinVersion,
|
||||
KotlinProject.ProjectType.PLATFORM_JVM,
|
||||
"DEFAULT"
|
||||
)
|
||||
|
||||
assertEquals(1, libJsKotlinProject.expectedByDependencies.size)
|
||||
@@ -183,7 +178,6 @@ class KotlinProjectIT : KGPBaseTest() {
|
||||
"app",
|
||||
defaultBuildOptions.kotlinVersion,
|
||||
KotlinProject.ProjectType.PLATFORM_JVM,
|
||||
"DEFAULT"
|
||||
)
|
||||
|
||||
assertTrue(expectedByDependencies.isEmpty())
|
||||
@@ -316,35 +310,17 @@ class KotlinProjectIT : KGPBaseTest() {
|
||||
assertNotEquals(0, compilerArguments.defaultArguments.size)
|
||||
}
|
||||
|
||||
|
||||
@DisplayName("Project with coroutines dsl enabled has valid model")
|
||||
@GradleTest
|
||||
fun testCoroutinesProjectDSL(gradleVersion: GradleVersion) {
|
||||
project("coroutinesProjectDSL", gradleVersion) {
|
||||
getModels<KotlinProject> {
|
||||
getModel(":")!!.assertBasics(
|
||||
"coroutinesProjectDSL",
|
||||
defaultBuildOptions.kotlinVersion,
|
||||
KotlinProject.ProjectType.PLATFORM_JVM,
|
||||
"ENABLE"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private fun KotlinProject.assertBasics(
|
||||
expectedName: String,
|
||||
expectedKotlinVersion: String,
|
||||
expectedProjectType: KotlinProject.ProjectType,
|
||||
expectedCoroutines: String
|
||||
) {
|
||||
assertEquals(1L, modelVersion)
|
||||
assertEquals(expectedName, name)
|
||||
assertEquals(expectedKotlinVersion, kotlinVersion)
|
||||
assertEquals(expectedProjectType, projectType)
|
||||
assertEquals(expectedCoroutines, experimentalFeatures.coroutines)
|
||||
}
|
||||
|
||||
private fun SourceSet.assertBasics(
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "kotlin"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
experimental {
|
||||
coroutines 'enable'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m
|
||||
-1
@@ -1 +0,0 @@
|
||||
suspend fun <T> suspendCoroutine(): T = TODO()
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 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 org.jetbrains.kotlin.gradle.model
|
||||
|
||||
/**
|
||||
* Wraps all experimental features information for a given Kotlin project.
|
||||
* @see KotlinProject
|
||||
*/
|
||||
interface ExperimentalFeatures {
|
||||
|
||||
/**
|
||||
* Return coroutines string.
|
||||
*
|
||||
* @return coroutines.
|
||||
*/
|
||||
val coroutines: String?
|
||||
}
|
||||
-7
@@ -68,11 +68,4 @@ interface KotlinProject {
|
||||
* @return expectedBy dependencies.
|
||||
*/
|
||||
val expectedByDependencies: Collection<String>
|
||||
|
||||
/**
|
||||
* Return an object containing a descriptor of the experimental features.
|
||||
*
|
||||
* @return experimental features.
|
||||
*/
|
||||
val experimentalFeatures: ExperimentalFeatures
|
||||
}
|
||||
-22
@@ -64,12 +64,6 @@ internal val Project.pm20Extension: KotlinPm20ProjectExtension
|
||||
|
||||
abstract class KotlinTopLevelExtension(internal val project: Project) : KotlinTopLevelExtensionConfig {
|
||||
|
||||
override val experimental: ExperimentalExtension = project.objects.newInstance(ExperimentalExtension::class.java, project)
|
||||
|
||||
fun experimental(action: Action<ExperimentalExtension>) {
|
||||
action.execute(this.experimental)
|
||||
}
|
||||
|
||||
override lateinit var coreLibrariesVersion: String
|
||||
|
||||
private val toolchainSupport = ToolchainSupport.createToolchain(project)
|
||||
@@ -301,22 +295,6 @@ open class KotlinAndroidProjectExtension(project: Project) : KotlinSingleTargetE
|
||||
open fun target(body: KotlinAndroidTarget.() -> Unit) = target.run(body)
|
||||
}
|
||||
|
||||
open class ExperimentalExtension @Inject constructor(
|
||||
private val project: Project
|
||||
) : ExperimentalExtensionConfig {
|
||||
override var coroutines: Coroutines? = null
|
||||
set(value) {
|
||||
SingleWarningPerBuild.show(
|
||||
project,
|
||||
"""
|
||||
'kotlin.experimental.coroutines' option does nothing since 1.5.0 release
|
||||
and scheduled to be removed in Kotlin 1.7.0 release!
|
||||
""".trimIndent()
|
||||
)
|
||||
field = value
|
||||
}
|
||||
}
|
||||
|
||||
enum class NativeCacheKind(val produce: String?, val outputKind: CompilerOutputKind?) {
|
||||
NONE(null, null),
|
||||
DYNAMIC("dynamic_cache", CompilerOutputKind.DYNAMIC_CACHE),
|
||||
|
||||
-1
@@ -43,7 +43,6 @@ internal open class AbstractKotlinCompileArgumentsContributor<T : CommonCompiler
|
||||
taskProvider: KotlinCompileArgumentsProvider<out AbstractKotlinCompile<T>>
|
||||
) : CompilerArgumentsContributor<T> {
|
||||
|
||||
private val coroutines = taskProvider.coroutines
|
||||
protected val logger = taskProvider.logger
|
||||
private val isMultiplatform = taskProvider.isMultiplatform
|
||||
private val pluginClasspath = taskProvider.pluginClasspath
|
||||
|
||||
-7
@@ -11,11 +11,9 @@ import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.tooling.provider.model.ToolingModelBuilder
|
||||
import org.jetbrains.kotlin.gradle.model.CompilerArguments
|
||||
import org.jetbrains.kotlin.gradle.model.ExperimentalFeatures
|
||||
import org.jetbrains.kotlin.gradle.model.KotlinProject
|
||||
import org.jetbrains.kotlin.gradle.model.SourceSet
|
||||
import org.jetbrains.kotlin.gradle.model.impl.CompilerArgumentsImpl
|
||||
import org.jetbrains.kotlin.gradle.model.impl.ExperimentalFeaturesImpl
|
||||
import org.jetbrains.kotlin.gradle.model.impl.KotlinProjectImpl
|
||||
import org.jetbrains.kotlin.gradle.model.impl.SourceSetImpl
|
||||
import org.jetbrains.kotlin.gradle.plugin.*
|
||||
@@ -47,7 +45,6 @@ class KotlinModelBuilder(private val kotlinPluginVersion: String, private val an
|
||||
if (androidTarget != null) it.createAndroidSourceSet(androidTarget) else it.createSourceSet(project, projectType)
|
||||
},
|
||||
getExpectedByDependencies(project),
|
||||
kotlinCompileTasks.first()!!.createExperimentalFeatures()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -129,9 +126,5 @@ class KotlinModelBuilder(private val kotlinPluginVersion: String, private val an
|
||||
libraries.toList()
|
||||
)
|
||||
}
|
||||
|
||||
private fun AbstractKotlinCompile<*>.createExperimentalFeatures(): ExperimentalFeatures {
|
||||
return ExperimentalFeaturesImpl(coroutines.get().name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 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 org.jetbrains.kotlin.gradle.model.impl
|
||||
|
||||
import org.jetbrains.kotlin.gradle.model.ExperimentalFeatures
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* Implementation of the [ExperimentalFeatures] interface.
|
||||
*/
|
||||
data class ExperimentalFeaturesImpl(
|
||||
override val coroutines: String?
|
||||
) : ExperimentalFeatures, Serializable {
|
||||
|
||||
companion object {
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
-2
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.model.impl
|
||||
|
||||
import org.jetbrains.kotlin.gradle.model.ExperimentalFeatures
|
||||
import org.jetbrains.kotlin.gradle.model.KotlinProject
|
||||
import org.jetbrains.kotlin.gradle.model.SourceSet
|
||||
import java.io.Serializable
|
||||
@@ -19,7 +18,6 @@ data class KotlinProjectImpl(
|
||||
override val projectType: KotlinProject.ProjectType,
|
||||
override val sourceSets: Collection<SourceSet>,
|
||||
override val expectedByDependencies: Collection<String>,
|
||||
override val experimentalFeatures: ExperimentalFeatures
|
||||
) : KotlinProject, Serializable {
|
||||
|
||||
override val modelVersion = serialVersionUID
|
||||
|
||||
-16
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.gradle.plugin
|
||||
import org.gradle.api.Project
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.toBooleanLenient
|
||||
import org.jetbrains.kotlin.gradle.dsl.Coroutines
|
||||
import org.jetbrains.kotlin.gradle.dsl.NativeCacheKind
|
||||
import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessageOutputStreamHandler.Companion.IGNORE_TCSM_OVERFLOW
|
||||
import org.jetbrains.kotlin.gradle.plugin.Kotlin2JsPlugin.Companion.NOWARN_2JS_FLAG
|
||||
@@ -81,21 +80,6 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
}
|
||||
}
|
||||
|
||||
val coroutines: Coroutines?
|
||||
get() {
|
||||
val propValue = property("kotlin.coroutines")?.let { Coroutines.byCompilerArgument(it) }
|
||||
if (propValue != null) {
|
||||
SingleWarningPerBuild.show(
|
||||
project,
|
||||
"""
|
||||
'kotlin.coroutines' property does nothing since 1.5.0 release
|
||||
and scheduled to be removed in Kotlin 1.7.0 release!
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
return propValue
|
||||
}
|
||||
|
||||
val singleBuildMetricsFile: File?
|
||||
get() = property("kotlin.internal.single.build.metrics.file")?.let { File(it) }
|
||||
|
||||
|
||||
-12
@@ -273,13 +273,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments> @Inject constr
|
||||
}
|
||||
task.moduleName.set(project.provider { compilation.moduleName })
|
||||
task.sourceSetName.set(project.provider { compilation.compilationPurpose })
|
||||
task.coroutines.value(
|
||||
project.provider {
|
||||
project.extensions.findByType(KotlinTopLevelExtension::class.java)!!.experimental.coroutines
|
||||
?: PropertiesProvider(project).coroutines
|
||||
?: Coroutines.DEFAULT
|
||||
}
|
||||
).disallowChanges()
|
||||
task.multiPlatformEnabled.value(
|
||||
project.provider {
|
||||
project.plugins.any { it is KotlinPlatformPluginBase || it is KotlinMultiplatformPluginWrapper || it is KotlinPm20PluginWrapper }
|
||||
@@ -367,10 +360,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments> @Inject constr
|
||||
// TODO: replace with objects.property and introduce task configurator
|
||||
internal var kotlinPluginData: Provider<KotlinCompilerPluginData>? = null
|
||||
|
||||
// Input is needed to force rebuild even if source files are not changed
|
||||
@get:Input
|
||||
internal val coroutines: Property<Coroutines> = objectFactory.property(Coroutines::class.java)
|
||||
|
||||
@get:Internal
|
||||
internal val javaOutputDir: DirectoryProperty = objectFactory.directoryProperty()
|
||||
|
||||
@@ -571,7 +560,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments> @Inject constr
|
||||
|
||||
open class KotlinCompileArgumentsProvider<T : AbstractKotlinCompile<out CommonCompilerArguments>>(taskProvider: T) {
|
||||
|
||||
val coroutines: Provider<Coroutines> = taskProvider.coroutines
|
||||
val logger: Logger = taskProvider.logger
|
||||
val isMultiplatform: Boolean = taskProvider.multiPlatformEnabled.get()
|
||||
private val pluginData = taskProvider.kotlinPluginData?.orNull
|
||||
|
||||
Reference in New Issue
Block a user