forked from rabbitmq/hop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
256 lines (210 loc) · 7.62 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
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
plugins {
id 'groovy'
id 'eclipse'
id 'idea'
id 'org.sonarqube' version '2.5'
id "io.spring.dependency-management" version "1.0.3.RELEASE"
id "java"
}
description = 'Java client for the RabbitMQ HTTP API'
apply from: "${rootProject.projectDir}/publish-maven.gradle"
group = 'com.rabbitmq'
repositories {
mavenCentral()
maven {
url 'https://repo.spring.io/libs-milestone'
}
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
ext {
amqpClientVersion='5.8.0'
commonsHttpClientVersion = '4.5.12'
okHttpVersion = '3.14.7'
groovyVersion = '2.4.19'
jacksonVersion = '2.10.3'
spockVersion = "1.3-groovy-2.4"
reactorVersion = "3.3.4.RELEASE"
reactorNettyVersion = '0.9.6.RELEASE'
springVersion = '5.2.5.RELEASE'
linkHomepage = 'https://github.com/rabbitmq/hop'
linkCi = 'https://build.spring.io/browse/RMQ'
linkIssue = 'https://github.com/rabbitmq/hop/issues'
linkScmUrl = 'https://github.com/rabbitmq/hop'
linkScmConnection = 'https://github.com/rabbitmq/hop.git'
linkScmDevConnection = 'git@github.com:rabbitmq/hop.git'
javadocLinks = ["https://docs.oracle.com/javase/7/docs/api/",
"https://docs.oracle.com/javaee/6/api/",
"https://www.reactive-streams.org/reactive-streams-1.0.2-javadoc/",
"https://projectreactor.io/docs/core/release/api/",
"https://fasterxml.github.io/jackson-databind/javadoc/2.9/"] as String[]
}
def httpClients = ['jdk', 'httpclient', 'okhttp']
sourceSets {
httpClients.each { client ->
sourceSets.create("${client}DependencyTest") {
java.srcDirs = ["src/integration-test/${client}/java"]
compileClasspath += main.output
runtimeClasspath += main.output
}
}
}
dependencyManagement {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
applyMavenExclusions = false
}
dependencies {
compile ("org.springframework:spring-web:$springVersion", optional)
compile ("org.apache.httpcomponents:httpclient:$commonsHttpClientVersion", optional)
compile ("com.squareup.okhttp3:okhttp:$okHttpVersion", optional)
compile ("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
compile ("io.projectreactor:reactor-core:$reactorVersion", optional)
compile ("io.projectreactor.netty:reactor-netty:$reactorNettyVersion", optional)
testCompile "org.codehaus.groovy:groovy-all:$groovyVersion"
testCompile "org.spockframework:spock-core:$spockVersion"
testCompile "com.rabbitmq:amqp-client:$amqpClientVersion"
jdkDependencyTestCompile "junit:junit:4.13"
jdkDependencyTestCompile "org.springframework:spring-web:$springVersion"
jdkDependencyTestCompile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
httpclientDependencyTestCompile "junit:junit:4.13"
httpclientDependencyTestCompile "org.springframework:spring-web:$springVersion"
httpclientDependencyTestCompile "org.apache.httpcomponents:httpclient:$commonsHttpClientVersion"
httpclientDependencyTestCompile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
okhttpDependencyTestCompile "junit:junit:4.13"
okhttpDependencyTestCompile "org.springframework:spring-web:$springVersion"
okhttpDependencyTestCompile "com.squareup.okhttp3:okhttp:$okHttpVersion"
okhttpDependencyTestCompile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
}
eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature'
// enable all compiler warnings; individual projects may customize further
[compileJava, compileTestJava, compileTestGroovy]*.options*.compilerArgs = ['-Xlint:all,-options']
test {
beforeTest { descriptor ->
logger.lifecycle("Running test \"${descriptor}\"")
}
systemProperty 'rabbitmq.management.port', System.getProperty('rabbitmq.management.port') ?: '15672'
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
maxHeapSize = "1024m"
}
httpClients.each { client ->
tasks.create(name: "${client}DependencyTest", type: Test) {
testClassesDirs = sourceSets["${client}DependencyTest"].output.classesDirs
classpath = sourceSets["${client}DependencyTest"].runtimeClasspath
test.dependsOn name
}
}
// force test runs even when there are no test changes,
// such test loops are very useful for testing race conditions
// and other concurrency hazards in both Hop and RabbitMQ HTTP API
test.outputs.upToDateWhen { false }
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc
}
artifacts {
archives sourcesJar
archives javadocJar
}
sonarqube {
properties {
property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
property "sonar.links.homepage", linkHomepage
property "sonar.links.ci", linkCi
property "sonar.links.issue", linkIssue
property "sonar.links.scm", linkScmUrl
property "sonar.links.scm_dev", linkScmDevConnection
property "sonar.java.coveragePlugin", "jacoco"
}
}
javadoc {
group = 'Documentation'
description = 'Generates the Javadoc API documentation.'
title = "${rootProject.description} ${version} API"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.overview = 'src/api/overview.html'
options.stylesheetFile = file("src/api/stylesheet.css")
source = sourceSets.main.allJava
classpath = project.sourceSets.main.compileClasspath
destinationDir = new File(buildDir, "api")
}
task docsZip(type: Zip) {
group = 'Distribution'
archiveClassifier = 'docs'
description = "Builds -${archiveClassifier} archive containing the api"
from(javadoc) {
into 'api'
}
}
task distZip(type: Zip, dependsOn: docsZip) {
group = 'Distribution'
archiveClassifier = 'dist'
description = "Builds -${archiveClassifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "${project.name}-${project.version}";
from('src/dist') {
include 'license.txt'
include 'notice.txt'
into "${baseDir}"
}
from(zipTree(docsZip.archivePath)) {
into "${baseDir}/docs"
}
into("${baseDir}/libs") {
from project.jar
from project.sourcesJar
from project.javadocJar
}
}
// Create an optional "with dependencies" distribution.
// Not published by default; only for use when building from source.
task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
group = 'Distribution'
archiveClassifier = 'dist-with-deps'
description = "Builds -${archiveClassifier} archive, containing everything " +
"in the -${distZip.archiveClassifier} archive plus all dependencies."
from zipTree(distZip.archiveFile)
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":${zipTask.name}")) {
def projectName = rootProject.name
def artifacts = new HashSet()
rootProject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def dependency = artifact.moduleVersion.id
if (!projectName.equals(dependency.name)) {
artifacts << artifact.file
}
}
zipTask.from(artifacts) {
into "${distZip.baseDir}/deps"
}
}
}
}
artifacts {
archives distZip
archives docsZip
}
task dist(dependsOn: assemble) {
group = 'Distribution'
description = 'Builds -dist, -docs and distribution archives.'
}
jar {
manifest {
attributes("Automatic-Module-Name": "com.rabbitmq.http.client",
"Implementation-Version": version)
}
}