From bb44c2ea92b9fe0c42bfdf4590469f8712b539d2 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 20 Apr 2019 16:26:31 +0100 Subject: [PATCH] parsable build number --- build.gradle | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 7bb184b05..0edf1ecb7 100644 --- a/build.gradle +++ b/build.gradle @@ -32,11 +32,15 @@ ext { date = git.head().getDate().format("yy.MM.dd") revision = "-${git.head().abbreviatedId}" parents = git.head().parentIds; - index = -2039; // Offset to match CI - for (; parents != null && !parents.isEmpty(); index++) { - parents = git.getResolve().toCommit(parents.get(0)).getParentIds() + if (project.hasProperty('buildnumber')) { + buildNumber = "$buildnumber" + } else { + index = -2042; // Offset to match CI + for (; parents != null && !parents.isEmpty(); index++) { + parents = git.getResolve().toCommit(parents.get(0)).getParentIds() + } + buildNumber = "${index}" } - buildNumber = "${index}" } // version = String.format("%s.%s%s%s", rootVersion, date, revision, buildNumber) @@ -72,7 +76,7 @@ subprojects { testAnnotationProcessor("org.projectlombok:lombok:1.18.4") testImplementation "junit:junit:4.12" } - + repositories { mavenCentral() maven { url "http://maven.sk89q.com/repo/" }