From 7bd0e577720db5f300f3cb1d0e04eb70191b228e Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 30 Oct 2015 17:36:33 -0700 Subject: [PATCH] Handle incompatible buildScript.jar files. Try to delete .kobalt and try again. Still not optimal situation since it often fails on Windows. --- src/main/kotlin/com/beust/kobalt/Main.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/beust/kobalt/Main.kt b/src/main/kotlin/com/beust/kobalt/Main.kt index 436646a3..3685a506 100644 --- a/src/main/kotlin/com/beust/kobalt/Main.kt +++ b/src/main/kotlin/com/beust/kobalt/Main.kt @@ -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() + 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) { //