Skip to content

Commit

Permalink
Include commit hash in build version
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-MX committed Nov 20, 2023
1 parent a561155 commit 1d66a0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
plugins {
kotlin("jvm") version "1.7.21"
id("org.ajoberstar.grgit") version "4.1.0"
}

project.version = "2.0"
fun getCheckedOutGitCommitHash(): String = grgit.head().abbreviatedId

val commitHash = getCheckedOutGitCommitHash()
val version = "2.0"

rootProject.version = "$version-$commitHash"

subprojects {
apply(plugin = "java")
apply(plugin = "org.jetbrains.kotlin.jvm")
Expand Down
4 changes: 2 additions & 2 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tasks.withType<KotlinCompile> {

tasks {
withType<ProcessResources> {
val props = "version" to rootProject.version
val props = "version" to version
inputs.properties(props)
filteringCharset = "UTF-8"
filesMatching("plugin.yml") {
Expand All @@ -44,6 +44,6 @@ tasks {
}

val compile = tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
archiveBaseName.set("ktgui-plugin")
archiveBaseName.set("ktgui-plugin-${rootProject.version}")
mergeServiceFiles()
}

0 comments on commit 1d66a0d

Please sign in to comment.