Don't use addIfNotNull core util in the JS Gradle plugin

The function was placed in a package whose another top-level function
used coroutines. This led to a NCDFE kotlin.coroutines.Continuation
with Gradle versions that bundle Kotlin pre-1.3 stdlib.

Instead, use the existing util function `lowerCamelCaseName` which also
filters nulls.
This commit is contained in:
Sergey Igushkin
2019-08-06 15:43:57 +03:00
parent 47bee6a6c5
commit a874f4f5c3
@@ -19,7 +19,7 @@ import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
import org.jetbrains.kotlin.gradle.tasks.createOrRegisterTask import org.jetbrains.kotlin.gradle.tasks.createOrRegisterTask
import org.jetbrains.kotlin.gradle.testing.internal.configureConventions import org.jetbrains.kotlin.gradle.testing.internal.configureConventions
import org.jetbrains.kotlin.gradle.testing.internal.kotlinTestRegistry import org.jetbrains.kotlin.gradle.testing.internal.kotlinTestRegistry
import org.jetbrains.kotlin.utils.addIfNotNull import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
abstract class KotlinJsSubTarget( abstract class KotlinJsSubTarget(
val target: KotlinJsTarget, val target: KotlinJsTarget,
@@ -43,20 +43,8 @@ abstract class KotlinJsSubTarget(
} }
} }
private fun disambiguate(name: String): MutableList<String> { protected fun disambiguateCamelCased(name: String): String =
val components = mutableListOf<String>() lowerCamelCaseName(target.disambiguationClassifier, disambiguationClassifier, name)
components.addIfNotNull(target.disambiguationClassifier)
components.add(disambiguationClassifier)
components.add(name)
return components
}
protected fun disambiguateCamelCased(name: String): String {
val components = disambiguate(name)
return components.first() + components.drop(1).joinToString("") { it.capitalize() }
}
private fun configureTests() { private fun configureTests() {
target.compilations.all { compilation -> target.compilations.all { compilation ->