User: joe Date: 04 Jun 26 10:04 Revision: f085771beb56d9192428d463b7bc89aff89e6b2f Summary: Remove usage of org.jetbrains.kotlin.cli.common.toBooleanLenient TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=10551&personal=false Index: src/main/kotlin/creator/custom/types/GradlePluginSelectorCreatorProperty.kt =================================================================== --- src/main/kotlin/creator/custom/types/GradlePluginSelectorCreatorProperty.kt (revision 632a96f529d7db745696d98348b55e46d38b50b1) +++ src/main/kotlin/creator/custom/types/GradlePluginSelectorCreatorProperty.kt (revision f085771beb56d9192428d463b7bc89aff89e6b2f) @@ -30,6 +30,7 @@ import com.demonwav.mcdev.creator.custom.types.GradlePluginSelectorCreatorProperty.Holder import com.demonwav.mcdev.util.SemanticVersion import com.demonwav.mcdev.util.getOrLogException +import com.demonwav.mcdev.util.toBooleanLenient import com.github.kittinunf.fuel.core.Request import com.github.kittinunf.fuel.core.extensions.authentication import com.intellij.openapi.diagnostic.thisLogger @@ -48,7 +49,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import org.jetbrains.kotlin.cli.common.toBooleanLenient class GradlePluginSelectorCreatorProperty( descriptor: TemplatePropertyDescriptor, Index: src/main/kotlin/util/utils.kt =================================================================== --- src/main/kotlin/util/utils.kt (revision 632a96f529d7db745696d98348b55e46d38b50b1) +++ src/main/kotlin/util/utils.kt (revision f085771beb56d9192428d463b7bc89aff89e6b2f) @@ -47,6 +47,7 @@ import com.intellij.psi.util.PsiUtil import java.lang.invoke.MethodHandles import java.util.Locale +import java.util.Locale.getDefault import java.util.concurrent.CancellationException import java.util.regex.PatternSyntaxException import kotlin.math.min @@ -351,6 +352,13 @@ return this.toRegexOrNull() ?: default.toRegex() } +fun String?.toBooleanLenient(): Boolean? = when (this?.lowercase()) { + null -> false + in listOf("", "yes", "true", "on", "y") -> true + in listOf("no", "false", "off", "n") -> false + else -> null +} + // Bit of a hack, but this allows us to get the class object for top level declarations without having to // put the whole class name in as a string (easier to refactor, etc.) @Suppress("NOTHING_TO_INLINE") // In order for this to work this function must be `inline`