什么是运算符 <<(双小于)在 gradle 中? [英] What's the operator << (double less than) in gradle?
本文介绍了什么是运算符 <<(双小于)在 gradle 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码定义了 4 个 gradle 任务:
The following piece of code defines 4 gradle tasks:
4.times { counter ->
task "task$counter" << {
println "I'm task number $counter"
}
}
但是什么是<<操作员?它在 groovy 中有什么作用?
But what is the << operator? What does it do in groovy?
推荐答案
基本上这是一个 leftShift
操作符 - 你可以找到更多细节 此处.
Basically this is a leftShift
operator - You can find more details here.
在 gradle <<<
操作符用于将 action 添加到特定的 task.任务由在任务执行期间运行的多个操作(按添加顺序)组成.<<
只是将一个动作添加到任务的动作集合中.可以在此处找到有关任务和操作的更多信息.
In gradle <<
operator is used to add action to a particular task. A task consists of multiple actions that are run (in order they were added) during the execution of the task. <<
just adds an action to tasks collection of actions. More about tasks and actions can be found here.
这篇关于什么是运算符 <<(双小于)在 gradle 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文