Remove 'noStdlib' from Gradle options

^KT-49011 Fixed
This commit is contained in:
Yahor Berdnikau
2022-01-28 15:59:33 +01:00
parent 57c342fec8
commit 52a21a4e1a
5 changed files with 9 additions and 21 deletions
@@ -47,8 +47,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-no-jdk", description = "Don't automatically include the Java runtime into the classpath") @Argument(value = "-no-jdk", description = "Don't automatically include the Java runtime into the classpath")
var noJdk: Boolean by FreezableVar(false) var noJdk: Boolean by FreezableVar(false)
@GradleDeprecatedOption(removeAfter = "1.6", level = DeprecationLevel.ERROR)
@GradleOption(DefaultValues.BooleanTrueDefault::class)
@Argument( @Argument(
value = "-no-stdlib", value = "-no-stdlib",
description = "Don't automatically include the Kotlin/JVM stdlib and Kotlin reflection into the classpath" description = "Don't automatically include the Kotlin/JVM stdlib and Kotlin reflection into the classpath"
@@ -256,6 +256,12 @@ private fun Printer.generateImpl(
for (property in properties) { for (property in properties) {
println("${property.name} = ${property.gradleDefaultValue}") println("${property.name} = ${property.gradleDefaultValue}")
} }
// Adding required 'noStdlib' and 'noReflect' compiler arguments for JVM compilation
// Otherwise compilation via build tools will fail
if (type.shortName().toString() == "KotlinJvmOptionsBase") {
println("noStdlib = true")
println("noReflect = true")
}
} }
println("}") println("}")
} }
@@ -37,13 +37,6 @@ interface KotlinJvmOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonOption
*/ */
var noJdk: kotlin.Boolean var noJdk: kotlin.Boolean
/**
* Don't automatically include the Kotlin/JVM stdlib and Kotlin reflection into the classpath
* Default value: true
*/
@Deprecated(message = "This option has no effect and will be removed in a future release.", level = DeprecationLevel.ERROR)
var noStdlib: kotlin.Boolean
/** /**
* Use the old JVM backend * Use the old JVM backend
* Default value: false * Default value: false
@@ -235,7 +235,7 @@ open class Kapt3IT : Kapt3BaseIT() {
gradleVersion, gradleVersion,
buildOptions = defaultBuildOptions.copy(incremental = false) buildOptions = defaultBuildOptions.copy(incremental = false)
) { ) {
build("build") { build("build", enableGradleDebug = true) {
assertTasksExecuted(":kaptGenerateStubsKotlin") assertTasksExecuted(":kaptGenerateStubsKotlin")
assertOutputDoesNotContain(USING_JVM_INCREMENTAL_COMPILATION_MESSAGE) assertOutputDoesNotContain(USING_JVM_INCREMENTAL_COMPILATION_MESSAGE)
} }
@@ -803,7 +803,7 @@ open class Kapt3IT : Kapt3BaseIT() {
} }
@DisplayName("Works with JPMS on JDK 9+") @DisplayName("Works with JPMS on JDK 9+")
@JdkVersions(versions = [JavaVersion.VERSION_1_9]) @JdkVersions(versions = [JavaVersion.VERSION_11])
@GradleWithJdkTest @GradleWithJdkTest
fun testJpmsModule( fun testJpmsModule(
gradleVersion: GradleVersion, gradleVersion: GradleVersion,
@@ -58,14 +58,6 @@ internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.K
noJdkField = value noJdkField = value
} }
private var noStdlibField: kotlin.Boolean? = null
@Deprecated(message = "This option has no effect and will be removed in a future release.", level = DeprecationLevel.ERROR)
override var noStdlib: kotlin.Boolean
get() = noStdlibField ?: true
set(value) {
noStdlibField = value
}
private var useOldBackendField: kotlin.Boolean? = null private var useOldBackendField: kotlin.Boolean? = null
override var useOldBackend: kotlin.Boolean override var useOldBackend: kotlin.Boolean
get() = useOldBackendField ?: false get() = useOldBackendField ?: false
@@ -85,7 +77,6 @@ internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.K
jvmTarget?.let { args.jvmTarget = it } jvmTarget?.let { args.jvmTarget = it }
moduleName?.let { args.moduleName = it } moduleName?.let { args.moduleName = it }
noJdkField?.let { args.noJdk = it } noJdkField?.let { args.noJdk = it }
noStdlibField?.let { args.noStdlib = it }
useOldBackendField?.let { args.useOldBackend = it } useOldBackendField?.let { args.useOldBackend = it }
} }
} }
@@ -102,7 +93,7 @@ internal fun org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments.fi
jvmTarget = null jvmTarget = null
moduleName = null moduleName = null
noJdk = false noJdk = false
useOldBackend = false
noStdlib = true noStdlib = true
noReflect = true noReflect = true
useOldBackend = false
} }