第四十九章. 构建仪表盘插件

Chapter 49. The Build Dashboard Plugin

构建仪表盘插件目前是一个试验性插件。注意,在以后的 Gradle 版本中,其 DSL 和其他配置可能会有变化。
The build dashboard plugin is currently incubating. Please be aware that the DSL and other configuration may change in later Gradle versions.

Build Dashboard 插件可以用于生成单个 HTML 仪表盘,该仪表盘提供对构建所生成的所有报告的单点访问。
The Build Dashboard plugin can be used to generate a single HTML dashboard that provides a single point of access to all of the reports generated by a build.

49.1. 用法

49.1. Usage

要使用 Build Dashboard 插件,请在构建脚本中包含以下内容:
To use the Build Dashboard plugin, include the following in your build script:

示例 49.1 使用 Build Dashboard 插件 - Example 49.1. Using the Build Dashboard plugin

build.gradle

apply plugin: 'build-dashboard'

应用插件会将 buildDashboard 任务添加到项目。 此任务将聚合了在构建中从 所有项目 实现了 报告 接口的所有任务的报告。 它通常仅应用于根项目。
Applying the plugin adds the buildDashboard task to your project. The task aggregates the reports for all tasks that implement the Reporting interface from all projects in the build. It is typically only applied to the root project.

buildDashboard 任务不依赖于任何其他任务。 它只聚合在构建运行过程中独立执行的报告任务。 要生成构建仪表盘,只需在要执行的任务列表中包含 buildDashboard 任务。 例如,gradle buildDashboard build 将为 build 任务所依赖的所有报告任务生成仪表盘。
The buildDashboard task does not depend on any other tasks. It will only aggregate the reporting tasks that are independently being executed as part of the build run. To generate the build dashboard, simply include the buildDashboard task in the list of tasks to execute. For example, gradle buildDashboard build will generate a dashboard for all of the reporting tasks that are dependents of the build task.

49.2. 任务

49.2. Tasks

Build Dashboard 插件向项目中添加以下任务:
The Build Dashboard plugin adds the following task to the project:

表 49.1. Build Dashboard 插件——任务 - Table 49.1. Build Dashboard plugin - tasks

任务名称
Task name
依赖于
Depends on
类型
Type
描述
Description
buildDashboard - GenerateBuildDashboard 生成构建仪表板报告。
Generates build dashboard report.

49.3. 项目布局

49.3. Project layout

Build Dashboard 插件不需要任何特定的项目布局。
The Build Dashboard plugin does not require any particular project layout.

49.4. 依赖管理

49.4. Dependency management

Build Dashboard 插件没有定义任何的依赖配置。
The Build Dashboard plugin does not define any dependency configurations.

49.5. 配置

49.5. Configuration

你可以通过 ReportingExtension 修改构建仪表盘插件生成内容的位置。
You can influence the location of build dashboard plugin generation via ReportingExtension.