Skip to content

Commit

Permalink
Update Gradle API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Nov 14, 2024
1 parent 1622961 commit 31889c3
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
}
Expand All @@ -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<String> latestCommitHash() {
return providers.exec {
commandLine = ["git", "rev-parse", "--short", "HEAD"]
}.standardOutput.getAsText().map(String::trim)
}

java {
Expand Down

0 comments on commit 31889c3

Please sign in to comment.