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

Fix Build.kt being deleted when upgrading to a new version.

This commit is contained in:
Cedric Beust 2017-03-31 08:53:31 -07:00
parent ba1d8f30b0
commit 851cf55bfe

View file

@ -83,6 +83,15 @@ class BuildFileCompiler @Inject constructor(@Assisted("buildSources") val buildS
var errorTaskResult: TaskResult? = null
val projects = arrayListOf<Project>()
// 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)
//