Skip to content

Commit 9348430

Browse files
committed
add the git hash to the development build version
1 parent 14c9022 commit 9348430

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@ apply plugin: 'maven-publish'
1010
apply plugin: 'antlr'
1111
apply plugin: 'osgi'
1212

13+
def getDevelopmentVersion() {
14+
def output = new StringBuilder()
15+
def error = new StringBuilder()
16+
def gitShortHash = 'git rev-parse --short HEAD'.execute()
17+
gitShortHash.consumeProcessOutput(output, error)
18+
gitShortHash.waitForOrKill(500)
19+
new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date()) + "#" + output.toString().trim()
20+
}
21+
22+
1323
sourceCompatibility = 1.8
1424
targetCompatibility = 1.8
1525
def reactiveStreamsVersion = '1.0.2'
1626
def slf4jVersion = '1.7.25'
1727
def releaseVersion = System.properties.RELEASE_VERSION
18-
version = releaseVersion ? releaseVersion : new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date())
28+
version = releaseVersion ? releaseVersion : getDevelopmentVersion()
1929
group = 'com.graphql-java'
2030

2131

0 commit comments

Comments
 (0)