[Gradle, JS] Add browser to test js composite build
#KT-37954 fixed
This commit is contained in:
+5
@@ -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
|
||||||
|
|||||||
+8
-1
@@ -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)
|
||||||
|
|||||||
+7
-8
@@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user