[Gradle, JS] Error if used binaries.executable in both compiler type
This commit is contained in:
+4
-7
@@ -81,13 +81,10 @@ constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val binaries: KotlinJsBinaryContainer
|
override val binaries: KotlinJsBinaryContainer
|
||||||
get() {
|
get() = compilations.withType(KotlinJsCompilation::class.java)
|
||||||
irTarget?.let { throw IllegalStateException("Unfortunately you can't use binaries in 'both' mode") }
|
.named(MAIN_COMPILATION_NAME)
|
||||||
return compilations.withType(KotlinJsCompilation::class.java)
|
.map { it.binaries }
|
||||||
.named(MAIN_COMPILATION_NAME)
|
.get()
|
||||||
.map { it.binaries }
|
|
||||||
.get()
|
|
||||||
}
|
|
||||||
|
|
||||||
var irTarget: KotlinJsIrTarget? = null
|
var irTarget: KotlinJsIrTarget? = null
|
||||||
|
|
||||||
|
|||||||
+11
-9
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
|
|||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType.DEVELOPMENT
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType.DEVELOPMENT
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType.PRODUCTION
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType.PRODUCTION
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsSubTargetContainerDsl
|
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.subtargets.KotlinJsSubTarget
|
import org.jetbrains.kotlin.gradle.targets.js.subtargets.KotlinJsSubTarget
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@@ -38,22 +37,25 @@ constructor(
|
|||||||
fun executable(
|
fun executable(
|
||||||
compilation: KotlinJsCompilation = defaultCompilation
|
compilation: KotlinJsCompilation = defaultCompilation
|
||||||
) {
|
) {
|
||||||
(target as KotlinJsSubTargetContainerDsl).whenBrowserConfigured {
|
if (target is KotlinJsIrTarget) {
|
||||||
if (target is KotlinJsIrTarget) {
|
target.whenBrowserConfigured {
|
||||||
(this as KotlinJsIrSubTarget).produceExecutable()
|
(this as KotlinJsIrSubTarget).produceExecutable()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target is KotlinJsTarget) {
|
target.whenNodejsConfigured {
|
||||||
(this as KotlinJsSubTarget).produceExecutable()
|
(this as KotlinJsIrSubTarget).produceExecutable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(target as KotlinJsSubTargetContainerDsl).whenNodejsConfigured {
|
if (target is KotlinJsTarget) {
|
||||||
if (target is KotlinJsIrTarget) {
|
target.irTarget
|
||||||
(this as KotlinJsIrSubTarget).produceExecutable()
|
?.let { throw IllegalStateException("Unfortunately you can't use `executable()` with 'both' compiler type") }
|
||||||
|
|
||||||
|
target.whenBrowserConfigured {
|
||||||
|
(this as KotlinJsSubTarget).produceExecutable()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target is KotlinJsTarget) {
|
target.whenNodejsConfigured {
|
||||||
(this as KotlinJsSubTarget).produceExecutable()
|
(this as KotlinJsSubTarget).produceExecutable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user