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

Better test failure message.

This commit is contained in:
Cedric Beust 2017-03-14 20:21:32 -07:00
parent b2390f34f8
commit 3d689b3367

View file

@ -34,8 +34,15 @@ open class BaseTest(val compilerFactory: BuildFileCompiler.IFactory? = null) {
}
"""
args.noIncremental = true
val projectResults = compileBuildFile(buildFileText, args)
return projectResults.projects.first { it.name == projectName }
val result = projectResults.projects.firstOrNull { it.name == projectName }
if (result == null) {
throw IllegalArgumentException("Couldn't find project named $projectName in "
+ projectResults.projects.map { it.name }.joinToString(", ", "[", "]"))
} else {
return result
}
}
/**
@ -52,6 +59,8 @@ open class BaseTest(val compilerFactory: BuildFileCompiler.IFactory? = null) {
val thisBuildFile = BuildFile(Paths.get(tmpBuildFile.absolutePath), "Build.kt")
args.apply {
buildFile = tmpBuildFile.absolutePath
noIncremental = true
noIncrementalKotlin = true
}
val jvmCompilerPlugin = Kobalt.findPlugin("JvmCompiler") as JvmCompilerPlugin
val pluginInfo = PluginInfo(KobaltPluginXml(), null, null).apply {