Skip to content

Instantly share code, notes, and snippets.

@mtakacs
Last active December 21, 2015 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mtakacs/6252282 to your computer and use it in GitHub Desktop.
Save mtakacs/6252282 to your computer and use it in GitHub Desktop.
example gradle task, trying to disable task optimization checking. The build runs from jenkins in a fresh dir each time. I want to run my task all the time,I dont want it to spend time (5-10min) generating fileHashes.bin so it can determine that yes, all the files are new.
task grailsWar(type:Exec, dependsOn: [ initProject] ) {
description = "launch the war process, work is done by grails"
logger.debug "Task[$name]: configuration closure"
outputs.upToDateWhen { false }
ignoreExitValue false
executable project.ext.grailsExe
args "-Dgrails.env=${project.ext.buildEnv} war --non-interactive --plain-output --verbose --refresh-dependencies"
}
// Define a Task and pass it a configuration closure. Evaluated during configuration Phase
task productionWar(type:Copy, dependsOn: [ initProject, grailsWar ] ) {
description = "take the contents of the build/ directory and produce a single archive/distribution file"
logger.debug "Task[$name]: configuration closure"
outputs.upToDateWhen { false }
from('target') {
include '**/*.war'
rename 'output-(.*).war', project.ext.warName
}
destinationDir file(project.ext.artifactDir)
}
// Push actions onto the task's doList
productionWar << {
logger.debug "Task:[$name] - execution closure"
}
18:14:04 18:14:04.277 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@2dec8909, org.gradle.logging.internal.logback.LogbackLoggingConfigurer@418c56d, org.gradle.logging.internal.JavaUtilLoggingConfigurer@76497934]
18:14:04 18:14:04.278 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache outputFileStates.bin (/var/lib/jenkins/workspace/BILLIT/billit/.gradle/1.7/taskArtifacts/outputFileStates.bin)
18:14:04 18:14:04.419 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache fileHashes.bin (/var/lib/jenkins/workspace/BILLIT/billit/.gradle/1.7/taskArtifacts/fileHashes.bin)
...
...
[ 9 minutes where fileHashes.bin grows and grows... ]
-rw-r--r-- 1 jenkins jenkins 23595 Aug 16 18:14 fileHashes.bin
....
-rw-r--r-- 1 jenkins jenkins 94181 Aug 16 18:21 fileHashes.bin
...
...
18:21:45 18:21:45.485 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':amazonWar'
18:21:45 18:21:45.486 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :productionWar (Thread[main,5,main]) - complete
18:21:45 18:21:45.486 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 9 mins 5.165 secs, idle: 0.016 secs
18:21:45 18:21:45.486 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskGraphExecuter] Timing: Executing the DAG took 9 mins 5.188 secs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment