Skip to content

Commit 68869b9

Browse files
committed
Add git sha to jar
1 parent 3375701 commit 68869b9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ tasks.named('jar') {
105105
manifest.attributes('Multi-Release': 'true')
106106
}
107107

108+
def gitHashProvider = providers.exec {
109+
commandLine 'git', 'rev-parse', '--short', 'HEAD'
110+
}.standardOutput.asText.map { it.trim() }
111+
108112
shadowJar {
109113
duplicatesStrategy = DuplicatesStrategy.INCLUDE
110114
failOnDuplicateEntries = true
@@ -123,6 +127,10 @@ shadowJar {
123127
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
124128
}
125129

130+
manifest {
131+
attributes('Implementation-Version': gitHashProvider.get())
132+
}
133+
126134
destinationDirectory.set(file('target'))
127135
archiveBaseName.set('photon')
128136
archiveClassifier.set('')

0 commit comments

Comments
 (0)