From 31889c39f6515393919518c215e921be965ae0bc Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Thu, 14 Nov 2024 23:33:54 +0100 Subject: [PATCH] Update Gradle API usage --- build.gradle | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 3160b715..f2461c09 100644 --- a/build.gradle +++ b/build.gradle @@ -109,7 +109,7 @@ processResources { expand( "version": project.version, "description": project.description, - "implVersion": "git-${project.name}-${project.version}:${latestCommitHash()}", + "implVersion": "git-${project.name}-${project.version}:${latestCommitHash().get()}", "mcVersion": mcVersion() ) } @@ -123,13 +123,10 @@ String mcVersion() { } } -String latestCommitHash() { - def stdout = new ByteArrayOutputStream() - exec { - commandLine "git", "rev-parse", "--short", "HEAD" - standardOutput = stdout - } - return stdout.toString().trim() +Provider latestCommitHash() { + return providers.exec { + commandLine = ["git", "rev-parse", "--short", "HEAD"] + }.standardOutput.getAsText().map(String::trim) } java {