-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.upload
264 lines (228 loc) · 6.82 KB
/
build.upload
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
def findJVM() {
String[] java11Paths = new String[4]
java11Paths[0] = "/usr/lib/jvm/java-11-openjdk-amd64/lib/"
java11Paths[1] = "/usr/lib/jvm/java-11-openjdk/lib/"
java11Paths[2] = "/usr/lib/jvm/openjdk-11/lib/"
java11Paths[3] = "/usr/lib/jvm/java-11-sun/lib/"
for (String path : java11Paths) {
if (new java.io.File(path).exists()) {
return path
}
}
return null
}
subprojects {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'signing'
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
sourceCompatibility = 1.11
targetCompatibility = 1.11
compileJava {
def jvmPath = findJVM()
if (jvmPath == null) {
println 'Unable to find java 11 install, will cause failure so exiting now'
println ''
System.exit(1)
}
println 'Using java 11: ' + jvmPath
options.bootstrapClasspath = fileTree(include: ['*.jar'], dir: jvmPath)
}
compileTestJava {
options.bootstrapClasspath = fileTree(include: ['*.jar'], dir: findJVM())
}
compileJava {
options.compilerArgs << "-Xlint:all" << "-Werror"
}
compileTestJava {
options.compilerArgs << "-Xlint:all" << "-Xlint:-processing" << "-Werror"
}
plugins.withType(JavaPlugin) {
checkstyle.sourceSets = [sourceSets.main]
}
test {
maxParallelForks = 2
jacoco {
excludes = ['**/package-info**','**/*Test']
destinationFile = file("$buildDir/reports/jacoco/test.exec")
}
getReports().getJunitXml().setDestination(file("$buildDir/reports/tests/xml"))
getReports().getHtml().setDestination(file("$buildDir/reports/tests/html"))
setBinaryResultsDirectory(file("$buildDir/reports/tests/bin"))
}
test.finalizedBy("jacocoTestReport")
jacocoTestReport {
reports {
csv.required = false
xml.required = true
xml.destination = file("$buildDir/reports/jacoco/jacoco.xml")
html.required = true
html.destination = file("$buildDir/reports/jacoco/html")
}
doLast {
println "Test results available at:"
println "html - $buildDir/reports/tests/html/index.html"
println "Test coverage reports available at:"
println "html - $buildDir/reports/jacoco/html/index.html"
}
}
jar {
manifest {
attributes 'Implementation-Title': 'auroraArc', 'Implementation-Version': archiveVersion
}
}
javadoc {
source = sourceSets.main.allJava
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PUBLIC
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task copyLibs(type: Copy) {
into "$buildDir/dependencies/"
from configurations.testRuntimeClasspath
}
build.finalizedBy("copyLibs")
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
signing {
sign configurations.archives
if (! version.contains('SNAPSHOT')) {
sign publishing.publications
}
}
publishing {
publications {
mavenJava(MavenPublication) {
pom {
name = 'auroraArc'
description = 'JDBC driver for AWS Aurora databases.'
url = 'http://threadly.org/'
scm {
url = 'scm:git@github.com:threadly/auroraArc.git'
connection = 'scm:git@github.com:threadly/auroraArc.git'
developerConnection = 'scm:git@github.com:threadly/auroraArc.git'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/threadly/auroraArc/issues'
}
licenses {
license {
name = 'Mozilla Public License Version 2.0'
url = 'https://www.mozilla.org/MPL/2.0/'
distribution = 'repo'
}
}
developers {
developer {
id = 'jent'
name = 'Mike Jensen'
email = 'jent@threadly.org'
}
}
}
from components.java
artifact(sourcesJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username sonatypeUsername
password sonatypePassword
}
}
}
}
model {
tasks.generatePomFileForMavenJavaPublication {
destination = file("$buildDir/generated-pom.xml")
}
tasks.publishMavenJavaPublicationToMavenLocal {
dependsOn project.tasks.signArchives
}
tasks.publishMavenJavaPublicationToMavenRepository {
dependsOn project.tasks.signArchives
}
}
}
project(':arcCommon') {
archivesBaseName = 'arcCommon'
dependencies {
testImplementation (
"org.threadly:threadly-test:$threadlyTestVersion",
"junit:junit:$junitVersion",
"org.mockito:mockito-core:$mockitoVersion",
"org.openjdk.jmh:jmh-core:$jmhVersion",
"org.openjdk.jmh:jmh-generator-annprocess:$jmhVersion",
"org.jdbi:jdbi3-core:$jdbiVersion",
"org.jdbi:jdbi3-sqlobject:$jdbiVersion",
"com.zaxxer:HikariCP:$hikariVersion",
"ch.qos.logback:logback-core:$logbackVersion",
"ch.qos.logback:logback-classic:$logbackVersion"
)
testAnnotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$jmhVersion"
implementation (
"org.threadly:threadly:$threadlyVersion"
)
}
}
project(':mysqlAuroraArc') {
archivesBaseName = 'auroraArc-mysql'
dependencies {
testImplementation (
project(':arcCommon').sourceSets.test.output,
"junit:junit:$junitVersion",
"org.mockito:mockito-core:$mockitoVersion",
"org.jdbi:jdbi3-core:$jdbiVersion",
"org.jdbi:jdbi3-sqlobject:$jdbiVersion",
"com.zaxxer:HikariCP:$hikariVersion",
"ch.qos.logback:logback-core:$logbackVersion",
"ch.qos.logback:logback-classic:$logbackVersion"
)
implementation (
project(":arcCommon"),
"org.threadly:threadly:$threadlyVersion",
"mysql:mysql-connector-java:$mysqlVersion"
)
}
}
project(':psqlAuroraArc') {
archivesBaseName = 'auroraArc-psql'
dependencies {
testImplementation (
project(':arcCommon').sourceSets.test.output,
"junit:junit:$junitVersion",
"org.mockito:mockito-core:$mockitoVersion"
)
implementation (
project(":arcCommon"),
"org.threadly:threadly:$threadlyVersion",
"org.postgresql:postgresql:$psqlVersion"
)
}
}