Generate KotlinVersion Gradle DSL object

To avoid exposing compiler internal types inside Gradle DSL public api.

ApiVersion and LanguageVersion in terms of compiler api is almost the
same. Actually ApiVersion is generated based on LanguageVersion. To
reduce user confusion what enum to use and what is the difference
- in Gradle DSL they are now exposed as single enum - KotlinVersion.

Mark KotlinVersion with DeprecationLevel.ERROR if related
LanguageVersion is unsupported and with DeprecationLevel.WARNING if
related LanguageVersion is deprecated.

^KT-27301 In Progress
This commit is contained in:
Yahor Berdnikau
2022-08-03 17:37:35 +02:00
parent a368fc37c7
commit 6842842827
3 changed files with 77 additions and 3 deletions
@@ -0,0 +1,23 @@
// DO NOT EDIT MANUALLY!
// Generated by org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt
package org.jetbrains.kotlin.gradle.dsl
@Suppress("DEPRECATION")
enum class KotlinVersion (val version: String) {
@Deprecated("Unsupported", level = DeprecationLevel.ERROR) KOTLIN_1_0("1.0"),
@Deprecated("Unsupported", level = DeprecationLevel.ERROR) KOTLIN_1_1("1.1"),
@Deprecated("Unsupported", level = DeprecationLevel.ERROR) KOTLIN_1_2("1.2"),
@Deprecated("Will be removed soon") KOTLIN_1_3("1.3"),
@Deprecated("Will be removed soon") KOTLIN_1_4("1.4"),
KOTLIN_1_5("1.5"),
KOTLIN_1_6("1.6"),
KOTLIN_1_7("1.7"),
KOTLIN_1_8("1.8"),
KOTLIN_1_9("1.9");
companion object {
fun fromVersion(version: String): KotlinVersion =
KotlinVersion.values().firstOrNull { it.version == version }
?: throw IllegalArgumentException("Unknown Kotlin version: $version")
}
}