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

Exit more gracefully on exception.

This commit is contained in:
Cedric Beust 2015-11-05 06:33:28 -08:00
parent 79c8669b09
commit 9d2d6dba30

View file

@ -9,6 +9,7 @@ import com.beust.kobalt.kotlin.BuildFile
import com.beust.kobalt.kotlin.BuildFileCompiler import com.beust.kobalt.kotlin.BuildFileCompiler
import com.beust.kobalt.maven.DepFactory import com.beust.kobalt.maven.DepFactory
import com.beust.kobalt.maven.Http import com.beust.kobalt.maven.Http
import com.beust.kobalt.maven.KobaltException
import com.beust.kobalt.maven.LocalRepo import com.beust.kobalt.maven.LocalRepo
import com.beust.kobalt.misc.* import com.beust.kobalt.misc.*
import com.beust.kobalt.wrapper.Wrapper import com.beust.kobalt.wrapper.Wrapper
@ -69,8 +70,11 @@ private class Main @Inject constructor(
val latestVersionFuture = github.latestKobaltVersion val latestVersionFuture = github.latestKobaltVersion
benchmark("Build", { benchmark("Build", {
// runTest() // runTest()
result = runWithArgs(jc, args) try {
executors.shutdown() result = runWithArgs(jc, args)
} finally {
executors.shutdown()
}
}) })
log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL") log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL")
@ -128,6 +132,8 @@ private class Main @Inject constructor(
val pluginInfo = PluginInfo(pluginInfoDescription) val pluginInfo = PluginInfo(pluginInfoDescription)
try { try {
allProjects = buildFileCompilerFactory.create(listOf(buildFile), pluginInfo).compileBuildFiles(args) allProjects = buildFileCompilerFactory.create(listOf(buildFile), pluginInfo).compileBuildFiles(args)
} catch(ex: KobaltException) {
throw ex
} catch(ex: Throwable) { } catch(ex: Throwable) {
// This can happen if the ABI for the build script file changed. Try to wipe .kobalt. // This can happen if the ABI for the build script file changed. Try to wipe .kobalt.
log(2, "Couldn't parse preBuildScript.jar: ${ex.message}") log(2, "Couldn't parse preBuildScript.jar: ${ex.message}")