1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 00:38:11 -07:00

Add "jvmArgs" to test{}.

This commit is contained in:
Cedric Beust 2015-11-27 00:24:39 -08:00
parent 1ee183d5c1
commit 63a9c1f159
3 changed files with 8 additions and 2 deletions

View file

@ -7,6 +7,10 @@ class TestConfig(val project: Project) {
fun args(vararg arg: String) { fun args(vararg arg: String) {
project.testArgs.addAll(arg) project.testArgs.addAll(arg)
} }
fun jvmArgs(vararg arg: String) {
project.testJvmArgs.addAll(arg)
}
} }
@Directive @Directive

View file

@ -26,7 +26,8 @@ open public class Project(
override var buildConfig: BuildConfig? = null override var buildConfig: BuildConfig? = null
var testArgs: ArrayList<String> = arrayListOf() val testArgs = arrayListOf<String>()
val testJvmArgs = arrayListOf<String>()
val projectProperties = ProjectProperties() val projectProperties = ProjectProperties()

View file

@ -14,7 +14,7 @@ abstract class GenericTestRunner(open val project: Project, open val classpath:
abstract val args: List<String> abstract val args: List<String>
protected fun findTestClasses(): List<String> { protected fun findTestClasses(): List<String> {
val path = KFiles.joinDir(project.directory, project.buildDirectory!!, KFiles.TEST_CLASSES_DIR) val path = KFiles.joinDir(project.directory, project.buildDirectory, KFiles.TEST_CLASSES_DIR)
val result = KFiles.findRecursively(File(path), arrayListOf(File(".")), { val result = KFiles.findRecursively(File(path), arrayListOf(File(".")), {
file -> file.endsWith(".class") file -> file.endsWith(".class")
}).map { }).map {
@ -45,6 +45,7 @@ abstract class GenericTestRunner(open val project: Project, open val classpath:
if (args.size > 0) { if (args.size > 0) {
val allArgs = arrayListOf<String>().apply { val allArgs = arrayListOf<String>().apply {
add(java!!.absolutePath) add(java!!.absolutePath)
addAll(project.testJvmArgs)
add("-classpath") add("-classpath")
add(classpath.map { it.jarFile.get().absolutePath }.joinToString(File.pathSeparator)) add(classpath.map { it.jarFile.get().absolutePath }.joinToString(File.pathSeparator))
add(mainClass) add(mainClass)