A simple Github template that lets you create a Gradle Plugin ? project using 100% Kotlin and be up and running in a few seconds.
This template is focused on delivering a project with static analysis and continuous integration already in place.
How to use ?
Once created don’t forget to update the:
- Plugin Coordinates
- Plugin Usages (search for com.ncorti.kotlin.gradle.template in the repo and replace it with your ID).
- 100% Kotlin-only template.
- Plugin build setup with composite build.
- 100% Gradle Kotlin DSL setup.
- Dependency versions managed via
- CI Setup with GitHub Actions.
- Kotlin Static Analysis via
- Publishing-ready to Gradle Portal.
- Issues Template (bug report + feature request)
- Pull Request Template.
Composite Build ?
This template is using a Gradle composite build to build, test and publish the plugin. This means that you don’t need to run Gradle twice to test the changes on your Gradle plugin (no more
publishToMavenLocal tricks or so).
The included build is inside the plugin-build folder.
preMerge task on the top level build is already provided in the template. This allows you to run all the
check tasks both in the top level and in the included build.
You can easily invoke it with:
If you need to invoke a task inside the included build with:
./gradlew -p plugin-build <task-name>
Please note that the project relies on module name/group in order for dependency substitution to work properly. If you change only the plugin ID everything will work as expected. If you change module name/group, things might break and you probably have to specify a substitution rule.
This template is ready to let you publish to Gradle Portal.
Please note that you need to configure two secrets:
GRADLE_PUBLISH_SECRET with the credetials you can get from your profile on the Gradle Portal.
100% Kotlin ?
Moreover, a minimalistic Gradle Plugin is already provided in Kotlin to let you easily start developing your own around it.
Static Analysis ?
This template is using GitHub Actions as CI. You don’t need to setup any external service and you should have a running CI once you start using this template.
There are currently the following workflows available:
- Validate Gradle Wrapper – Will check that the gradle wrapper has a valid checksum
- Pre Merge Checks – Will run the
preMergetasks as well as trying to run the Gradle plugin.
- Publish to Plugin Portal – Will run the
publishPlugintask when pushing a new tag.
Feel free to open a issue or submit a pull request for any bugs/improvements.
This template is licensed under the MIT License – see the License file for details.
Please note that the generated template is offering to start with a MIT license but you can change it to whatever you wish, as long as you attribute under the MIT terms that you’re using the template.