[Gradle, JS] Change byArgument on byArgumentOrNull
#KT-38485 fixed
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ enum class KotlinJsCompilerType {
|
||||
companion object {
|
||||
const val jsCompilerProperty = "kotlin.js.compiler"
|
||||
|
||||
fun byArgument(argument: String): KotlinJsCompilerType? =
|
||||
fun byArgumentOrNull(argument: String): KotlinJsCompilerType? =
|
||||
values().firstOrNull { it.name.equals(argument, ignoreCase = true) }
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ open class KotlinJsProjectExtension :
|
||||
compiler: String,
|
||||
body: KotlinJsTargetDsl.() -> Unit = { }
|
||||
): KotlinJsTargetDsl = js(
|
||||
KotlinJsCompilerType.byArgument(compiler)
|
||||
KotlinJsCompilerType.byArgumentOrNull(compiler)
|
||||
?: throw IllegalArgumentException(
|
||||
"Unable to find $compiler setting. Use [${KotlinJsCompilerType.values().toList().joinToString()}]"
|
||||
),
|
||||
|
||||
+6
-1
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
import groovy.lang.Closure
|
||||
@@ -26,7 +31,7 @@ interface KotlinTargetContainerWithJsPresetFunctions :
|
||||
configure: KotlinJsTargetDsl.() -> Unit = { }
|
||||
) = js(
|
||||
name = name,
|
||||
compiler = KotlinJsCompilerType.byArgument(compiler)
|
||||
compiler = KotlinJsCompilerType.byArgumentOrNull(compiler)
|
||||
?: throw IllegalArgumentException(
|
||||
"Unable to find $compiler setting. Use [${KotlinJsCompilerType.values().toList().joinToString()}]"
|
||||
),
|
||||
|
||||
+3
-14
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.plugin
|
||||
@@ -206,7 +195,7 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
* Use Kotlin/JS backend compiler type
|
||||
*/
|
||||
val jsCompiler: KotlinJsCompilerType
|
||||
get() = property(jsCompilerProperty)?.let { KotlinJsCompilerType.byArgument(it) } ?: KotlinJsCompilerType.LEGACY
|
||||
get() = property(jsCompilerProperty)?.let { KotlinJsCompilerType.byArgumentOrNull(it) } ?: KotlinJsCompilerType.LEGACY
|
||||
|
||||
private fun propertyWithDeprecatedVariant(propName: String, deprecatedPropName: String): String? {
|
||||
val deprecatedProperty = property(deprecatedPropName)
|
||||
|
||||
Reference in New Issue
Block a user