Created
January 16, 2015 14:13
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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