根据gradle文档,gradle按以下顺序执行任务:
配置 - > doFirst->动作 - > doLast
这是我的build.gradle:
task hello << {
println "${hello.message}"
}
hello << {
println "${hello.message} 2"
}
configure(hello, {
ext.message = 'hello'
description = "Hello task declared in project '${project.name}'"
doFirst {
println 'hello do first'
}
doLast {
println 'hello do last'
}
})
hello << {
println "${hello.message} 3"
}
hello << {
println "${hello.message} 4"
}
此任务的输出是:
:hello
hello do first
hello
hello 2
hello do last
hello 3
hello 4
BUILD SUCCESSFUL
Total time: 0.83 secs
doLast在最后两个动作之前执行,请帮助澄清。
提前致谢。
答案 0 :(得分:0)
左移运算符(''.join(tupleVariable)
)表示与<<
相同。此外,我想澄清doLast
和doFirst
是行动。在doLast
次操作之前执行doFirst
次操作。