Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/neoforged/gradleutils

Gradle buildscript utility library for NeoForged projects
https://github.com/neoforged/gradleutils

gradle-plugin hacktoberfest versionning

Last synced: 24 days ago
JSON representation

Gradle buildscript utility library for NeoForged projects

Awesome Lists containing this project

README

        

# GradleUtils

**GradleUtils** is a support plugin for NeoForged projects, which provides Git-based versioning and changelog
generation.

## Usage

Apply the plugin to the buildscript as normal (substitute the version with the latest version):

```gradle
plugins {
id 'net.neoforged.gradleutils' version '3.0.0'
}
```

### Versioning

The `gradleutils` project extension provides access to versioning. To apply the versioning configured in GradleUtils,
use the `version` property on the extension. The returned object will calculate the version when `toString()`ed.

Configuring the versioning is done through the related `version` spec on the extension. (The difference is that
the property to access the calculated version does not accept a closure.) Configuration should be done _before_ the
first time the version is calculated.

```gradle
gradleutils.version {
// ... configure the version here ...
}
project.version = gradleutils.version
```

### Changelog generation

The `changelog` project extension provides access to changelog generation. The changelog generation will use the same
versioning configuration, as configured in the `gradleutils` project extension.

To generate a changelog, simply call the `from` method on the extension with the earliest revision (tag or commit ID) to
be included. The changelog is generated by the `createChangelog` task, which is linked to the `assemble` task.

By default, the changelog is included in all `MavenPublication` on the project as an artifact with the `-changelog`
classifier, if the `maven-publish` plugin is applied. To manually control the changelog's publishing, call
`disableAutomaticPublicationRegistration()` on the extension, and use the `publish(MavenPublication)` method to attach
the changelog to publications as desired.

```gradle
changelog {
from '2.0'
// For fine-grained changelog publication control
disableAutomaticPublicationRegistration()
}

publishing {
publications {
mavenJava(MavenPublication) {
// ...
changelog.publish(it) // 'it' refers to the 'mavenJava' publication
}
}
}
```

### Spotless

The `net.neoforged.gradleutils.spotless` plugin provides integration (a formatter configuration) with Spotless.
The Spotless plugin must be manually applied to the buildscript, as GradleUtils does not apply it automatically.
This plugin also requires Gradle to run with at least Java 11, much like Spotless does.

This plugin provides a `spotlessUtils` extension which has a `configure` method that can be called with the `spotless` extension to configure Spotless and use the formatter configuration provided by GradleUtils:
```gradle
spotlessUtils {
configure(spotless)
}
```

## License

This project is licensed under the GNU Lesser General Public License, or LGPL, version 2.1 only. See the `LICENSE` file
for the full license text.