From da9e8815f36e4b83898dfd61da2aeb3f5821dccf Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 12 Jul 2016 02:31:02 -0800 Subject: [PATCH] Always recompile the build file is a profile is given. --- .../kotlin/com/beust/kobalt/app/BuildFileCompiler.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt b/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt index 3893d0b3..540b0b1b 100644 --- a/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt +++ b/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt @@ -33,7 +33,7 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b @Assisted val pluginInfo: PluginInfo, val files: KFiles, val plugins: Plugins, val dependencyManager: DependencyManager, val pluginProperties: PluginProperties, val executors: KobaltExecutors, val buildScriptUtil: BuildScriptUtil, val settings: KobaltSettings, - val incrementalManagerFactory: IncrementalManager.IFactory) { + val incrementalManagerFactory: IncrementalManager.IFactory, val args: Args) { interface IFactory { fun create(@Assisted("buildFiles") buildFiles: List, pluginInfo: PluginInfo) : BuildFileCompiler @@ -119,7 +119,13 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b pluginUrls: List) : TaskResult { log(2, "Running build file ${buildFile.name} jar: $buildScriptJarFile") - if (buildScriptUtil.isUpToDate(buildFile, buildScriptJarFile)) { + // If the user specifed --profiles, always recompile the build file since we don't know if + // the current buildScript.jar we have contains the correct value for these profiles + // There is still a potential bug if the user builds with a profile and then without any: + // in this case, we won't recompile the build file. A potential solution for this would be + // to have a side file that describes which profiles the current buildScript.jar was + // compiled with. + if (args.profiles.isNullOrEmpty() && buildScriptUtil.isUpToDate(buildFile, buildScriptJarFile)) { log(2, " Build file is up to date") return TaskResult() } else {