Gradle, js: don't use any subtarget by default

This commit is contained in:
Sergey Rostov
2019-05-15 13:47:15 +03:00
parent 2a2f59ae1c
commit c2a6654194
2 changed files with 0 additions and 11 deletions
@@ -36,16 +36,12 @@ class KotlinJsTarget(project: Project, platformType: KotlinPlatformType) :
val runTaskName get() = lowerCamelCaseName(disambiguationClassifier, runTaskNameSuffix) val runTaskName get() = lowerCamelCaseName(disambiguationClassifier, runTaskNameSuffix)
val runTask get() = project.tasks.maybeCreate(runTaskName) val runTask get() = project.tasks.maybeCreate(runTaskName)
private var hasSubtargets = false
val browser by lazy { val browser by lazy {
hasSubtargets = true
KotlinBrowserJs(this).also { KotlinBrowserJs(this).also {
it.configure() it.configure()
} }
} }
val nodejs by lazy { val nodejs by lazy {
hasSubtargets = true
KotlinNodeJs(this).also { KotlinNodeJs(this).also {
it.configure() it.configure()
} }
@@ -58,10 +54,4 @@ class KotlinJsTarget(project: Project, platformType: KotlinPlatformType) :
override fun nodejs(body: KotlinJsNodeDsl.() -> Unit) { override fun nodejs(body: KotlinJsNodeDsl.() -> Unit) {
nodejs.body() nodejs.body()
} }
fun configureDefaults() {
if (!hasSubtargets) {
browser()
}
}
} }
@@ -19,7 +19,6 @@ open class KotlinJsTargetConfigurator(kotlinPluginVersion: String) :
override fun configureTarget(target: KotlinOnlyTarget<KotlinJsCompilation>) { override fun configureTarget(target: KotlinOnlyTarget<KotlinJsCompilation>) {
target as KotlinJsTarget target as KotlinJsTarget
target.configureDefaults()
super.configureTarget(target) super.configureTarget(target)
target.compilations.forEach { target.compilations.forEach {