Git Product home page Git Product logo

mld-git-version's Introduction

mld-git-version

A Gradle plugin that sets various properties available for use as the version based on the git repository.

Travis (.com) branch Version GitHub

Published to Gradle Plugins

Description

After applying the plugin, it will expose 5 properties based on the git repository:

  • gitVersion The current version based on the most recent tag on the current git branch. Examples:
    • HEAD is tagged as v1.0.0 and the git status is clean, the value would be v1.0.0.
    • HEAD is tagged as v1.0.0 and the git status is not clean, the value would be v1.0.0-1-SNAPSHOT.
    • HEAD^ is tagged as v1.0.0, the git status is clean, and commit hash of HEAD is 1a4440f73d7c91b53dacc072e1eab03516477c94 the value would be v1.0.0-1-g1a4440f7.
    • HEAD^ is tagged as v1.0.0, the git status is not clean, and commit hash of HEAD is 1a4440f73d7c91b53dacc072e1eab03516477c94 the value would be v1.0.0-2-SNAPSHOT.
  • gitCommitCount The number of commits on the current git branch.
  • gitTagCount The number of tags on the current git branch.
  • gitCommitAndTagCount The number of commits and tags on the current git branch.
  • gitBranchName The current git branch.

Usage

plugins {
    id "com.moonlitdoor.git-version" version "0.0.7"
}

task demo {
    doLast {
        println "gitVersion='$gitVersion'"
        println "gitCommitCount='$gitCommitCount'"
        println "gitTagCount='$gitTagCount'"
        println "gitCommitAndTagCount='$gitCommitAndTagCount'"
        println "gitBranchName='$gitBranchName'"
    }
}
$ gradlew -b build.groovy.gradle demo

> Task :demo
gitVersion='0.0.5-5-SNAPSHOT'
gitCommitCount='17'
gitTagCount='5'
gitCommitAndTagCount='22'
gitBranchName='master-1-SNAPSHOT'

BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
plugins {
    id("com.moonlitdoor.git-version") version "0.0.7"
}

tasks.register("demo") {
    doLast {
        println("gitVersion='$gitVersion'")
        println("gitCommitCount='$gitCommitCount'")
        println("gitTagCount='$gitTagCount'")
        println("gitCommitAndTagCount='$gitCommitAndTagCount'")
        println("gitBranchName='$gitBranchName'")
    }
}
$ gradlew -b build.kotlin.gradle.kts demo

> Task :demo
gitVersion='0.0.5-5-SNAPSHOT'
gitCommitCount='17'
gitTagCount='5'
gitCommitAndTagCount='22'
gitBranchName='master-1-SNAPSHOT'

BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed

	allprojects {
		repositories {
			maven { url 'https://jitpack.io' }
		}
	}
	dependencies {
    	        implementation 'com.github.moonlitdoor:mld-git-version:master-SNAPSHOT'
    	}

Issue Tracking

Want to file a bug? Want to suggest an idea? Add an issue.

License

All Moonlit Door Software is licensed under the MIT License.

Contributing

Please see CONTRIBUTING.md for details of how to build and contribute to the project.

mld-git-version's People

Contributors

ramesbury avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ayedo 0xfaulty

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.