项目作者: the-floow

项目描述 :
Gradle plugin which includes build-time git repository information into a POJO / *.properties.
高级语言: Groovy
项目地址: git://github.com/the-floow/Git-Version-Gradle-Plugin.git
创建时间: 2018-02-03T13:12:38Z
项目社区:https://github.com/the-floow/Git-Version-Gradle-Plugin

开源协议:GNU Lesser General Public License v3.0

下载


Git Version Gradle Plugin

Build Status
Download

This gradle plugin provides the ability to generate a properties file containing git version information in
the same format as the maven-git-commit-id-plugin. This plugin contains some modified source code from the original maven plugin.

This properties file is generated when the build runs.

An example of the properties file is as follows:

  1. git.build.user.email=user@example.com
  2. git.build.host=mylaptop
  3. git.dirty=false
  4. git.remote.origin.url=ssh\://git@exampke.com/repository.git
  5. git.closest.tag.name=1.0.0
  6. git.commit.id.describe-short=ee93bfe
  7. git.commit.user.email=user@example.com
  8. git.commit.time=01.02.2018 @ 08\:39\:15 GMT
  9. git.commit.message.full=Adding readme file
  10. git.build.version=1.0
  11. git.commit.message.short=Adding readme file
  12. git.commit.id.abbrev=ee93bfe
  13. git.branch=master
  14. git.build.user.name=John Smith
  15. git.closest.tag.commit.count=0
  16. git.commit.id.describe=ee93bfe
  17. git.commit.id=ee93bfea8bccf0c22367f22d289b176819bec214
  18. git.tags=1.0.0
  19. git.build.time=03.02.2018 @ 14\:52\:44 GMT
  20. git.commit.user.name=John Smith

Usage

Add the plugin as a build script dependency:

  1. buildscript {
  2. dependencies {
  3. classpath 'com.thefloow:git-version-gradle-plugin:1.0.7'
  4. }
  5. }

Optionally override plugin configuration to override destination file path and the git directory:

  1. gitVersionPlugin {
  2. destinationFile = file("META-INF/version/git-${project.group}_${project.name}.properties")
  3. gitDir = file("${rootProject.projectDir}/.git")
  4. }

Notes

This requires the version to be set before this plugin runs.