任务 gradle 是如何实现以当前使用的方式使用的?
How was task gradle implemented to be used in the way that's currently used?
我正在学习 gradle,因此我开始学习 groovy。
我不明白 gradle 或 groovy 如何允许我这样做:
task nameOfTask(dependsOn: otherTask) {
//some stuff
}
如果任务是 class,nameOfTask 需要使用 operator new 来实例化。如果任务是一个方法,我认为 nameOfTask 需要是一个字符串。
你能post一个示例代码让我重现上面的代码吗?
上引用(并结合上下文)同一问题的答案
the snippet above is resolved to a method call
Project#task("nameOfTask", dependsOn: otherTask)
to get this working with the snippet above, AST transformation is used. See http://www.groovy-lang.org/metaprogramming.html#_compile_time_metaprogramming for more details
我正在学习 gradle,因此我开始学习 groovy。 我不明白 gradle 或 groovy 如何允许我这样做:
task nameOfTask(dependsOn: otherTask) {
//some stuff
}
如果任务是 class,nameOfTask 需要使用 operator new 来实例化。如果任务是一个方法,我认为 nameOfTask 需要是一个字符串。
你能post一个示例代码让我重现上面的代码吗?
the snippet above is resolved to a method call
Project#task("nameOfTask", dependsOn: otherTask)
to get this working with the snippet above, AST transformation is used. See http://www.groovy-lang.org/metaprogramming.html#_compile_time_metaprogramming for more details