标签:
1. execute default file (build.gradle)
gradlew
2. execute another file
gradlew -b [filename]
3. basic task
task ta { println "from task ta" }
another way to define task
task tc
tc.doLast{println "from task tc"}
4. task with left shift
will not be execute like this
gradlew
only execute when call task name
gradlew ta
task ta <<{ println "from task ta" }
equal to
task ta { doLast { println "from task ta" } }
5. dependsOn
do before the task
task putOnSocks { doLast { println "Putting on Socks." } } task putOnShoes { dependsOn "putOnSocks" doLast { println "Putting on Shoes." } }
6. finalizedBy
do after the task
task eatBreakfast { finalizedBy "brushYourTeeth" doLast{ println "Om nom nom breakfast!" } } task brushYourTeeth { doLast { println "Brushie Brushie Brushie." } }
7. copy task
task copyJpegs(type: Copy) { from ‘images‘ include ‘*.jpg‘ into ‘build‘ }
8. define a task type
// type definition class HelloNameTask extends DefaultTask { String firstName @TaskAction void doAction() { println "Hello, $firstName" } } // create a task with type task helloName(type: HelloNameTask) { firstName = ‘Jeremy‘ }
标签:
原文地址:http://www.cnblogs.com/phoenix13suns/p/4906084.html