mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Handle build compilation failures better.
This commit is contained in:
parent
39ca901d4b
commit
c64c6fec86
3 changed files with 13 additions and 3 deletions
|
@ -11,6 +11,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
|
||||||
|
@ -94,6 +95,9 @@ private class Main @Inject constructor(
|
||||||
// runTest()
|
// runTest()
|
||||||
try {
|
try {
|
||||||
result = runWithArgs(jc, args)
|
result = runWithArgs(jc, args)
|
||||||
|
} catch(ex: KobaltException) {
|
||||||
|
error(ex.message ?: "", ex)
|
||||||
|
result = 1
|
||||||
} finally {
|
} finally {
|
||||||
executors.shutdown()
|
executors.shutdown()
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,12 +96,17 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b
|
||||||
} else {
|
} else {
|
||||||
log(2, "Need to recompile ${buildFile.name}")
|
log(2, "Need to recompile ${buildFile.name}")
|
||||||
|
|
||||||
|
buildScriptJarFile.delete()
|
||||||
kotlinCompilePrivate {
|
kotlinCompilePrivate {
|
||||||
classpath(files.kobaltJar)
|
classpath(files.kobaltJar)
|
||||||
classpath(pluginUrls.map { it.file })
|
classpath(pluginUrls.map { it.file })
|
||||||
sourceFiles(listOf(buildFile.path.toFile().absolutePath))
|
sourceFiles(listOf(buildFile.path.toFile().absolutePath))
|
||||||
output = buildScriptJarFile
|
output = buildScriptJarFile
|
||||||
}.compile(context = context)
|
}.compile(context = context)
|
||||||
|
|
||||||
|
if (! buildScriptJarFile.exists()) {
|
||||||
|
throw KobaltException("Could not compile ${buildFile.name}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,12 @@ class Logger(val dev: Boolean) {
|
||||||
|
|
||||||
final fun error(tag: String, message: String, e: Throwable? = null) {
|
final fun error(tag: String, message: String, e: Throwable? = null) {
|
||||||
println(getPattern("***** E", "***** ERROR ", tag, message) +
|
println(getPattern("***** E", "***** ERROR ", tag, message) +
|
||||||
if (e != null) " Exception: " + e.message else "")
|
if (e != null && KobaltLogger.LOG_LEVEL > 1) " Exception: " + e.message else "")
|
||||||
e?.printStackTrace()
|
if (KobaltLogger.LOG_LEVEL > 1) {
|
||||||
|
e?.printStackTrace()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final fun warn(tag: String, message: String, e: Throwable? = null) =
|
final fun warn(tag: String, message: String, e: Throwable? = null) =
|
||||||
println(getPattern("W", "***** WARNING ${e?.message}", tag, message))
|
println(getPattern("W", "***** WARNING ${e?.message}", tag, message))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue