diff --git a/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt b/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt index 7037dcdc..89250464 100644 --- a/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt +++ b/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt @@ -83,6 +83,15 @@ class BuildFileCompiler @Inject constructor(@Assisted("buildSources") val buildS var errorTaskResult: TaskResult? = null val projects = arrayListOf() + // If buildScript.jar was generated by a different version, wipe our temporary build directory + val buildScriptJarDir = KFiles.findBuildScriptDir(root.absolutePath) + buildScriptJarDir.let { dir -> + if (! VersionFile.isSameVersionFile(dir)) { + kobaltLog(1, "Detected new installation, wiping $dir") + dir.listFiles().map(File::delete) + } + } + // Parse the build files in kobalt/src/*.kt, which will analyze all the buildScriptInfo{} sections // and possibly add new source build directories. The output of this process is a new Build.kt // file that contains the aggregation of all the build files with the profiles applied and with @@ -94,16 +103,6 @@ class BuildFileCompiler @Inject constructor(@Assisted("buildSources") val buildS // context.internalContext.absoluteDir = buildSources.root - // If buildScript.jar was generated by a different version, wipe them it case the API - // changed in-between - val buildScriptJarDir = KFiles.findBuildScriptDir(root.absolutePath) - buildScriptJarDir.let { dir -> - if (! VersionFile.isSameVersionFile(dir)) { - kobaltLog(1, "Detected new installation, wiping $dir") - dir.listFiles().map(File::delete) - } - } - val buildScriptJarFile = File(KFiles.findBuildScriptDir(root.absolutePath), SCRIPT_JAR) //