Gradle-about-plugin

From Evgeny Goldin

Jump to: navigation, search

Introduction

Identically to "about-maven-plugin" this plugin adds textual "about" file to build artifacts created, linking each binary artifact to the build environment and sources it was created with.

The file added contains details about build date and time, last commit made in the project, Java / Gradle versions used for build and some other optional elements like project dependencies, local paths, system and environment variables. If the project was built by Jenkins, TeamCity or Hudson build server then corresponding job details are also added to the file generated.

For example, this jar file contains the following file in "META-INF/about-com.github.goldin-gcommons-0.5.4.txt":


 Generated by http://evgeny-goldin.com/wiki/Gradle-about-plugin
===============================================================================
 Git Info
===============================================================================
 Repositories  : [origin	git@github.com:evgeny-goldin/gcommons.git (fetch)
                  origin	git@github.com:evgeny-goldin/gcommons.git (push)]
 Branch        : [master]
 Project Status: [# On branch master
                  nothing to commit (working directory clean)]
 Last Commit   : [c1478bcfc554087ab6958eee5c78f46e1bbce5a0]
 Commit Date   : [Thu May 10 22:19:32 2012 +0200]
 Commit Author : [Evgeny Goldin <evgenyg@gmail.com>]
===============================================================================
 Build Info
===============================================================================
 Host          : [evgeny-goldin.org]
 Build Time    : [10 May, Thursday, 2012, 23:41:41 (Israel Daylight Time:GMT+0300)]
 User          : [evgenyg]
 Java          : [1.6.0_30][Sun Microsystems Inc.][Java HotSpot(TM) 64-Bit Server VM]
 OS            : [Linux][amd64][2.6.35-32-server]
===============================================================================
 Gradle Info
===============================================================================
 GRADLE_OPTS   : [-DgroovydocDir=/home/evgenyg/java/tomcat/webapps/groovydoc//gcommons/]
 Version       : [1.0-rc-3]
 Project       : [root project 'gcommons']
 Tasks         : [clean, build, about, groovydoc, artifactoryPublish]
 Coordinates   : [com.github.goldin:gcommons:0.5.4]
 Dependencies  : [--------------------------------------------------------------------------------
                  archives - Configuration for archive artifacts.
                  No dependencies
                  --------------------------------------------------------------------------------
                  codenarc
                  \--- org.codenarc:CodeNarc:0.17 [default]
                       +--- log4j:log4j:1.2.13 [compile,master,runtime]
                       +--- org.gmetrics:GMetrics:0.5 [compile,master,runtime]
                       |    +--- log4j:log4j:1.2.13 [compile,master,runtime] (*)
                       |    +--- org.codehaus.groovy:groovy-all:1.7.5 [compile,master,runtime]
                       |    \--- org.apache.ant:ant:1.7.1 [compile,master,runtime]
                       |         \--- org.apache.ant:ant-launcher:1.7.1 [compile,master,runtime]
                       +--- org.codehaus.groovy:groovy-all:1.7.5 [compile,master,runtime] (*)
                       \--- org.apache.ant:ant:1.7.1 [compile,master,runtime] (*)
                  --------------------------------------------------------------------------------
                  compile - Classpath for compiling the main sources.
                  +--- com.google.inject:guice:3.0 [default]
                  |    +--- javax.inject:javax.inject:1 [compile,master,runtime]
                  |    +--- aopalliance:aopalliance:1.0 [compile,master,runtime]
                  |    \--- org.sonatype.sisu.inject:cglib:2.2.1-v20090111 [compile,master,runtime]
                  +--- org.codehaus.groovy:groovy-all:1.8.6 [default]
                  +--- org.gcontracts:gcontracts-core:1.2.5 [default]
                  ...
                  --------------------------------------------------------------------------------
                  runtime - Classpath for running the compiled main classes.
                  +--- com.google.inject:guice:3.0 [default]
                  |    +--- javax.inject:javax.inject:1 [compile,master,runtime]
                  |    +--- aopalliance:aopalliance:1.0 [compile,master,runtime]
                  |    \--- org.sonatype.sisu.inject:cglib:2.2.1-v20090111 [compile,master,runtime]
                  +--- org.codehaus.groovy:groovy-all:1.8.6 [default]
                  +--- org.gcontracts:gcontracts-core:1.2.5 [default]
                  ...
===============================================================================
 TeamCity Info
===============================================================================
 Project Name  : [gcommons]
 Build Config  : [Release Deploy]
 Build Number  : [5]
===============================================================================


Configuration used:

apply plugin: 'about'
 
..
 
buildscript {
    repositories { mavenRepo url: 'http://evgenyg.artifactoryonline.com/evgenyg/repo/' }
    dependencies { classpath      'com.github.goldin:gradle:0.1.3' }
}
 
about { dumpDependencies = true   }

And then:

gradle clean build about


Details

Provided By
Source Code GitHub
Issue Tracker YouTrack
Build Server Gradle
TeamCity
Repository,
Coordinates
Artifactory
buildscript {
    repositories { mavenRepo url: 'http://evgenyg.artifactoryonline.com/evgenyg/repo/' }
    dependencies { classpath      'com.github.goldin.plugins:gradle:0.1.3' }
}


Settings

Name Type Default value Description
about.prefix String "META-INF" Archive directory where "about" file is created.

Use "/" if "about" file should be added to archive's root.

about.fileName String "about-<group>-<name>-<version>.txt" Name of the file created.
about.dumpSCM boolean true Whether SCM details should be added to "about" file.

Currently, Git and SVN are recognized automatically but their command-line clients are expected to be installed on a build machine (this will be changed in future versions).

Make sure the corresponding ".git" and ".svn" folders are available where your project is built. In TeamCity, for example, it requires "VCS checkout mode" to be "Automatically on agent" in project's VCS settings.

about.dumpEnv boolean false Whether environment variables should be added to "about" file.
about.dumpSystem boolean false Whether Java system properties should be added to "about" file.
about.dumpPaths boolean false Whether various build paths (Gradle home, build directory, etc) should be added to "about" file.
about.dumpDependencies boolean false Whether project transitive dependencies, those you get by running "gradle dependencies", should be added to "about" file.
about.gitStatusProject boolean true If "true" - "git status" is run for the whole project. Otherwise it is run for the module being built.
about.endOfLine String "windows" If "windows" - end of line in the file created is "\r\n". For any other value it is "\n".
about.directory File Jar.destinationDir Directory where archives to update are located.
about.include String "*.jar" Comma-separated list of archive patterns to update.
about.exclude String Comma-separated list of archive patterns to exclude from update.
Personal tools