[Gradle, JS] Add browser to test js composite build

#KT-37954 fixed
This commit is contained in:
Ilya Goncharov
2020-04-02 15:45:18 +03:00
parent a5026d60db
commit c1c0df962f
3 changed files with 20 additions and 9 deletions
@@ -11,6 +11,11 @@ repositories {
kotlin.js { kotlin.js {
binaries.executable() binaries.executable()
nodejs() nodejs()
browser()
}
tasks.named("browserTest") {
enabled = false
} }
rootProject.tasks rootProject.tasks
@@ -10,7 +10,14 @@ repositories {
mavenLocal() mavenLocal()
} }
kotlin.target.nodejs() kotlin.js {
nodejs()
browser()
}
tasks.named("browserTest") {
enabled = false
}
rootProject.tasks rootProject.tasks
.withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask::class.java) .withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask::class.java)
@@ -59,7 +59,12 @@ constructor(
it.description = "Run js on all configured platforms" it.description = "Run js on all configured platforms"
} }
private var testsConfigured: Boolean = false private val configureTestSideEffect: Unit by lazy {
compilations.matching { it.name == KotlinCompilation.TEST_COMPILATION_NAME }
.all { compilation ->
compilation.binaries.executableIrInternal(compilation)
}
}
private val browserLazyDelegate = lazy { private val browserLazyDelegate = lazy {
project.objects.newInstance(KotlinBrowserJsIr::class.java, this).also { project.objects.newInstance(KotlinBrowserJsIr::class.java, this).also {
@@ -105,13 +110,7 @@ constructor(
} }
private fun KotlinJsIrSubTarget.configureSubTarget() { private fun KotlinJsIrSubTarget.configureSubTarget() {
compilations.matching { it.name == KotlinCompilation.TEST_COMPILATION_NAME } configureTestSideEffect
.all { compilation ->
if (!testsConfigured) {
testsConfigured = true
compilation.binaries.executableIrInternal(compilation)
}
}
configure() configure()
} }