forked from graphql-java/graphql-java-extended-scalars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
137 lines (111 loc) · 3.63 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import java.text.SimpleDateFormat
plugins {
id 'java'
id 'groovy'
id 'java-library'
id 'maven'
id 'maven-publish'
id 'signing'
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
}
def getDevelopmentVersion() {
def output = new StringBuilder()
def error = new StringBuilder()
def gitShortHash = "git -C ${projectDir} rev-parse --short HEAD".execute()
gitShortHash.waitForProcessOutput(output, error)
def gitHash = output.toString().trim()
if (gitHash.isEmpty()) {
println "git hash is empty: error: ${error.toString()}"
throw new IllegalStateException("git hash could not be determined")
}
new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date()) + "-" + gitHash
}
def releaseVersion = System.env.RELEASE_VERSION
version = releaseVersion ? releaseVersion : getDevelopmentVersion()
println "Building version = " + version
group = 'com.graphql-java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
compile "com.graphql-java:graphql-java:17.0"
testImplementation 'org.spockframework:spock-core:1.3-groovy-2.5'
testImplementation('org.codehaus.groovy:groovy:2.5.13')
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set("javadoc")
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
test {
testLogging {
exceptionFormat = 'full'
}
}
publishing {
publications {
maven(MavenPublication) {
from components.java
groupId group
artifactId 'graphql-java-extended-scalars'
version version
artifact sourcesJar
artifact javadocJar
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name 'graphql-java-extended-scalars'
description 'A library fo extended scalars for graphql-java'
url 'https://github.com/graphql-java/graphql-java-extended-scalars'
inceptionYear '2018'
scm {
url 'https://github.com/graphql-java/graphql-java-extended-scalars'
connection 'scm:git@github.com:graphql-java/graphql-java-extended-scalars.git'
developerConnection 'scm:git@github.com:graphql-java/graphql-java-extended-scalars.git'
}
licenses {
license {
name 'MIT'
url 'https://github.com/graphql-java/graphql-java/blob/master/LICENSE.md'
distribution 'repo'
}
}
developers {
developer {
id 'bbakerman'
name 'Brad Baker'
email 'bbakerman@gmail.com'
}
}
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
username = System.env.MAVEN_CENTRAL_USER
password = System.env.MAVEN_CENTRAL_PASSWORD
}
}
}
signing {
def signingKey = System.env.MAVEN_CENTRAL_PGP_KEY
useInMemoryPgpKeys(signingKey, "")
sign publishing.publications
}
// all publish tasks depend on the build task
tasks.withType(PublishToMavenRepository) {
dependsOn build
}