From edeaae8c4b1423eb9365bf2ac9d02ea759b3ff14 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sat, 2 Apr 2016 05:13:09 -0700 Subject: [PATCH] Disable smart incremental build. Until I can find a better way of implementing it. --- .../com/beust/kobalt/api/KobaltContext.kt | 18 +++++++++++------- .../kobalt/internal/IncrementalManager.kt | 18 +++++++++++------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt index 30f76e93..b50ef886 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt @@ -20,13 +20,8 @@ class KobaltContext(val args: Args) { fun findPlugin(name: String) = Plugins.findPlugin(name) - /** - * When an incremental task decides it's up to date, it sets this boolean to true so that subsequent - * tasks in that project can be skipped as well. This is an internal field that should only be set by Kobalt. - */ - private val incrementalSuccesses = hashSetOf() - fun previousTaskWasIncrementalSuccess(projectName: String) = incrementalSuccesses.contains(projectName) ?: false - fun setIncrementalSuccess(projectName: String) = incrementalSuccesses.add(projectName) + /** For internal use only */ + val internalContext = InternalContext() // // Injected @@ -38,3 +33,12 @@ class KobaltContext(val args: Args) { lateinit var settings: KobaltSettings } +class InternalContext { + /** + * When an incremental task decides it's up to date, it sets this boolean to true so that subsequent + * tasks in that project can be skipped as well. This is an internal field that should only be set by Kobalt. + */ + private val incrementalSuccesses = hashSetOf() + fun previousTaskWasIncrementalSuccess(projectName: String) = incrementalSuccesses.contains(projectName) ?: false + fun setIncrementalSuccess(projectName: String) = incrementalSuccesses.add(projectName) +} \ No newline at end of file diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/IncrementalManager.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/IncrementalManager.kt index b562f282..ec8f3ae4 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/IncrementalManager.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/IncrementalManager.kt @@ -97,12 +97,16 @@ class IncrementalManager @Inject constructor(val args: Args) { // logIncremental(LEVEL, "Incremental builds are turned off, running $taskName") upToDate = false - } else if (iti.context.previousTaskWasIncrementalSuccess(project.name)) { - // - // If the previous task was an incremental success, no need to run this task - // - logIncremental(LEVEL, "Previous incremental task was a success, not running $shortTaskName") - upToDate = true +// } else if (iti.context.internalContext.previousTaskWasIncrementalSuccess(project.name)) { +// // +// // If the previous task was an incremental success, no need to run this task. + // + // Disabled for now since this can only work if exactly the previous task was + // an incremental success. If it was a regular task, then this boolean should be + // set back to false, which is currently not done. +// // +// logIncremental(LEVEL, "Previous incremental task was a success, not running $shortTaskName") +// upToDate = true } else { // // First, compare the input checksums @@ -156,7 +160,7 @@ class IncrementalManager @Inject constructor(val args: Args) { // Identical input and output checksums, don't run the task // logIncremental(LEVEL, "Incremental task \"$taskName\" is up to date, not running it") - iti.context.setIncrementalSuccess(project.name) + iti.context.internalContext.setIncrementalSuccess(project.name) TaskResult() } }