Skip to content

Instantly share code, notes, and snippets.

@zyzo
Created January 16, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zyzo/6571dbbcfc0343c9a830 to your computer and use it in GitHub Desktop.
Save zyzo/6571dbbcfc0343c9a830 to your computer and use it in GitHub Desktop.
Example of gradle tasks grabbed from the documentation http://www.gradle.org/docs/current/userguide/tutorial_using_tasks.html
// Declare task
task hello {
doLast {
println "Hello world !"
}
}
// Dynamic creation of a task
task helloShorcut << {
println "Hello World 2"
}
// Variable
task upper << {
String someString = 'mY_nAmE'
println "Original: " + someString
println "Upper case: " + someString.toUpperCase()
}
// for loop
task count << {
4.times { print "$it " }
}
// Depend on task
task intro(dependsOn: hello) << {
println "I'm Gradle"
}
// Dynamic creation of a task
4.times { counter ->
task "task$counter" << {
println "I'm task number $counter"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment