mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Fix Build.kt being deleted when upgrading to a new version.
This commit is contained in:
parent
ba1d8f30b0
commit
851cf55bfe
1 changed files with 9 additions and 10 deletions
|
@ -83,6 +83,15 @@ class BuildFileCompiler @Inject constructor(@Assisted("buildSources") val buildS
|
||||||
var errorTaskResult: TaskResult? = null
|
var errorTaskResult: TaskResult? = null
|
||||||
val projects = arrayListOf<Project>()
|
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
|
// 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
|
// 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
|
// 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
|
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)
|
val buildScriptJarFile = File(KFiles.findBuildScriptDir(root.absolutePath), SCRIPT_JAR)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue