【转载】Gradle学习 第二章:概述

转载地址:http://ask.android-studio.org/?/article/6

Here is a list of some of Gradle‘s features.
<翻译>以下是关于Gradle特点的描述

Declarative builds and build-by-convention 宣言和公约
At the heart of Gradle lies a rich extensible Domain Specific Language (DSL) based on Groovy. Gradle pushes declarative builds to the next level by providing declarative language elements that you can assemble as you like. Those elements also provide build-by-convention support for Java, Groovy, OSGi, Web and Scala projects. Even more, this declarative language is extensible. Add your own new language elements or enhance the existing ones, thus providing concise, maintainable and comprehensible builds.
<翻译>Gradle的核心是一个丰富的可扩展的基于Groovy的领域特定语言(DSL)。Gradle通过提供说明性语言元素将说明性构建推到下一层,您可以组装。这些元素也提供build-by-convention支持Java、Groovy、OSGi、Web和Scala项目。更多,这个说明性语言是可扩展的。添加自己的新语言元素或提高现有的,从而提供简洁、易于维护和理解构建。

Language for dependency based programming 依赖的编程语言
The declarative language lies on top of a general purpose task graph, which you can fully leverage in your builds. It provides utmost flexibility to adapt Gradle to your unique needs.
<翻译>说明性语言位于通用任务列表之上,所有你可以在工程里充分的利用。它提供了最大的灵活性,以适应你对Gradle的独特需求。

Structure your build 构建你的工程
The suppleness and richness of Gradle finally allows you to apply common design principles to your build. For example, it is very easy to compose your build from reusable pieces of build logic. Inline stuff where unnecessary indirections would be inappropriate. Don‘t be forced to tear apart what belongs together (e.g. in your project hierarchy). Avoid smells like shotgun changes or divergent change that turn your build into a maintenance nightmare. At last you can create a well structured, easily maintained, comprehensible build.
<翻译>

Deep API 深入的接口
From being a pleasure to be used embedded to its many hooks over the whole lifecycle of build execution, Gradle allows you to monitor and customize its configuration and execution behavior to its very core.
<翻译>

Gradle scales
Gradle scales very well. It significantly increases your productivity, from simple single project builds up to huge enterprise multi-project builds. This is true for structuring the build. With the state-of-art incremental build function, this is also true for tackling the performance pain many large enterprise builds suffer from.
<翻译>

Multi-project builds
Gradle‘s support for multi-project build is outstanding. Project dependencies are first class citizens. We allow you to model the project relationships in a multi-project build as they really are for your problem domain. Gradle follows your layout not vice versa.
<翻译>

Gradle provides partial builds. If you build a single subproject Gradle takes care of building all the subprojects that subproject depends on. You can also choose to rebuild the subprojects that depend on a particular subproject. Together with incremental builds this is a big time saver for larger builds.
<翻译>Gradle提供了局部项目的构建。

Many ways to manage your dependencies 多种方法来管理你的工程构建依赖
Different teams prefer different ways to manage their external dependencies. Gradle provides convenient support for any strategy. From transitive dependency management with remote Maven and Ivy repositories to jars or directories on the local file system.
<翻译>不同的团队喜欢通过不同的方法来管理工程的外部依赖。Gradle对不同的管理策略皆提供了支持。从依赖管理与远程Maven和lvy库到本地文件系统上的jar包或目录都被包含在内。

Gradle is the first build integration tool Gradle是第一个集成化的构建工具
Ant tasks are first class citizens. Even more interesting, Ant projects are first class citizens as well. Gradle provides a deep import for any Ant project, turning Ant targets into native Gradle tasks at runtime. You can depend on them from Gradle, you can enhance them from Gradle, you can even declare dependencies on Gradle tasks in your build.xml. The same integration is provided for properties, paths, etc ...
<翻译>

Gradle fully supports your existing Maven or Ivy repository infrastructure for publishing and retrieving dependencies. Gradle also provides a converter for turning a Maven pom.xml into a Gradle script. Runtime imports of Maven projects will come soon.
<翻译>

Ease of migration 便于迁移
Gradle can adapt to any structure you have. Therefore you can always develop your Gradle build in the same branch where your production build lives and both can evolve in parallel. We usually recommend to write tests that make sure that the produced artifacts are similar. That way migration is as less disruptive and as reliable as possible. This is following the best-practices for refactoring by applying baby steps.
<翻译>Gradle适用于你的任何工程结构。

Groovy
Gradle‘s build scripts are written in Groovy, not XML. But unlike other approaches this is not for simply exposing the raw scripting power of a dynamic language. That would just lead to a very difficult to maintain build. The whole design of Gradle is oriented towards being used as a language, not as a rigid framework. And Groovy is our glue that allows you to tell your individual story with the abstractions Gradle (or you) provide. Gradle provides some standard stories but they are not privileged in any form. This is for us a major distinguishing feature compared to other declarative build systems. Our Groovy support is not just sugar coating. The whole Gradle API is fully Groovy-ized. Adding Groovy results in an enjoyable and productive experience.
<翻译>

The Gradle wrapper Gradle外层
The Gradle Wrapper allows you to execute Gradle builds on machines where Gradle is not installed. This is useful for example for some continuous integration servers. It is also useful for an open source project to keep the barrier low for building it. The wrapper is also very interesting for the enterprise. It is a zero administration approach for the client machines. It also enforces the usage of a particular Gradle version thus minimizing support issues.
<翻译>

Free and open source 免费和开源
Gradle is an open source project, and is licensed under the ASL.
<翻译>

2.2. Why Groovy? 使用Groovy的原因
We think the advantages of an internal DSL (based on a dynamic language) over XML are tremendous when used in build scripts. There are a couple of dynamic languages out there. Why Groovy? The answer lies in the context Gradle is operating in. Although Gradle is a general purpose build tool at its core, its main focus are Java projects. In such projects the team members will be very familiar with Java. We think a build should be as transparent as possible to all team members.
<翻译>

In that case, you might argue why we don‘t just use Java as the language for build scripts. We think this is a valid question. It would have the highest transparency for your team and the lowest learning curve, but because of the limitations of Java, such a build language would not be as nice, expressive and powerful as it could be. [1] Languages like Python, Groovy or Ruby do a much better job here. We have chosen Groovy as it offers by far the greatest transparency for Java people. Its base syntax is the same as Java‘s as well as its type system, its package structure and other things. Groovy provides much more on top of that, but with the common foundation of Java.
<翻译>既然如此

For Java developers with Python or Ruby knowledge or the desire to learn them, the above arguments don‘t apply. The Gradle design is well-suited for creating another build script engine in JRuby or Jython. It just doesn‘t have the highest priority for us at the moment. We happily support any community effort to create additional build script engines.
<翻译>对于Java开发人员来说,以上的叙述并不适用于学习Pythen语言或Ruby语言的知识或者使用它们来开发。Gradle被设计为适用于使用JRuby或者Jython来开发的另一种脚本构建引擎。这只是我们在设计之初没有给予它最高的优先权。我们很乐意通过开发社区的力量来创造更多的脚本构建引擎。

原文地址:http://www.gradle.org/docs/cur ... .html
翻译者:PFei_He
邮箱:[email protected]

如对翻译内容有异议,请在评论区提出或联系作者

时间: 2024-10-03 19:40:13

【转载】Gradle学习 第二章:概述的相关文章

转载 TCPIP学习笔记之概述

1.分层 网络协议通常分不同层次进行开发,每一层分别负责不同的通信功能.一个协议族,比如 T C P / I P,是一组不同层次上的多个协议的组合. T C P / I P通常被认为是一个四层协议系统,其示意图如下: (图1)TCP/IP协议族的四个层次 每一层负责不同的功能: 1) 链路层: 有时也称作数据链路层或网络接口层,通常包括操作系统中的设备驱动程序和计算机中对应的网络接口卡.它们一起处理与电缆(或其他任何传输媒介)的物理接口细节. 2)网络层: 有时也称作互联网层,处理分组在网络中的

【转载】Gradle学习 第一章:引言

转载地址:http://ask.android-studio.org/?/article/7 We would like to introduce Gradle to you, a build system that we think is a quantum leap for build technology in the Java (JVM) world. Gradle provides:<翻译>我们准备把Gradle介绍给你,我们认为它是一个在Java构建技术世界里具有巨大突破性的构建工

java学习第二章总结

连续上了一个星期的课,也算慢慢适应了这种紧张的学习节奏.现在来总结下第二章所学的内容: 第二章主要是讲java的基础语法,他主要由这几个方面构成:常量,变量,数据类型,关键字,标识符,运算符,表达式,注释以及语句等构成. 数据类型是java控制内存的关键元素,java通过数据类型声明来对变量或者常量进行内存空间的分配,并将其标注好名称(即标识符).不同的数据类型,所分配的空间大小都不一样:整型中byte,short,int,long所对应的空间大小分别为1,2,4,8个字节:浮点型中float,

oracle学习 第二章 限制性查询和数据的排序 ——03

这里,我们接着上一小节2.6留下的问题:如果要查询的字符串中含有"_"或"%",又该怎样处理呢? 开始今天的学习. 2.7  如何使用转义(escape)操作符 可以是用个转义(escape)关键字来完成此任务.为了进行练习,我们必须先创建一个临时的表,之后再往该表中插入1行记录,其包含通配符.可能您现在还可能十分不理解例2-13和例2-14的SQL语句.没有问题,您只要照着输入就可以了. 例 2-13 SQL> CREATE TABLE dept_temp

Java基础知识二次学习-- 第二章 基础语法与递归补充

第二章 基础语法与递归补充   时间:2017年4月24日10:39:18 章节:02章_01节,02章_02节 视频长度:49:21 + 15:45 内容:标识符,关键字与数据类型 心得:由字母,下划线,$,数字组成,应该由字母,下划线$开头,同时应该避开java保留字符 变量是内存中的一小块区域,使用变量名来访问这块区域 执行过程中的内存管理(疑问:这里的内存和Jvm的一样吗?) code segment 存放代码 data segment 静态变量 字符串常量 stack 栈 局部变量 h

linux基础学习 第二章-第四章笔记

第二章 ####linux系统结构#### linux系统结构是倒树形 /bin        ###二进制可执行文件也就是系统命令 /sbin       ###系统管理命令存放位置 /boot       ###启动分区,负责系统启动 /dev        ###设备管理文件 /etc        ###大多数系统管理文件 /home       ###普通用户的家目录 /lib        ###32位系统库文件存放位置 /lib64      ###64位系统库文件存放位置 /me

tornado的学习——第二章(模板与表单)

链接:http://demo.pythoner.com/itt2zh/ch2.html 来到了第二章:模板与表单 1 # -*- coding:utf-8 -*- 2 3 __author__ = 'roy' 4 5 import os.path 6 7 import tornado.httpserver 8 import tornado.ioloop 9 import tornado.options 10 import tornado.web 11 12 from tornado.option

Ruby学习-第二章

第二章 类继承,属性,类变量 1.如何声明一个子类 class Treasure < Thing 这样Thing类中的属性name,description都被Treasure继承 2.以下三种方式传入父类initialize方法的参数分别是什么? # This passes a, b, c to the superclass def initialize( a, b, c, d, e, f ) super( a, b, c ) end # This passes a, b, c to the s

LinQ In Action 学习第二章

第二章主要复习.net 3.0 与Linq 有关的新知识 1.隐式类型: 必须初始化不能赋值null,只是由编译器推测其类型罢了 2. 对象初始化器,集合初始化器 1,2 很简单就不介绍了 3. lamdor 表达式 涉及到委托 需要好好研究一下 委托. 4. 扩展方法 5.匿名类型