Plugins to configure Gradle to build projects (including other Gradle pluging) developed by FIDATA. They provide reasonable defaults and sane environment for all our projects.
These plugins are highly opinionated and for internal use only. They are not to be published to Maven Central or Gradle Plugins portal. However, you are free to fork, modify or use it as an example according to LGPL v3.0+ license.
If you are contributing to other FIDATA plugins the best choice is to join FIDATA organization and use all available infrastructure including our Artifactory repository where these plugins live.
General, language-agnostic project.
Basic build lifecycle is assemble → check → release.
assemble, check and, also, clean tasks are provided by applied
lifecycle-base plugin.
release task is provided by applied de.gliderpilot.semantic-release
plugin.
-
Applies
org.fidata.prerequisitesproviding tasks for dealing with prerequisites managed by Gradle, Bundler, NPM and similar tools.To report outdated Gradle dependencies
com.github.ben-manes.versionsplugin is used. -
Configures
wrappertask to specific Gradle version
-
Adds Maven repository hosted on FIDATA Artifactory
For releases, it is always
-releaserepository, so releases cannot have snapshot dependencies. Otherwise it is-snapshotrepository, so snapshot versions could be used during development (but won't by default - see below). -
Turns off changing modules caching, so that SNAPSHOT dependencies are updated on each run
-
Configures dependency resolution changing Ivy status from
releasetomilestonefor artifacts having pre-release labels in version -
Adds property
statusto eachExternalModuleDependencyinstance. It should be used to configure desired status of dependency. By default all dependencies are resolved toreleases, even if you use version ranges. If you want to get bleeding edgeSNAPSHOTversion you could use this property, like this:dependencies { compile('com.example:next-generation-library:[1, 2[').status = 'integration' }Of course, if there is more recent
releasewith appropriate version then it will be used instead of oldSNAPSHOT.Custom status schemes are not supported.
-
Applies and configures
org.ajoberstar.git-publishpluginAllows to publish documentation to GitHub pages.
-
Provides
noJekylltask that generates.nojekyllfile to turn off Jekyll processing
-
Provides
linttaskchecktask depends on allTesttasks and newlinttask. -
Applies
codenarcplugin -
Provides
codenarcandpmdtasks that run all PMD and CodeNarc tasks respectively.Includes these tasks in execution list for
linttask. -
Provides
codenarcBuildSrctask forbuild.gradleitself and accompanying Groovy scripts -
Sets default configuration for all
codenarctasksAdds
disabledRulesproperty to each task, so that specific rules could be disabled per task.
-
Applies
signingpluginBy default, Java-based implementation of PGP is used. Secret keyring should be placed at GnuPG home in
secring.gpgfile.If you want to use GnuPG for signing, properties for this are already set. Switch can be made with
signing.useGpgCmd(). -
Provides read-only
isReleaseandchangeLogproject properties for working with semantic release -
Provides
publicReleasesproject property used by other pluginsSetting it to true turns on all public-release tasks: publishing artifacts to Maven Central, JCenter and so on.
By default it is false.
-
Provides read-only project properties:
reportsDirhtmlReportsDirxmlReportsDirjsonReportsDirtxtReportsDir
-
Applies and configures
reporting-basepluginRedirects all reports to
build/reports/<format>directory.Known limitation:
gradle --profilereports are not redirected. They stay inbuild/reports/profiledirectory for now. See #1
-
Applies plugins:
-
Provides
projectReportand other tasks. -
Provides
taskTreetask. It is wonderful in troubleshooting task dependencies.
-
-
Provides
inputsOutputstask which generates reports about all task file inputs and outputs
All these tasks are put into Diagnostics group.
-
Applies and configures
com.jfrog.artifactorypluginAllows us to publish artifacts and build info to FIDATA Artifactory .
-
Sets project's
grouptoorg.fidataif it hasn't been set already -
Provides
licenseproperty used by other pluginsIt should be set with SPDX license identifier .
-
Provides
generateChangelogandgenerateChangelogTxttasks that generate changelog in Markdown and text formats inbuild/changelogdirectoryThe main usage is to check generated changelog during release preparation to make sure that everything is correct.
-
Provides
tagsproperty used by other plugins -
Applies
nebula.contactspluginProvides
contactsextension.
Earlier in the history
we tried to use GitFlow. But it didn't work out well.
GitHub doesn't support fast-forward merges. So, there was a big mess
each time we merged from develop to master.
Also, this led to unnecessary rebuilds on Jenkins.
Our current workflow resembles GitHub workflow and OneFlow.
-
We make all development in
feature/…andhotfix/…branches, and maybe branches with some other prefixes -
All work is merged to
mastervia PRs with merge commits -
mastershould be release-able any time. But actual releases are manually triggered. Gradle'sreleasetask will make a release only whenshouldReleaseproject property is passed and set to true. This could be done from command line, like./gradlew release -PshouldRelease=true, of manually via parameter of Jenkins build. -
We don't have
developbranch with the same purpose as in GitFlow. But we can usedevelopbranch for general/various improvements when there is no uniquefeatureorhotfixto describe changes. In this case we merge PR with rebase merging -
We don't use
releasebranches and don't support several major/minor releases simultaneously
Plugin can be applied to buildSrc projects. However, buildSrc projects can't have releases and documentation, so all related features are turned off. They also don't publish build info to Artifactory.
They could have code quality and diagnostic tasks, but usage of them
is discouraged. Note that all buildSrc's Gradle and Groovy scripts
are already covered by codenarcBuildSrc task.
Project gets isBuildSrc read-only property which will be set to true
when buildSrc project is detected.
-
Requires Gradle >= 5.1
-
Built and tested with JDK 8
-
Requires GnuPG >= 2.1
gpg-agentshould haveallow-preset-passphraseoption turned on if GPG key with passphrase is used. It is usually achieved by adding this string intogpg-agent.conffile in GPG home directory.gpg-preset-passphraseshould be available in the path.
Project which uses JVM-based language. This plugin should not be applied manually.
Applies org.fidata.project plugin,
and also:
-
Applies
java-baseandjava-libraryplugins -
Provides
jvmextension. This extension has one propertyjavadocLinks.It contains links to external documentation used by
javadocandgroovydoc. If a dependency is added automatically, its documentation is also added here automatically. Otherwise, you add link manually, like this:jvm.javadocLinks['com.example.super.cool.external.library'] = uri('https://example.com/javadoc/com/example/super.cool.external.library/1.0/') -
Adds
mavenJavapublication (except whenorg.fidata.pluginis applied)
-
Adds JUnit dependency to
testImplementationconfiguration -
Adds and configures
functionalTestsource set and task which uses Spock frameworkAlso adds Spock Reports.
JUnit is also available whenever Spock is.
-
Applies
maven-publishpluginConfigures Maven publication to Artifactory.
If
publicReleasesis on — configures publication to Maven Central. -
If
publicReleasesis on — appliescom.jfrog.bintrayplugin and configures publication to JCenter
-
Provides
findbugsandjdependtasks that run all FindBugs and JDepend tasks respectively.Includes these tasks in execution list for
linttask.
- Adds license file(s) into JAR
META-INFdirectory
Java language project.
Applies org.fidata.base.jvm plugin,
and also:
-
Applies
javaplugin -
Applies
io.franzbecker.gradle-lombokplugin providing Lombok for Java sources -
Configures
javadocto parse sources through Delombok first -
Adds
javadocoutput to GitHub Pages publication -
Provides
checkstyletask that run all Checkstyle tasks.Includes this task in execution list for
linttask.
Project which uses Groovy language. This plugin should not be applied manually.
Applies org.fidata.base.jvm plugin,
and also:
- Applies
groovy-baseplugin
Groovy language project.
Applies org.fidata.base.groovy plugin,
and also:
-
Applies
groovyplugin -
Adds local Groovy to
apiconfiguration -
Adds
groovydocoutput to GitHub Pages publication
Gradle plugin project.
This plugin depends on at least one of JVM-based project plugins:
or others developed later.
They have to be applied manually depending on the language(s) used in the project.
-
Applies
java-gradle-pluginplugin -
Configures
groovydoclinks to Gradle API -
Adds Gradle TestKit dependency to
functionalTestsource set configurations -
Applies
org.ysb33r.gradletestandorg.ajoberstar.stutterpluginsProvides and configures
gradleTestandcompatTestsource sets. Allows us to test plugins under several different Gradle versions. -
If
publicReleasesis on — appliescom.gradle.plugin-publishpluginpluginBundle.pluginsshould be configured manually. Other properties are set automatically. -
Sets project's
grouptoorg.fidata.gradleif it hasn't been set already
Should be provided in standard Gradle ways .
| Property | Requiring Plugin | Usage | Notes |
|---|---|---|---|
artifactoryUser | org.fidata.project | Getting build tools and dependencies from Artifactory; use Gradle cache | |
artifactoryPassword | It is actually API key | ||
gitUsername | Git push during release | ||
gitPassword | |||
ghToken | Create release on GitHub | ||
gpgKeyId | Sign artifacts, git commits and git tags | ||
gpgKeyPassphrase | Not required. Assumes no passphrase if not provided | ||
mavenCentralUsername | org.fidata.base.jvm for public releases | Release to Bintray | |
mavenCentralPassword | |||
bintrayUser | org.fidata.base.jvm for public releases | Release to Bintray | |
bintrayAPIKey | |||
gradlePluginsKey | org.fidata.plugin for public releases | Release to Gradle Plugins portal | |
gradlePluginsSecret |
All properties except gpgKeyPassphrase are required. The plugin
won't work if they are not set.
These plugins supports multi-project builds in the following configuration:
-
All child projects have the same version as the root one. This is the limitation imposed by
de.gliderpilot.semantic-releaseplugin. -
org.fidata.projectshould be applied to root. It applies itself to each subproject -
de.gliderpilot.semantic-releaseandorg.ajoberstar.git-publishplugins are applied to root only. -
The following properties are available for root project only:
isBuildSrcisReleasechangeLogchangeLogTxtissuesUrlvcsUrl
Except these, all other is configurable per project.
Note that subprojects can have different licenses, and license file(s) (being included in JARs) are per project.
-
Reports for all subprojects are redirected to
build/reports/<format>/<subproject>directory. This is made for convenient usage under CI (Jenkins)
This is self-applying plugin. That means that build script requires
the plugin itself (just compiled, not released to the repository).
So, if there are any errors during compilation or plugin applying,
Gradle build script just doesn't work.
If it is a compilation error, you can run ../gradlew build
in buildSrc directory to figure out what's going on.
Whenever new Gradle version is released, the way to upgrade is this:
- Read Release Notes and make necessary changes to the code
- Run
./gradlew stutterWriteLock - Run
./gradlew compatTest<new Gradle version> - Change Gradle version for
wrappertask in plugin code - Run
./gradlew wrapper && ./gradlew wrapper
If a new version of a plugin won't be compatible with previous Gradle versions:
- Update
ProjectPlugin.GRADLE_MINIMUM_SUPPORTED_VERSIONvalue - Run
./gradlew stutterWriteLock - Update required Gradle version in this README file
Copyright © Basil Peace
This file is part of gradle-base-plugins.
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.