mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Pass TaskResult better in tests.
This commit is contained in:
parent
521dfc327b
commit
2746f57b9a
2 changed files with 36 additions and 26 deletions
|
@ -36,9 +36,13 @@ abstract class GenericTestRunner(open val project: Project, open val classpath:
|
|||
return result
|
||||
}
|
||||
|
||||
fun runTests() {
|
||||
/**
|
||||
* @return true if all the tests passed
|
||||
*/
|
||||
fun runTests() : Boolean {
|
||||
val jvm = JavaInfo.create(File(SystemProperties.javaBase))
|
||||
val java = jvm.javaExecutable
|
||||
if (args.size > 0) {
|
||||
val allArgs = arrayListOf<String>().apply {
|
||||
add(java!!.absolutePath)
|
||||
add("-classpath")
|
||||
|
@ -59,7 +63,11 @@ abstract class GenericTestRunner(open val project: Project, open val classpath:
|
|||
} else {
|
||||
log(1, "Test failures")
|
||||
}
|
||||
|
||||
return errorCode == 0
|
||||
} else {
|
||||
log(2, "Couldn't find any test classes")
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,18 +64,20 @@ abstract class JvmCompilerPlugin @Inject constructor(
|
|||
result.addAll(dependencyManager.calculateDependencies(project, context, it))
|
||||
}
|
||||
}
|
||||
return dependencyManager.reorderDependencies(result)
|
||||
val result2 = dependencyManager.reorderDependencies(result)
|
||||
return result2
|
||||
}
|
||||
|
||||
@Task(name = TASK_TEST, description = "Run the tests", runAfter = arrayOf("compile", "compileTest"))
|
||||
fun taskTest(project: Project) : TaskResult {
|
||||
lp(project, "Running tests")
|
||||
val success =
|
||||
if (project.testDependencies.any { it.id.contains("testng")} ) {
|
||||
TestNgRunner(project, testDependencies(project)).runTests()
|
||||
} else {
|
||||
JUnitRunner(project, testDependencies(project)).runTests()
|
||||
}
|
||||
return TaskResult()
|
||||
return TaskResult(success)
|
||||
}
|
||||
|
||||
@Task(name = TASK_CLEAN, description = "Clean the project", runBefore = arrayOf("compile"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue