attempt at setting up fawe.properties

This commit is contained in:
MattBDev
2019-08-22 21:06:03 -04:00
parent b5b89412d9
commit 70d4af006a
3 changed files with 29 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
import org.ajoberstar.grgit.Grgit
import java.time.format.DateTimeFormatter
plugins {
id("com.gradle.build-scan") version "2.4.1"
@@ -18,6 +19,28 @@ logger.lifecycle("""
*******************************************
""")
//TODO FIX THIS WHEN I FEEL LIKE IT
var rootVersion = "1.13"
var revision: String = ""
var buildNumber = ""
var date: String = ""
ext {
val git: Grgit = Grgit.open {
dir = File(rootDir.toString() + "/.git");
}
ext["date"] = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"));
ext["revision"] = "-${git.head().abbreviatedId}";
var parents: MutableList<String>? = git.head().parentIds;
if (project.hasProperty("buildnumber")) {
buildNumber = project.properties["buildnumber"] as String;
} else {
var index = -2109; // Offset to match CI
while (parents != null && parents.isNotEmpty()) {
parents = git.getResolve().toCommit(parents.get(0)).getParentIds()
index++;
}
buildNumber = index.toString();
}
}
//def rootVersion = "1.13"
//def revision = ""
//def buildNumber = ""
@@ -40,6 +63,8 @@ logger.lifecycle("""
//
//version = String.format("%s.%s", rootVersion, buildNumber)
version = String.format("%s.%s", rootVersion, buildNumber)
if (!project.hasProperty("gitCommitHash")) {
apply(plugin = "org.ajoberstar.grgit")
ext["gitCommitHash"] = try {