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

Handle incompatible buildScript.jar files.

Try to delete .kobalt and try again. Still not optimal situation since it often fails on Windows.
This commit is contained in:
Cedric Beust 2015-10-30 17:36:33 -07:00
parent fa03846a07
commit 7bd0e57772

View file

@ -2,6 +2,7 @@ package com.beust.kobalt
import com.beust.jcommander.JCommander
import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.api.Project
import com.beust.kobalt.internal.TaskManager
import com.beust.kobalt.internal.remote.KobaltClient
import com.beust.kobalt.internal.remote.KobaltServer
@ -115,7 +116,17 @@ private class Main @Inject constructor(
if (! buildFile.exists()) {
error(buildFile.path.toFile().path + " does not exist")
} else {
val allProjects = buildFileCompilerFactory.create(listOf(buildFile)).compileBuildFiles(args)
var allProjects = listOf<Project>()
try {
allProjects = buildFileCompilerFactory.create(listOf(buildFile)).compileBuildFiles(args)
} catch(ex: Throwable) {
if (! File(".kobalt").deleteRecursively()) {
warn("Couldn't delete .kobalt, please delete it manually")
} else {
log(1, "Deleted .kobalt")
allProjects = buildFileCompilerFactory.create(listOf(buildFile)).compileBuildFiles(args)
}
}
if (args.tasks) {
//