Skip to content

Sample Gradle plugin demonstrating established techniques and practices for plugin development

License

Notifications You must be signed in to change notification settings

jonbullock/gradle-site-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gradle Site Plugin Build Status Build Scan

A sample Gradle plugin demonstrating established techniques and practices for plugin development as described in the following guides:

Functionality

The plugin provides a task for generating a web page that derives information about the project e.g. applied plugins and available tasks. While minimalistic in functionality it serves as a show case for demonstrating best practices for Gradle plugin development. A site generated for a sample project can be viewed here.

Tip
The plugin is available on the Gradle plugin portal for public consumption.

Usage example

The plugin can be applied with by identifier org.gradle.site. Default values can be configured with the help of the provided extension org.gradle.plugins.site.SitePluginExtension. To generate the web page run the task named generateSite e.g. gradle generateSite.

Important
The plugin requires a Gradle version of 4.0 or higher. All features that are based on Gradle 4.0 are explicitly marked above. All other features will work with earlier versions of Gradle.
apply plugin: 'com.github.gradle-guides.site'

site {
    outputDir = file("$buildDir/site")
    websiteUrl = 'http://gradle.org'
    vcsUrl = 'https://github.com/gradle-guides/gradle-site-plugin'
}

Applied techniques and practices

  • Production source code written in Java, test code written in Groovy with Spock framework.

  • Reusable logic written as binary plugin.

  • Usage of the Plugin Development plugin to simplify plugin development. [Code | More Details]

  • Implementation of tasks as custom task type. [Code | More Details]

  • Usage of input and output properties to enable incremental tasks. [Code | More Details]

  • Usage of an extension to capture user-configurable values. [Code | More Details]

  • Mapping of extension property values to custom task properties. [Code | More Details] 4.0 feature

  • Reacting to plugins instead of applying plugins. [Code | More Details]

  • Declaration of appropriate plugin identifiers. [Code | More Details]

  • Functional testing with TestKit. [Code | More Details]

  • Continuous Integration of plugin code with Travis CI. [Code | More Details]

  • Automatic generation of build scans when build is executed from CI. [Code | More Details]

About

Sample Gradle plugin demonstrating established techniques and practices for plugin development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published