什么是运营商<< (小于2)在gradle中? [英] What's the operator << (double less than) in gradle?
本文介绍了什么是运营商<< (小于2)在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 添加到特定的任务。任务由执行任务期间运行的多个操作(按顺序添加)组成。 <<
只是将操作添加到任务操作集合中。有关任务和操作的更多信息,请参见此处。
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.
这篇关于什么是运营商<< (小于2)在gradle中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文