This repository has been archived by the owner on Oct 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
/
build.gradle
160 lines (130 loc) · 4.45 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import java.text.SimpleDateFormat
plugins {
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.toString(), "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")
}
def version = new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date()) + "-" + gitHash
println "created development version: $version"
version
}
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
def msg = String.format("This build must be run with java 1.8 - you are running %s - gradle finds the JDK via JAVA_HOME=%s",
JavaVersion.current(), System.getenv("JAVA_HOME"))
throw new GradleException(msg)
}
repositories {
mavenCentral()
mavenLocal()
}
nexusPublishing {
repositories {
sonatype {
username = System.env.MAVEN_CENTRAL_USER
password = System.env.MAVEN_CENTRAL_PASSWORD
}
}
}
def releaseVersion = System.env.RELEASE_VERSION
version = releaseVersion ? releaseVersion : getDevelopmentVersion()
group = 'com.graphql-java'
subprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'groovy'
apply plugin: 'signing'
sourceCompatibility = 1.8
targetCompatibility = 1.8
version = releaseVersion ? releaseVersion : getDevelopmentVersion()
group = 'com.graphql-java'
ext {
graphqlJavaVersion = "15.0"
springVersion = "5.1.7.RELEASE"
springBootVersion = "2.1.5.RELEASE"
jacksonVersion = "2.9.8"
assertJVersion = "3.11.1"
}
repositories {
mavenCentral()
mavenLocal()
}
task sourcesJar(type: Jar) {
dependsOn classes
classifier 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
javadoc {
options.encoding = 'UTF-8'
}
artifacts {
archives sourcesJar
archives javadocJar
}
publishing {
publications {
graphqlJava(MavenPublication) {
version version
from components.java
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name project.name
description project.description
url "https://github.com/graphql-java/graphql-java-spring"
scm {
url "https://github.com/graphql-java/graphql-java-spring"
connection "https://github.com/graphql-java/graphql-java-spring"
developerConnection "https://github.com/graphql-java/graphql-java-spring"
}
licenses {
license {
name 'MIT'
url 'https://github.com/graphql-java/graphql-java-spring/blob/master/LICENSE.md'
distribution 'repo'
}
}
developers {
developer {
id 'andimarek'
name 'Andreas Marek'
}
}
}
}
}
}
}
// all publish tasks depend on the build task
tasks.withType(PublishToMavenRepository) {
dependsOn build
}
signing {
def signingKey = System.env.MAVEN_CENTRAL_PGP_KEY
useInMemoryPgpKeys(signingKey, "")
sign publishing.publications
}
}
task myWrapper(type: Wrapper) {
gradleVersion = '6.6.1'
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}