Skip to content

Instantly share code, notes, and snippets.

@zyzo zyzo/build.gradle
Created Jan 16, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.