Skip to content

Commit bc4aa4c

Browse files
author
Mark Whitaker
authored
Replace com.palantir.git-version with local function (#10)
* Replace com.palantir.git-version with local function * Add exception handler to getVersionFromGit
1 parent 4dc9f56 commit bc4aa4c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

build.gradle

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ buildscript {
44

55
plugins {
66
id 'java-library'
7-
id 'com.palantir.git-version' version '0.15.0'
87
id 'maven-publish'
98
}
109

@@ -13,7 +12,7 @@ repositories {
1312
}
1413

1514
group 'uk.co.mainwave.mimetypes'
16-
version gitVersion()
15+
version getVersionFromGit()
1716

1817
sourceCompatibility = JavaVersion.VERSION_1_8
1918

@@ -37,4 +36,17 @@ publishing {
3736
from(components.java)
3837
}
3938
}
39+
}
40+
41+
def getVersionFromGit() {
42+
try {
43+
def stdout = new ByteArrayOutputStream()
44+
exec {
45+
commandLine "git", "describe", "--always", "--dirty"
46+
standardOutput = stdout
47+
}
48+
return stdout.toString().trim()
49+
} catch (ignored) {
50+
return "1.0.0"
51+
}
4052
}

0 commit comments

Comments
 (0)