1
+ import java.text.SimpleDateFormat
2
+
1
3
buildscript {
2
4
repositories {
3
5
mavenCentral()
@@ -13,9 +15,26 @@ apply plugin: 'groovy'
13
15
apply plugin : ' maven-publish'
14
16
apply plugin : ' com.jfrog.bintray'
15
17
18
+ def getDevelopmentVersion () {
19
+ def output = new StringBuilder ()
20
+ def error = new StringBuilder ()
21
+ def gitShortHash = " git -C ${ projectDir} rev-parse --short HEAD" . execute()
22
+ gitShortHash. waitForProcessOutput(output, error)
23
+ def gitHash = output. toString(). trim()
24
+ if (gitHash. isEmpty()) {
25
+ println " git hash is empty: error: ${ error.toString()} "
26
+ throw new IllegalStateException (" git hash could not be determined" )
27
+ }
28
+ new SimpleDateFormat (' yyyy-MM-dd\' T\' HH-mm-ss' ). format(new Date ()) + " -" + gitHash
29
+ }
30
+
31
+
32
+ def releaseVersion = System . env. RELEASE_VERSION
33
+ version = releaseVersion ? releaseVersion : getDevelopmentVersion()
16
34
group = ' com.graphql-java'
17
- version = ' 0.0.1-SNAPSHOT '
35
+
18
36
sourceCompatibility = 1.8
37
+ targetCompatibility = 1.8
19
38
20
39
repositories {
21
40
mavenCentral()
@@ -50,9 +69,9 @@ publishing {
50
69
publications {
51
70
maven(MavenPublication ) {
52
71
from components. java
53
- groupId ' com.graphql-java '
72
+ groupId group
54
73
artifactId ' graphql-java-extended-scalars'
55
- version project . version
74
+ version version
56
75
57
76
artifact sourcesJar
58
77
artifact javadocJar
0 commit comments