The Change Log Builder Gradle plugin lets you generate and maintain a change log file based on the Git commits in your project. A change log file generated by this plugin looks like this
#
# Bundle Version 1.0.1
#
9c77ff4c95cb1a325db3bdd089be105206e8b63c^..b421f00ac84b065685b131833fecc594fc01c760=LPS-123 LPS-1321
#
# Bundle Version 1.0.2
#
b421f00ac84b065685b131833fecc594fc01c760^..bc15d8d84e12b9544f78e4e3743c510dbaec2d89=LPS-456
Every time the buildChangeLog
task is executed, a new line
is added to the change log, which lists all Git commit prefixes
(usually issue ticket IDs) that occurred in a certain range. The end of the
range is always the tip of the current branch. The start range can vary,
depending on the case:
- If
buildChangeLog
has never been executed for the project, the change log does not exist. Therefore, the most recent commit from two years ago is used for the range start. - If a change log already exists for your project, the start range begins at the range end of the last line in the change log.
The plugin has been successfully tested with Gradle 4.10.2.
Usage
To use the plugin, include it in your build script:
buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins.change.log.builder", version: "1.1.3"
}
repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
}
apply plugin: "com.liferay.change.log.builder"
Tasks
The plugin adds one task to your project:
Name | Depends On | Type | Description |
---|---|---|---|
buildChangeLog | - | BuildChangeLogTask | Builds the change log file for this project. |
The buildChangeLog
task is automatically configured with sensible defaults,
depending on whether the java
plugin is applied:
Property Name | Default Value |
---|---|
changeLogHeader | "Bundle Version ${project.version}" |
changeLogFile | If the Otherwise: |
dirs | [project.projectDir] |
BuildChangeLogTask
Task Properties
The properties of type File
support any type that can be resolved by project.file
.
Moreover, it is possible to use Closures and Callables as values for the
String
properties to defer evaluation until task execution.
Task Methods
Method | Description |
---|---|
BuildChangeLogTask dirs(Iterable<?> dirs) | Adds directories to consider when listing the commits in the range specified. |
BuildChangeLogTask dirs(Object... dirs) | Adds directories to consider when listing the commits in the range specified. |
BuildChangeLogTask ticketIdPrefixes(Iterable<String> ticketIdPrefixes) | Adds valid prefixes of the Git commit messages to add to the change log. |
BuildChangeLogTask ticketIdPrefixes(String... ticketIdPrefixes) | Adds valid prefixes of the Git commit messages to add to the change log. |