mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Fix build number not showing in jar
This commit is contained in:
parent
093542c337
commit
e21614caf8
25
build.gradle
25
build.gradle
@ -1,3 +1,5 @@
|
|||||||
|
import org.ajoberstar.grgit.Grgit
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
@ -22,7 +24,7 @@ buildscript {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'net.minecrell.licenser' version '0.4.1' apply false
|
id 'net.minecrell.licenser' version '0.4.1' apply false
|
||||||
id "org.ajoberstar.grgit" version "2.3.0"
|
id "org.ajoberstar.grgit" version "3.1.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
@ -41,20 +43,15 @@ def revision = ""
|
|||||||
def buildNumber = ""
|
def buildNumber = ""
|
||||||
def date = ""
|
def date = ""
|
||||||
ext {
|
ext {
|
||||||
try {
|
git = Grgit.open(dir: '.git')
|
||||||
git = org.ajoberstar.grgit.Grgit.open(file(".git"))
|
date = git.head().getDate().format("yy.MM.dd")
|
||||||
date = git.head().date.format("yy.MM.dd")
|
revision = "-${git.head().abbreviatedId}"
|
||||||
revision = "-${git.head().abbreviatedId}"
|
parents = git.head().parentIds;
|
||||||
index = -1960; // Offset to match CI
|
index = -2111; // Offset to match CI
|
||||||
parents = git.head().parentIds;
|
for (; parents != null && !parents.isEmpty(); index++) {
|
||||||
for (; parents != null && !parents.isEmpty(); index++) {
|
parents = git.getResolve().toCommit(parents.get(0)).getParentIds()
|
||||||
commit = git.getResolve().toCommit(parents.get(0));
|
|
||||||
parents = commit.getParentIds()
|
|
||||||
}
|
|
||||||
buildNumber = "${index}"
|
|
||||||
} catch (Throwable ignore) {
|
|
||||||
revision = "-unknown"
|
|
||||||
}
|
}
|
||||||
|
buildNumber = "${index}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( project.hasProperty("lzNoVersion") ) { // gradle build -PlzNoVersion
|
if ( project.hasProperty("lzNoVersion") ) { // gradle build -PlzNoVersion
|
||||||
|
Loading…
Reference in New Issue
Block a user