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

Disable incremental compilation if build file was modified.

This commit is contained in:
Cedric Beust 2016-04-02 07:14:32 -07:00
parent edeaae8c4b
commit a90ef6e6fa
3 changed files with 10 additions and 2 deletions

View file

@ -41,4 +41,10 @@ class InternalContext {
private val incrementalSuccesses = hashSetOf<String>()
fun previousTaskWasIncrementalSuccess(projectName: String) = incrementalSuccesses.contains(projectName) ?: false
fun setIncrementalSuccess(projectName: String) = incrementalSuccesses.add(projectName)
/**
* Keep track of whether the build file was modified. If this boolean is true, incremental compilation
* will be disabled.
*/
var buildFileOutOfDate: Boolean = false
}

View file

@ -91,9 +91,9 @@ class IncrementalManager @Inject constructor(val args: Args) {
var upToDate = false
var taskOutputChecksum : String? = null
if (args.noIncremental) {
if (args.noIncremental || (Kobalt.context?.internalContext?.buildFileOutOfDate as Boolean)) {
//
// If the user turned off incremental builds, always run this task
// If the user turned off incremental builds or if the build file was modified, always run this task
//
logIncremental(LEVEL, "Incremental builds are turned off, running $taskName")
upToDate = false

View file

@ -2,6 +2,7 @@ package com.beust.kobalt.app
import com.beust.kobalt.KobaltException
import com.beust.kobalt.Plugins
import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project
import com.beust.kobalt.internal.build.BuildFile
@ -111,6 +112,7 @@ class ParsedBuildFile(val buildFile: BuildFile, val context: KobaltContext, val
generateJarFile(context, BuildFile(Paths.get(pluginSourceFile.path), "Plugins",
Paths.get(buildScriptJar)), buildScriptJarFile, buildFile)
VersionFile.generateVersionFile(buildScriptJarFile.parentFile)
Kobalt.context.internalContext.buildFileOutOfDate = true
}
//