[Gradle] KotlinJvmCompilerOptions: Use JvmTarget.DEFAULT as default value for jvmTarget
KTIJ-24976
This commit is contained in:
committed by
Space Team
parent
eb0ff4fbcd
commit
c5e154a325
@@ -24,6 +24,7 @@ open class DefaultValues(
|
||||
val defaultValue: String,
|
||||
val type: KType,
|
||||
val kotlinOptionsType: KType,
|
||||
val prettyDefaultValue: String? = null,
|
||||
val possibleValues: List<String>? = null,
|
||||
val fromKotlinOptionConverterProp: String? = null,
|
||||
val toKotlinOptionConverterProp: String? = null,
|
||||
@@ -78,16 +79,17 @@ open class DefaultValues(
|
||||
)
|
||||
|
||||
object JvmTargetVersions : DefaultValues(
|
||||
"null",
|
||||
typeOf<JvmTargetDsl?>(),
|
||||
"org.jetbrains.kotlin.gradle.dsl.JvmTarget.DEFAULT",
|
||||
typeOf<JvmTargetDsl>(),
|
||||
typeOf<String?>(),
|
||||
possibleValues = JvmTarget.supportedValues().map { "\"${it.description}\"" },
|
||||
fromKotlinOptionConverterProp = """
|
||||
if (this != null) ${typeOf<JvmTargetDsl>()}.fromTarget(this) else null
|
||||
""".trimIndent(),
|
||||
toKotlinOptionConverterProp = """
|
||||
this?.target
|
||||
""".trimIndent()
|
||||
this.target
|
||||
""".trimIndent(),
|
||||
prettyDefaultValue = "\"${JvmTarget.DEFAULT}\""
|
||||
)
|
||||
|
||||
object JsEcmaVersions : DefaultValues(
|
||||
|
||||
@@ -878,7 +878,7 @@ private fun Printer.generateOptionDeprecation(property: KProperty1<*, *>) {
|
||||
private fun Printer.generateDoc(property: KProperty1<*, *>) {
|
||||
val description = property.findAnnotation<Argument>()!!.description
|
||||
val possibleValues = property.gradleValues.possibleValues
|
||||
val defaultValue = property.gradleDefaultValue
|
||||
val defaultValue = property.gradleValues.prettyDefaultValue ?: property.gradleValues.defaultValue
|
||||
|
||||
println("/**")
|
||||
println(" * ${description.replace("\n", " ")}")
|
||||
|
||||
@@ -28,6 +28,8 @@ internal fun generateJvmTarget(
|
||||
println("fun fromTarget(target: String): JvmTarget =")
|
||||
println(" JvmTarget.values().firstOrNull { it.target == target }")
|
||||
println(" ?: throw IllegalArgumentException(\"Unknown Kotlin JVM target: ${'$'}target\")")
|
||||
println()
|
||||
println("val DEFAULT = ${JvmTarget.DEFAULT.name}")
|
||||
}
|
||||
println("}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user