-
Notifications
You must be signed in to change notification settings - Fork 58
/
build.gradle
227 lines (192 loc) · 7.69 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
plugins {
id 'net.researchgate.release' version '2.8.1'
id "de.undercouch.download" version "3.4.2"
id "com.github.hierynomus.license" version "0.14.0"
id 'com.github.ben-manes.versions' version '0.14.0'
id 'java'
id 'idea'
}
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.6"
}
group = 'io.specto'
archivesBaseName = 'hoverfly-java'
sourceCompatibility = 1.11
targetCompatibility = 1.11
ext."release.useAutomaticVersion" = true
repositories {
mavenCentral()
}
dependencies {
ext {
jacksonVersion = '2.17.2'
}
compile 'com.squareup.okhttp3:okhttp:4.12.0'
compile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion"
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion"
compile 'org.apache.commons:commons-lang3:3.12.0'
compile 'org.zeroturnaround:zt-exec:1.12'
compile 'org.slf4j:slf4j-api:1.7.36'
compile 'ch.qos.logback:logback-classic:1.5.13'
compileOnly 'junit:junit:4.13.2'
testCompile 'com.sun.jersey:jersey-client:1.19.4'
testCompile 'com.google.guava:guava:33.0.0-jre'
testCompile 'org.springframework:spring-web:5.3.20'
testCompile 'org.apache.httpcomponents:httpclient:4.5.13'
testCompile 'org.assertj:assertj-core:3.22.0'
testCompile 'net.javacrumbs.json-unit:json-unit:2.32.0'
testCompile 'net.javacrumbs.json-unit:json-unit-fluent:2.28.0'
testCompile 'org.eclipse.jetty:jetty-server:9.3.11.v20160721'
testCompile 'org.skyscreamer:jsonassert:1.5.0'
testCompile 'org.mockito:mockito-core:4.2.0'
testCompile 'org.powermock:powermock-module-junit4:2.0.9'
testCompile 'com.github.stefanbirkner:system-rules:1.19.0'
testCompile 'io.projectreactor.ipc:reactor-netty:0.7.15.RELEASE'
testCompile 'io.projectreactor:reactor-test:3.2.3.RELEASE'
testCompile 'org.awaitility:awaitility:4.1.1'
}
allprojects { subproj ->
ext."signing.keyId" = "$System.env.MAVEN_GPG_KEYNAME"
ext."signing.password" = "$System.env.MAVEN_GPG_PASSPHRASE"
ext."signing.secretKeyRingFile" = "$System.env.HOME/.gnupg/secring.gpg"
ext.ossrhUsername = "$System.env.MAVEN_CENTRAL_USERNAME"
ext.ossrhPassword = "$System.env.MAVEN_CENTRAL_PASSWORD"
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'java'
apply plugin: 'net.researchgate.release'
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
def isSnapshot = project.version.contains('SNAPSHOT')
afterEvaluate {
if (!isSnapshot) {
signing {
sign configurations.archives
}
}
}
afterReleaseBuild.dependsOn uploadArchives
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: "$ossrhUsername", password: "$ossrhPassword")
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: "$ossrhUsername", password: "$ossrhPassword")
}
pom.project {
name "${subproj.property('title')}"
packaging 'jar'
// optionally artifactId can be defined here
description "${subproj.property('description')}"
url 'https://github.com/SpectoLabs/hoverfly-java'
scm {
connection 'scm:git:[email protected]:SpectoLabs/hoverfly-java.git'
developerConnection 'scm:git:[email protected]:SpectoLabs/hoverfly-java.git'
url '[email protected]:SpectoLabs/hoverfly-java.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
name 'Andrew Morgan'
email '[email protected]'
organization 'Specto Labs'
organizationUrl 'http://www.specto.io'
}
developer {
name 'Tommy Situ'
email '[email protected]'
organization 'Specto Labs'
organizationUrl 'http://www.specto.io'
}
}
}
}
}
}
}
updateVersion.dependsOn subprojects.findResults { it.tasks.findByName('release') }
license {
header = file('license-header.txt')
strictCheck true
include "src/main/**/*.java"
ext.inceptionYear = 2016
ext.currentYear = Calendar.getInstance().get(Calendar.YEAR)
}
jacocoTestReport {
reports {
xml.enabled true
}
}
wrapper {
gradleVersion = '5.6.4'
}
// Tasks for updating Hoverfly binaries
import java.util.regex.Pattern
task (updateHoverflyBinaries) {
doLast {
def downloadUrl = 'https://github.com/SpectoLabs/hoverfly/releases/download'
def downloadDir = "$buildDir/tmp/dist-${hoverfly_binary_version}"
println "Downloading Hoverfly $hoverfly_binary_version if needed"
download {
src([
"$downloadUrl/$hoverfly_binary_version/hoverfly_bundle_linux_386.zip",
"$downloadUrl/$hoverfly_binary_version/hoverfly_bundle_linux_amd64.zip",
"$downloadUrl/$hoverfly_binary_version/hoverfly_bundle_linux_arm64.zip",
"$downloadUrl/$hoverfly_binary_version/hoverfly_bundle_OSX_amd64.zip",
"$downloadUrl/$hoverfly_binary_version/hoverfly_bundle_OSX_arm64.zip",
"$downloadUrl/$hoverfly_binary_version/hoverfly_bundle_windows_386.zip",
"$downloadUrl/$hoverfly_binary_version/hoverfly_bundle_windows_amd64.zip"
])
dest "$downloadDir"
onlyIfNewer true
quiet true
}
println "Unzipping Hoverfly ${hoverfly_binary_version} binaries"
def distDir = file("$downloadDir")
def extractBinary = { FileTree zip ->
copy {
from zip
into 'src/main/resources/binaries'
rename { String filename ->
def p1 = Pattern.compile('hoverfly(.*)')
def m1 = p1.matcher(filename)
def extension = m1.find() ? m1.group(1) : ''
def p2 = Pattern.compile('hoverfly_bundle(.+?)\\.zip')
def m2 = p2.matcher(zip.asPath)
def type = m2.find() ? m2.group(1) : ''
filename = 'hoverfly' + type + extension
}
}
}
distDir.listFiles()
.findAll { it.name.endsWith('.zip') }
.collect { zipTree(it).matching { include 'hoverfly*' } }
.each { zip -> extractBinary(zip) }
}
}
task (cleanHoverflyBinaries, type: Delete) {
delete fileTree(dir: 'src/main/resources/binaries')
}
processResources {
dependsOn updateHoverflyBinaries
}