Extract version number from git
This commit is contained in:
parent
9200ee2e2e
commit
f77d8709ae
16
build.gradle
16
build.gradle
|
@ -5,6 +5,7 @@ plugins {
|
|||
id 'application'
|
||||
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
||||
id "maven-publish"
|
||||
id "org.ajoberstar.grgit" version "3.1.0"
|
||||
}
|
||||
|
||||
application {
|
||||
|
@ -15,8 +16,21 @@ repositories {
|
|||
mavenCentral()
|
||||
}
|
||||
|
||||
ext.currentVer = "0.0.0+nogit"
|
||||
if (grgit != null) {
|
||||
ext.currentVer = "0.0.0+notag"
|
||||
grgit.open(dir: rootProject.projectDir.toString())
|
||||
def tagList = grgit.tag.list()
|
||||
tagList.sort((left, right) -> right.commit.dateTime.compareTo(left.commit.dateTime))
|
||||
if (tagList.size() >= 1) {
|
||||
ext.currentVer = tagList.get(0).getName()
|
||||
}
|
||||
}
|
||||
|
||||
println("Building Inceptum " + ext.currentVer)
|
||||
|
||||
allprojects {
|
||||
version "$project.ver" + (project.hasProperty('release') ? "" : "-" + (project.hasProperty('timestamp') ? project.getProperty('timestamp') : Instant.now().getEpochSecond()))
|
||||
version "$rootProject.ext.currentVer" + (project.hasProperty('release') ? "" : "-" + (project.hasProperty('timestamp') ? project.getProperty('timestamp') : Instant.now().getEpochSecond()))
|
||||
group 'io.gitlab.jfronny.inceptum'
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
ver=0.1
|
Loading…
Reference in New Issue