[K/JS] Move JS IR box tests setup into separated function
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
|
||||
fun Test.useJsIrBoxTests(
|
||||
version: Any,
|
||||
buildDir: String = "",
|
||||
fullStdLib: String = "libraries/stdlib/js-ir/build/classes/kotlin/js/main",
|
||||
reducedStdlibPath: String = "libraries/stdlib/js-ir-minimal-for-test/build/classes/kotlin/js/main",
|
||||
kotlinJsTestPath: String = "libraries/kotlin.test/js-ir/build/classes/kotlin/js/main"
|
||||
) {
|
||||
setupV8()
|
||||
dependsOn(":kotlin-stdlib-js-ir:compileKotlinJs")
|
||||
dependsOn(":kotlin-test:kotlin-test-js-ir:compileKotlinJs")
|
||||
dependsOn(":kotlin-stdlib-js-ir-minimal-for-test:compileKotlinJs")
|
||||
|
||||
systemProperty("kotlin.js.test.root.out.dir", buildDir)
|
||||
systemProperty("kotlin.js.full.stdlib.path", fullStdLib)
|
||||
systemProperty("kotlin.js.reduced.stdlib.path", reducedStdlibPath)
|
||||
systemProperty("kotlin.js.kotlin.test.path", kotlinJsTestPath)
|
||||
systemProperty("kotlin.js.stdlib.klib.path", "libraries/stdlib/js-ir/build/libs/kotlin-stdlib-js-ir-js-$version.klib")
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.jetbrains.kotlin.gradle.targets.js.d8.D8RootExtension
|
||||
import org.jetbrains.kotlin.gradle.targets.js.d8.D8RootPlugin
|
||||
|
||||
private object V8Utils {
|
||||
lateinit var d8Plugin: D8RootExtension
|
||||
|
||||
fun useD8Plugin(project: Project) {
|
||||
d8Plugin = D8RootPlugin.apply(project.rootProject)
|
||||
d8Plugin.version = project.v8Version
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.useD8Plugin() {
|
||||
V8Utils.useD8Plugin(this)
|
||||
}
|
||||
|
||||
fun Test.setupV8() {
|
||||
dependsOn(V8Utils.d8Plugin.setupTaskProvider)
|
||||
val v8ExecutablePath = project.provider {
|
||||
V8Utils.d8Plugin.requireConfigured().executablePath.absolutePath
|
||||
}
|
||||
doFirst {
|
||||
systemProperty("javascript.engine.path.V8", v8ExecutablePath.get())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user