[Gradle, JS] Do not duplicate target initialization
This commit is contained in:
+23
-21
@@ -117,30 +117,32 @@ open class KotlinJsProjectExtension :
|
|||||||
compiler: JsCompilerType = defaultJsCompilerType,
|
compiler: JsCompilerType = defaultJsCompilerType,
|
||||||
body: KotlinJsTargetDsl.() -> Unit
|
body: KotlinJsTargetDsl.() -> Unit
|
||||||
) {
|
) {
|
||||||
val target: KotlinJsTargetDsl = when (compiler) {
|
if (_target == null) {
|
||||||
legacy -> legacyPreset
|
val target: KotlinJsTargetDsl = when (compiler) {
|
||||||
.also { it.irPreset = null }
|
legacy -> legacyPreset
|
||||||
.createTarget("js")
|
.also { it.irPreset = null }
|
||||||
ir -> irPreset
|
.createTarget("js")
|
||||||
.also { it.mixedMode = false }
|
ir -> irPreset
|
||||||
.createTarget("js")
|
.also { it.mixedMode = false }
|
||||||
both -> legacyPreset
|
.createTarget("js")
|
||||||
.also {
|
both -> legacyPreset
|
||||||
irPreset.mixedMode = true
|
.also {
|
||||||
it.irPreset = irPreset
|
irPreset.mixedMode = true
|
||||||
}
|
it.irPreset = irPreset
|
||||||
.createTarget(
|
}
|
||||||
lowerCamelCaseName(
|
.createTarget(
|
||||||
"js",
|
lowerCamelCaseName(
|
||||||
legacy.name
|
"js",
|
||||||
|
legacy.name
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
|
|
||||||
|
this._target = target
|
||||||
|
|
||||||
|
target.project.components.addAll(target.components)
|
||||||
}
|
}
|
||||||
|
|
||||||
this._target = target
|
|
||||||
|
|
||||||
target.project.components.addAll(target.components)
|
|
||||||
|
|
||||||
target.run(body)
|
target.run(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user