【Gradle教程】第十五章:更多有关Task的内容

In the introductory tutorial (Chapter 6, Build Script Basics) you learned how to create simple tasks. You also learned how to add additional behavior to these tasks later on, and you learned how to create dependencies between tasks. This was all about simple tasks, but Gradle takes the concept of tasks further. Gradle supports enhanced tasks, which are tasks that have their own properties and methods. This is really different from what you are used to with Ant targets. Such enhanced tasks are either provided by you or built into Gradle.
<翻译>在前面介绍性的教程里(第6章,构建脚本基础)你已经学会了如何创建一个简单的task。你也学习了如何添加额外的行为到这些task中,并且知道如何创建task之间的依赖关系。这些都是有关简单task的,但是Gradle对task概念的定义更加深远。Gradle支持更加强大的task,它可以拥有自己的属性和方法。这一点是Gradle的task和Ant的target真正意义上的不同。这种增强版的task可以是你自己定义的,也可以是Gradle内置的。

15.1. Defining tasks(定义task)

We have already seen how to define tasks using a keyword style in Chapter 6, Build Script Basics. There are a few variations on this style, which you may need to use in certain situations. For example, the keyword style does not work in expressions.
<翻译>第6章,构建脚本基础我们已经看到了如何用关键字风格定义task。这种风格有细微的变化,这种变化也许在某些确切情况下你需要用到。例如,关键字风格

Example 15.1. Defining tasks

build.gradle
0 分享

要回复文章请先登录注册