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

[GITHUB-0.772] Bad flags from IJvmTestContributor.

Fixes https://github.com/cbeust/kobalt/issues/196
This commit is contained in:
Cedric Beust 2016-05-08 22:08:57 -08:00
parent 7ecb0dbd50
commit 50ef5e3269

View file

@ -63,31 +63,31 @@ abstract class GenericTestRunner: ITestRunnerContributor {
addAll(testConfig.jvmArgs) addAll(testConfig.jvmArgs)
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)
} }
val pluginInfo = Kobalt.INJECTOR.getInstance(PluginInfo::class.java) val pluginInfo = Kobalt.INJECTOR.getInstance(PluginInfo::class.java)
// JVM flags from the contributors // JVM flags from the contributors
val flagsFromContributors = pluginInfo.testJvmFlagContributors.flatMap { val jvmFlagsFromContributors = pluginInfo.testJvmFlagContributors.flatMap {
it.testJvmFlagsFor(project, context, jvmFlags) it.testJvmFlagsFor(project, context, jvmFlags)
} }
// JVM flags from the interceptors (these overwrite flags instead of just adding to the list) // JVM flags from the interceptors (these overwrite flags instead of just adding to the list)
var interceptedArgs = ArrayList(jvmFlags + flagsFromContributors) var interceptedJvmFlags = ArrayList(jvmFlags + jvmFlagsFromContributors)
pluginInfo.testJvmFlagInterceptors.forEach { pluginInfo.testJvmFlagInterceptors.forEach {
val newFlags = it.testJvmFlagsFor(project, context, interceptedArgs) val newFlags = it.testJvmFlagsFor(project, context, interceptedJvmFlags)
interceptedArgs.clear() interceptedJvmFlags.clear()
interceptedArgs.addAll(newFlags) interceptedJvmFlags.addAll(newFlags)
} }
if (interceptedArgs.any()) { if (interceptedJvmFlags.any()) {
log(2, "Final JVM test flags after running the contributors and interceptors: $interceptedArgs") log(2, "Final JVM test flags after running the contributors and interceptors: $interceptedJvmFlags")
} }
val allArgs = arrayListOf<String>().apply { val allArgs = arrayListOf<String>().apply {
add(java!!.absolutePath) add(java!!.absolutePath)
addAll(interceptedArgs) addAll(interceptedJvmFlags)
add(mainClass)
addAll(args) addAll(args)
} }