[Gradle, JS] Fix once initialization of produceExecutable

#KT-38055 fixed
This commit is contained in:
Ilya Goncharov
2020-04-06 20:38:14 +03:00
parent c3ee2c81ed
commit 626e7d14ec
4 changed files with 23 additions and 9 deletions
@@ -81,13 +81,13 @@ class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) {
val appProject = transformProjectWithPluginsDsl( val appProject = transformProjectWithPluginsDsl(
projectName = "app", projectName = "app",
directoryPrefix = rootProjectName, directoryPrefix = rootProjectName,
wrapperVersion = GradleVersionRequired.AtLeast("5.3") wrapperVersion = GradleVersionRequired.AtLeast("5.5")
) )
val libProject = transformProjectWithPluginsDsl( val libProject = transformProjectWithPluginsDsl(
projectName = "lib", projectName = "lib",
directoryPrefix = rootProjectName, directoryPrefix = rootProjectName,
wrapperVersion = GradleVersionRequired.AtLeast("5.3") wrapperVersion = GradleVersionRequired.AtLeast("5.5")
) )
libProject.gradleProperties().appendText(jsCompilerType(KotlinJsCompilerType.IR)) libProject.gradleProperties().appendText(jsCompilerType(KotlinJsCompilerType.IR))
@@ -8,10 +8,17 @@ repositories {
mavenCentral() mavenCentral()
} }
kotlin.js { kotlin {
binaries.executable() js {
nodejs() nodejs()
browser() binaries.executable()
}
}
kotlin {
js {
browser()
binaries.executable()
}
} }
tasks.named("browserTest") { tasks.named("browserTest") {
@@ -57,9 +57,12 @@ abstract class KotlinJsIrSubTarget(
} }
} }
internal val produceExecutable: () -> Unit by lazy { private val produceExecutable: Unit by lazy {
configureMain() configureMain()
return@lazy { Unit } }
internal fun produceExecutable() {
produceExecutable
} }
override fun testTask(body: KotlinJsTest.() -> Unit) { override fun testTask(body: KotlinJsTest.() -> Unit) {
@@ -42,10 +42,14 @@ abstract class KotlinJsSubTarget(
protected val taskGroupName = "Kotlin $disambiguationClassifier" protected val taskGroupName = "Kotlin $disambiguationClassifier"
internal open fun produceExecutable() { private val produceExecutable: Unit by lazy {
configureMain() configureMain()
} }
internal fun produceExecutable() {
produceExecutable
}
internal fun configure() { internal fun configure() {
NpmResolverPlugin.apply(project) NpmResolverPlugin.apply(project)