Skip to content

Commit

Permalink
fix: Change of Gradle log level should not affect UP-TO-DATE check
Browse files Browse the repository at this point in the history
When the task was run again after successful run with different log level,
the task was marked as not up-to-date, with the message
```
Value of input property 'args' has changed
```
  • Loading branch information
grv87 committed Apr 2, 2017
1 parent 4fc1e0c commit 4ec3981
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/main/groovy/org/fidata/gradle/packer/GradlePackerPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class GradlePackerPlugin implements Plugin<Project> {
String builderType = builder['type']
String buildName = builder['name'] ?: builderType
String fullBuildName = "$imageName-$buildName"
Task t = project.task([type: Exec], "build-$fullBuildName") {
Task t = project.task("build-$fullBuildName") {
group 'Build'
ext.builderType = builderType
ext.buildName = buildName
Expand All @@ -107,10 +107,28 @@ class GradlePackerPlugin implements Plugin<Project> {
ext.contextTemplateData['build_name'] = buildName
ext.contextTemplateData['build_type'] = builderType
ext.contextTemplateData['uuid'] = uuid
ext.upToDateWhen = []
ext.inputProperties = [:]
shouldRunAfter validate
mustRunAfter cleanTask
commandLine((['packer', 'build', "-only=$buildName"] + customVariablesCmdLine + (project.gradle.startParameter.logLevel <= LogLevel.DEBUG ? ['-debug'] : []) + [fileName]))
doLast {
project.exec {
commandLine(
[
'packer',
'build',
"-only=$buildName"
] +
customVariablesCmdLine +
(project.gradle.startParameter.logLevel <= LogLevel.DEBUG ? ['-debug'] : []) +
[
fileName
]
)
}
}
inputs.file templateFile
inputs.property 'customVariablesCmdLine', customVariablesCmdLine
}

// VirtualBox ISO & OVF builders
Expand Down

0 comments on commit 4ec3981

Please sign in to comment.