Table of Contents

Properties

Methods

Script blocks

Property details

Method details

Overview

这个对象代表了Gradle 的一个执行 …
能够通过Project.getGradle 获取一个Gradle 实例 ..
API 文档

Properties

Property Description
gradle 返回Gradle 实例,这个方法在初始化脚本中能够显式的访问Gradle 的属性和方法 ..
例如,使用gradle.parent 看起来比直接使用parent更好 ..
这个属性能够允许访问来自一个范围的Gradle 属性 …
这个属性也许是被隐藏的或者来自一个方法或者闭包…
gradleHomeDir The Gradle home directory, if any. This directory is the directory containing the Gradle distribution executing this build.
gradle 的家目录,可以是任意 ..
这个目录是包含了执行此次构建的Gradle 发布版的目录
gradleUserHomeDir The Gradle user home directory. This directory is used to cache downloaded resources, compiled build scripts and so on.
Gradle 的用户家目录,这个目录被用来缓存下载的资源,编译的构建脚本等等 …
gradleVersion The current Gradle version.
当前的gradle 的版本
includedBuilds The included builds for this build.
此次构建的包括的构建 .. => include builds
parent The parent build of this build, if any.
此次构建的父亲构建
pluginManager The plugin manager for this plugin aware object.
插件感知对象的插件管理器
plugins The container of plugins that have been applied to this object.
已经应用到这个对象的插件的容器 …
rootProject The root project of this build.
此构建的根项目
startParameter The StartParameter used to start this build.
开始此次构建的启动参数 …
taskGraph The TaskExecutionGraph for this build.
此次构建的任务执行图层 …

Methods

Method Description
addBuildListener)
(buildListener)
增加一个BuildListener到此次构建实例中 …
这个监听器会在构建执行期间触发事件通知 ..
addListener)
(listener)
增加给定的监听器到构建中,监听器实现指定的接口
addProjectEvaluationListener)
(listener)
Adds a listener to this build, to receive notifications as projects are evaluated.
接收项目评估的监听器
afterProject)
(closure)
Adds a closure to be called immediately after a project is evaluated. The project is passed to the closure as the first parameter. The project evaluation failure, if any, is passed as the second parameter. Both parameters are optional.
添加在评估项目后立即调用的闭包。项目作为第一个参数传递给闭包。项目评估失败(如果有)作为第二个参数传递。两个参数都是可选的
afterProject)
(action)
Adds an action to be called immediately after a project is evaluated.
项目评估之后立即调用增加的action . .
allprojects)
(action)
Adds an action to execute against all projects of this build. The action is executed immediately against all projects which are already available. It is also executed as subsequent projects are added to this build.
此次构建的所有项目执行完毕之后执行增加的action ..
这个action 会在所有的项目已经可用时立即执行 ..
它也会在后续项目增加到构建中执行 …
apply)
(closure)
Applies zero or more plugins or scripts.
应用零个或者多个插件或者脚本 …
apply)
(options)
Applies a plugin or script, using the given options provided as a map. Does nothing if the plugin has already been applied.
使用给定的选项(map) 应用一个插件或者脚本
如果插件已经被应用,那么不做任何事情
apply)
(action)
Applies zero or more plugins or scripts.
应用零个或者多个脚本/插件(action)
beforeProject)
(closure)
Adds a closure to be called immediately before a project is evaluated. The project is passed to the closure as a parameter.
beforeProject)
(action)
Adds an action to be called immediately before a project is evaluated.
项目评估之前立即调用action
buildFinished)
(closure)
deprecated
Adds a closure to be called when the build is completed. All selected tasks have been executed. A BuildResult instance is passed to the closure as a parameter.
当构建完成的时候 调用增加的闭包,所有的选择的任务已经被执行 ..
一个BuildResult将会作为闭包的参数传递 …
buildFinished)
(action)
deprecated
Adds an action to be called when the build is completed. All selected tasks have been executed.
action(构建完成时调用)
includedBuild)
(name)
Returns the included build with the specified name for this build.
返回对此构建的特定的名称的包含构建
projectsEvaluated)
(closure)
Adds a closure to be called when all projects for the build have been evaluated. The project objects are fully configured and are ready to use to populate the task graph. This Gradle instance is passed to the closure as a parameter.
在此构建中的所有项目评估完成之后调用增加的闭包 ..
这个项目对象时完全配置好的并且准备好被用来收集任务图 ..
Gradle 实例作为参数传递给闭包 …
projectsEvaluated)
(action)
Adds an action to be called when all projects for the build have been evaluated. The project objects are fully configured and are ready to use to populate the task graph.
同上,使用action …
projectsLoaded)
(closure)
Adds a closure to be called when the projects for the build have been created from the settings. None of the projects have been evaluated. This Gradle instance is passed to the closure as a parameter.
当此构建中的项目已经根据settings创建 ..
但是没有项目已经被评估 ..
这个Gradle 实例将作为参数传递给闭包 ..
projectsLoaded)
(action)
Adds an action to be called when the projects for the build have been created from the settings. None of the projects have been evaluated.
同上 使用action
removeListener)
(listener)
Removes the given listener from this build.
移除给定的监听器 ..
removeProjectEvaluationListener)
(listener)
Removes the given listener from this build.
从构建中移除给定监听器 .
rootProject)
(action)
Adds an action to execute against the root project of this build. If the root project is already available, the action is executed immediately. Otherwise, the action is executed when the root project becomes available.

为此构建的根项目增加action执行 ..
如果根项目已经可用,那么action 将立即执行 ..
否则,当根项目可用的时候才执行 …
settingsEvaluated)
(closure)
Adds a closure to be called when the build settings have been loaded and evaluated. The settings object is fully configured and is ready to use to load the build projects. The Settings object is passed to the closure as a parameter.

当构建配置已经被加载并评估 的时候调用增加的闭包 ..
这个settings 对象是全面配置的并且准备好用来加载构建项目. ..
这个Settings对象将作为参数传递到闭包中 ….
settingsEvaluated)
(action)
Adds an action to be called when the build settings have been loaded and evaluated. The settings object is fully configured and is ready to use to load the build projects.
同上 使用action …
useLogger)
(logger)
Uses the given object as a logger. The logger object may implement any of the listener interfaces supported by Gradle.addListener(java.lang.Object))
使用给定的对象作为日志器 ..
也许需要实现由Gradle.addListener支持的监听器接口的类型 …

Property details

查看Gradle 官网更好 .. 点击前往