in src/main/kotlin/io/bazel/kotlin/builder/tasks/KotlinBuilder.kt [121:147]
fun build(
taskContext: WorkerContext.TaskContext,
args: List<String>
): Int {
val (argMap, compileContext) = buildContext(taskContext, args)
var success = false
var status = 0
try {
@Suppress("WHEN_ENUM_CAN_BE_NULL_IN_JAVA")
when (compileContext.info.platform) {
Platform.JVM -> executeJvmTask(compileContext, taskContext.directory, argMap)
Platform.JS -> executeJsTask(compileContext, taskContext.directory, argMap)
Platform.UNRECOGNIZED -> throw IllegalStateException(
"unrecognized platform: ${compileContext.info}"
)
}
success = true
} catch (ex: CompilationStatusException) {
taskContext.error() { "Compilation failure: ${ex.message}" }
status = ex.status
} catch (throwable: Throwable) {
taskContext.error(throwable) { "Uncaught exception" }
} finally {
compileContext.finalize(success)
}
return status
}