[Gradle, JS] Add redundant methods for single js plugin
This commit is contained in:
+18
-4
@@ -101,6 +101,7 @@ open class KotlinJsProjectExtension :
|
|||||||
internal var _target: KotlinJsTargetDsl? = null
|
internal var _target: KotlinJsTargetDsl? = null
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
@Deprecated("Use js() instead", ReplaceWith("js()"))
|
||||||
override var target: KotlinJsTargetDsl
|
override var target: KotlinJsTargetDsl
|
||||||
get() {
|
get() {
|
||||||
if (_target == null) {
|
if (_target == null) {
|
||||||
@@ -116,8 +117,8 @@ open class KotlinJsProjectExtension :
|
|||||||
|
|
||||||
open fun js(
|
open fun js(
|
||||||
compiler: KotlinJsCompilerType = defaultJsCompilerType,
|
compiler: KotlinJsCompilerType = defaultJsCompilerType,
|
||||||
body: KotlinJsTargetDsl.() -> Unit
|
body: KotlinJsTargetDsl.() -> Unit = { }
|
||||||
) {
|
): KotlinJsTargetDsl {
|
||||||
if (_target == null) {
|
if (_target == null) {
|
||||||
val target: KotlinJsTargetDsl = when (compiler) {
|
val target: KotlinJsTargetDsl = when (compiler) {
|
||||||
LEGACY -> legacyPreset
|
LEGACY -> legacyPreset
|
||||||
@@ -145,12 +146,25 @@ open class KotlinJsProjectExtension :
|
|||||||
}
|
}
|
||||||
|
|
||||||
target.run(body)
|
target.run(body)
|
||||||
|
|
||||||
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun js(
|
fun js(
|
||||||
body: KotlinJsTargetDsl.() -> Unit
|
body: KotlinJsTargetDsl.() -> Unit = { }
|
||||||
) = js(compiler = defaultJsCompilerType, body = body)
|
) = js(compiler = defaultJsCompilerType, body = body)
|
||||||
|
|
||||||
|
fun js() = js { }
|
||||||
|
|
||||||
|
fun js(compiler: KotlinJsCompilerType, configure: Closure<*>) =
|
||||||
|
js(compiler = compiler) {
|
||||||
|
ConfigureUtil.configure(configure, this)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun js(configure: Closure<*>) = js {
|
||||||
|
ConfigureUtil.configure(configure, this)
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated("Use js instead", ReplaceWith("js(body)"))
|
@Deprecated("Use js instead", ReplaceWith("js(body)"))
|
||||||
open fun target(body: KotlinJsTargetDsl.() -> Unit) = js(body)
|
open fun target(body: KotlinJsTargetDsl.() -> Unit) = js(body)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user