[CLI, Gradle] Fix GradleDeprecatedOption.removeAfter processing
The expected format was Kotlin language version (e.g. `2.0`), however the actual passed values were Kotlin release versions (e.g. `2.0.0`) ^KT-65986 In Progress
This commit is contained in:
committed by
Space Team
parent
83a9ac62ea
commit
d20f31e963
+1
-1
@@ -454,7 +454,7 @@ They should be a subset of sources passed as free arguments."""
|
|||||||
@GradleDeprecatedOption(
|
@GradleDeprecatedOption(
|
||||||
message = "Compiler flag -Xuse-k2 is deprecated; please use language version 2.0 instead",
|
message = "Compiler flag -Xuse-k2 is deprecated; please use language version 2.0 instead",
|
||||||
level = DeprecationLevel.WARNING,
|
level = DeprecationLevel.WARNING,
|
||||||
removeAfter = "2.0.0",
|
removeAfter = LanguageVersion.KOTLIN_2_0,
|
||||||
)
|
)
|
||||||
@GradleOption(
|
@GradleOption(
|
||||||
DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
DefaultValue.BOOLEAN_FALSE_DEFAULT,
|
||||||
|
|||||||
+3
-1
@@ -5,9 +5,11 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.cli.common.arguments
|
package org.jetbrains.kotlin.cli.common.arguments
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.config.LanguageVersion
|
||||||
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
annotation class GradleDeprecatedOption(
|
annotation class GradleDeprecatedOption(
|
||||||
val message: String = "This option has no effect and will be removed in a future release.",
|
val message: String = "This option has no effect and will be removed in a future release.",
|
||||||
val removeAfter: String,
|
val removeAfter: LanguageVersion,
|
||||||
val level: DeprecationLevel
|
val level: DeprecationLevel
|
||||||
)
|
)
|
||||||
+2
-2
@@ -51,7 +51,7 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
|||||||
@GradleDeprecatedOption(
|
@GradleDeprecatedOption(
|
||||||
message = "Only for legacy backend.",
|
message = "Only for legacy backend.",
|
||||||
level = DeprecationLevel.WARNING,
|
level = DeprecationLevel.WARNING,
|
||||||
removeAfter = "2.0.0"
|
removeAfter = LanguageVersion.KOTLIN_2_0,
|
||||||
)
|
)
|
||||||
@Argument(value = "-no-stdlib", description = "Don't automatically include the default Kotlin/JS stdlib in compilation dependencies.")
|
@Argument(value = "-no-stdlib", description = "Don't automatically include the default Kotlin/JS stdlib in compilation dependencies.")
|
||||||
var noStdlib = false
|
var noStdlib = false
|
||||||
@@ -151,7 +151,7 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
|||||||
@GradleDeprecatedOption(
|
@GradleDeprecatedOption(
|
||||||
message = "Only for legacy backend.",
|
message = "Only for legacy backend.",
|
||||||
level = DeprecationLevel.WARNING,
|
level = DeprecationLevel.WARNING,
|
||||||
removeAfter = "2.0.0"
|
removeAfter = LanguageVersion.KOTLIN_2_0,
|
||||||
)
|
)
|
||||||
@Deprecated("It is senseless to use with IR compiler. Only for compatibility.")
|
@Deprecated("It is senseless to use with IR compiler. Only for compatibility.")
|
||||||
@Argument(value = "-meta-info", description = "Generate .meta.js and .kjsm files with metadata. Use this to create a library.")
|
@Argument(value = "-meta-info", description = "Generate .meta.js and .kjsm files with metadata. Use this to create a library.")
|
||||||
|
|||||||
+2
-1
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.cli.common.arguments
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.DevModeOverwritingStrategies.ALL
|
import org.jetbrains.kotlin.cli.common.arguments.DevModeOverwritingStrategies.ALL
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.DevModeOverwritingStrategies.OLDER
|
import org.jetbrains.kotlin.cli.common.arguments.DevModeOverwritingStrategies.OLDER
|
||||||
|
import org.jetbrains.kotlin.config.LanguageVersion
|
||||||
|
|
||||||
class K2JSDceArguments : CommonToolArguments() {
|
class K2JSDceArguments : CommonToolArguments() {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -21,7 +22,7 @@ class K2JSDceArguments : CommonToolArguments() {
|
|||||||
@GradleDeprecatedOption(
|
@GradleDeprecatedOption(
|
||||||
message = "Use task 'destinationDirectory' to configure output directory",
|
message = "Use task 'destinationDirectory' to configure output directory",
|
||||||
level = DeprecationLevel.WARNING,
|
level = DeprecationLevel.WARNING,
|
||||||
removeAfter = "1.9.0"
|
removeAfter = LanguageVersion.KOTLIN_1_9,
|
||||||
)
|
)
|
||||||
@Argument(
|
@Argument(
|
||||||
value = "-output-dir",
|
value = "-output-dir",
|
||||||
|
|||||||
@@ -611,8 +611,7 @@ private fun generateMultiplatformCommonOptionsImpl(
|
|||||||
|
|
||||||
private inline fun <reified T : Any> List<KProperty1<T, *>>.filterToBeDeleted() = filter { prop ->
|
private inline fun <reified T : Any> List<KProperty1<T, *>>.filterToBeDeleted() = filter { prop ->
|
||||||
prop.findAnnotation<GradleDeprecatedOption>()
|
prop.findAnnotation<GradleDeprecatedOption>()
|
||||||
?.let { LanguageVersion.fromVersionString(it.removeAfter) }
|
?.let { it.removeAfter >= LanguageVersion.LATEST_STABLE }
|
||||||
?.let { it >= LanguageVersion.LATEST_STABLE }
|
|
||||||
?: true
|
?: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user