[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
|
||||
get() {
|
||||
irTarget?.let { throw IllegalStateException("Unfortunately you can't use binaries in 'both' mode") }
|
||||
return compilations.withType(KotlinJsCompilation::class.java)
|
||||
.named(MAIN_COMPILATION_NAME)
|
||||
.map { it.binaries }
|
||||
.get()
|
||||
}
|
||||
get() = compilations.withType(KotlinJsCompilation::class.java)
|
||||
.named(MAIN_COMPILATION_NAME)
|
||||
.map { it.binaries }
|
||||
.get()
|
||||
|
||||
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.DEVELOPMENT
|
||||
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.utils.lowerCamelCaseName
|
||||
import javax.inject.Inject
|
||||
@@ -38,22 +37,25 @@ constructor(
|
||||
fun executable(
|
||||
compilation: KotlinJsCompilation = defaultCompilation
|
||||
) {
|
||||
(target as KotlinJsSubTargetContainerDsl).whenBrowserConfigured {
|
||||
if (target is KotlinJsIrTarget) {
|
||||
if (target is KotlinJsIrTarget) {
|
||||
target.whenBrowserConfigured {
|
||||
(this as KotlinJsIrSubTarget).produceExecutable()
|
||||
}
|
||||
|
||||
if (target is KotlinJsTarget) {
|
||||
(this as KotlinJsSubTarget).produceExecutable()
|
||||
target.whenNodejsConfigured {
|
||||
(this as KotlinJsIrSubTarget).produceExecutable()
|
||||
}
|
||||
}
|
||||
|
||||
(target as KotlinJsSubTargetContainerDsl).whenNodejsConfigured {
|
||||
if (target is KotlinJsIrTarget) {
|
||||
(this as KotlinJsIrSubTarget).produceExecutable()
|
||||
if (target is KotlinJsTarget) {
|
||||
target.irTarget
|
||||
?.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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user