标签:lse print counter uil rap val snapshot depends ola
任何一个Gradle构建都是由一个或者多个project组成
每个project都有多个tasks构成
每个task都代表了构建执行过程中的一个原子性操作.例如 编译 打包
通过在命令行运行gradle命令来执行构建,gradle命令会从当前目录下寻找build.gradle文件来进行构建。
task hello {
doLast {
println ‘Hello world!‘
}
}
task hello << {
println ‘Hello World!‘
}
task hello << {
String str = "mY_nAmE"
println ‘orginal: ‘+ str
println ‘Upper case: ‘ + str.toUpperCase()
}
task hello << {
println ‘hello world‘
}
task intro(dependsOn hello) << {
println "I‘m Gradle"
}
4.times{counter ->
task "task$counter" <<{
println "I‘m task number $counter"
}
}
4.times { counter ->
task "task$counter" << {
println "I‘m task number $counter"
}
}
task0.dependsOn task2, task3
task myTask {
ext.myProperty = "myValue"
}
task printTaskProperties << {
println myTask.myProperty
}
defaultTasks ‘clean‘, ‘run‘
task clean << {
println ‘Default Cleaning!‘
}
task run << {
println ‘Default Running!‘
}
task other << {
println "I‘m not a default task!"
}
task distribution << {
println "We build the zip with version=$version"
}
task release(dependsOn: ‘distribution‘) << {
println ‘We release now‘
}
gradle.taskGraph.whenReady {taskGraph ->
if (taskGraph.hasTask(release)) {
version = ‘1.0‘
} else {
version = ‘1.0-SNAPSHOT‘
}
}
标签:lse print counter uil rap val snapshot depends ola
原文地址:https://www.cnblogs.com/rainymemory/p/10126782.html