[Gradle, JS] UpperCased KotlinJsCompilerType

This commit is contained in:
Ilya Goncharov
2020-02-20 17:26:52 +03:00
parent 9acd98071e
commit 068d547375
12 changed files with 56 additions and 62 deletions
@@ -5,21 +5,10 @@
package org.jetbrains.kotlin.gradle.plugin
import org.gradle.api.Named
import java.io.Serializable
// For Gradle attributes
@Suppress("EnumEntryName")
enum class KotlinJsCompilerType : Named, Serializable {
legacy,
ir,
both;
override fun getName(): String =
name.toLowerCase()
override fun toString(): String =
getName()
enum class KotlinJsCompilerType {
LEGACY,
IR,
BOTH;
companion object {
const val jsCompilerProperty = "kotlin.js.compiler"
@@ -29,11 +18,14 @@ enum class KotlinJsCompilerType : Named, Serializable {
}
}
val KotlinJsCompilerType.lowerName
get() = name.toLowerCase()
fun String.removeJsCompilerSuffix(compilerType: KotlinJsCompilerType): String {
val truncatedString = removeSuffix(compilerType.name)
val truncatedString = removeSuffix(compilerType.lowerName)
if (this != truncatedString) {
return truncatedString
}
return removeSuffix(compilerType.name.capitalize())
return removeSuffix(compilerType.lowerName.capitalize())
}