[Gradle, JS] Do not duplicate target initialization

This commit is contained in:
Ilya Goncharov
2020-02-19 12:04:51 +03:00
parent 881de0a538
commit 956b57a55d
@@ -117,6 +117,7 @@ open class KotlinJsProjectExtension :
compiler: JsCompilerType = defaultJsCompilerType, compiler: JsCompilerType = defaultJsCompilerType,
body: KotlinJsTargetDsl.() -> Unit body: KotlinJsTargetDsl.() -> Unit
) { ) {
if (_target == null) {
val target: KotlinJsTargetDsl = when (compiler) { val target: KotlinJsTargetDsl = when (compiler) {
legacy -> legacyPreset legacy -> legacyPreset
.also { it.irPreset = null } .also { it.irPreset = null }
@@ -140,6 +141,7 @@ open class KotlinJsProjectExtension :
this._target = target this._target = target
target.project.components.addAll(target.components) target.project.components.addAll(target.components)
}
target.run(body) target.run(body)
} }