From fe1cb649c82fd2315ac06260dbd65e25b9f3b250 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 18 Apr 2021 20:23:32 +0200 Subject: [PATCH] Don't use local offset when compiling locally --- build.gradle.kts | 40 +++++++++++++++++----------------------- gradle.properties | 1 - 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 4a6772f61..90c106b5f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,42 +15,26 @@ logger.lifecycle(""" ******************************************* """) -//TODO FIX THIS WHEN I FEEL LIKE IT var rootVersion by extra("1.16") var revision: String by extra("") var buildNumber by extra("") var date: String by extra("") ext { val git: Grgit = Grgit.open { - dir = File("$rootDir/.git"); + dir = File("$rootDir/.git") } - date = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd")); - revision = "-${git.head().abbreviatedId}"; - var parents: MutableList? = git.head().parentIds; - if (project.hasProperty("buildnumber")) { - buildNumber = project.properties["buildnumber"] as String; + date = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd")) + revision = "-${git.head().abbreviatedId}" + val commit: String? = Grgit.open().head().abbreviatedId + buildNumber = if (project.hasProperty("buildnumber")) { + project.properties["buildnumber"] as String } else { - var index = -2109; // Offset to match CI - while (parents != null && parents.isNotEmpty()) { - parents = git.resolve.toCommit(parents[0]).parentIds - index++; - } - buildNumber = index.toString(); - } -} - -allprojects { - gradle.projectsEvaluated { - tasks.withType(JavaCompile::class) { - options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "1000")) - } + commit.toString() } } version = String.format("%s-%s", rootVersion, buildNumber) -applyCommonConfiguration() - if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") ext["gitCommitHash"] = try { @@ -61,3 +45,13 @@ if (!project.hasProperty("gitCommitHash")) { "no.git.id" } } + +allprojects { + gradle.projectsEvaluated { + tasks.withType(JavaCompile::class) { + options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "1000")) + } + } +} + +applyCommonConfiguration() diff --git a/gradle.properties b/gradle.properties index 0d98971aa..ddafaabb0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,4 @@ group=com.sk89q.worldedit -version=7.2.0-SNAPSHOT org.gradle.jvmargs=-Xmx1512M org.gradle.daemon=true