forked from SpectoLabs/hoverfly-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
191 lines (164 loc) · 6.26 KB
/
Copy pathbuild.gradle
File metadata and controls
191 lines (164 loc) · 6.26 KB
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
plugins {
id 'net.researchgate.release' version '2.4.0'
id "de.undercouch.download" version "3.1.2"
id "com.github.hierynomus.license" version "0.14.0"
id 'com.github.ben-manes.versions' version '0.14.0'
id 'java'
id 'maven'
id 'signing'
id 'idea'
id 'jacoco'
}
group = 'io.specto'
archivesBaseName = 'hoverfly-java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext."release.useAutomaticVersion" = true
allprojects {
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"
}
repositories {
mavenCentral()
}
dependencies {
compile 'junit:junit:4.12'
compile 'com.squareup.okhttp3:okhttp:3.8.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.8'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.8'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.8.8'
compile 'org.apache.commons:commons-lang3:3.5'
compile 'org.zeroturnaround:zt-exec:1.9'
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'ch.qos.logback:logback-classic:1.1.7'
testCompile 'com.sun.jersey:jersey-client:1.19.3'
testCompile 'com.google.guava:guava:20.0'
testCompile 'org.springframework:spring-web:4.3.8.RELEASE'
testCompile 'org.apache.httpcomponents:httpclient:4.5.2'
testCompile 'org.assertj:assertj-core:3.6.1'
testCompile 'net.javacrumbs.json-unit:json-unit:1.17.0'
testCompile 'net.javacrumbs.json-unit:json-unit-fluent:1.17.0'
testCompile 'org.eclipse.jetty:jetty-server:9.3.11.v20160721'
testCompile 'org.skyscreamer:jsonassert:1.4.0'
testCompile 'org.mockito:mockito-core:2.7.22'
testCompile 'org.powermock:powermock-module-junit4:1.6.6'
testCompile 'com.github.stefanbirkner:system-rules:1.16.0'
}
signing {
sign configurations.archives
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
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 'Hoverfly Java'
packaging 'jar'
// optionally artifactId can be defined here
description 'Hoverfly for Java. Capture and simulate HTTP(S) services in JUnit tests.'
url 'https://github.com/SpectoLabs/hoverfly-java'
scm {
connection 'scm:git:git@github.com:SpectoLabs/hoverfly-java.git'
developerConnection 'scm:git:git@github.com:SpectoLabs/hoverfly-java.git'
url 'git@github.com: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 'andrew.morgan@opencredo.com'
organization 'Specto Labs'
organizationUrl 'http://www.specto.io'
}
developer {
name 'Tommy Situ'
email 'tommy.situ@specto.io'
organization 'Specto Labs'
organizationUrl 'http://www.specto.io'
}
}
}
}
}
}
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
}
}
task wrapper(type: Wrapper) {
gradleVersion = '3.1'
}
// Tasks for updating Hoverfly binaries
import de.undercouch.gradle.tasks.download.Download
import java.util.regex.Pattern
task downloadHoverflyDistributions(type: Download) {
def downloadUrl = 'https://github.com/SpectoLabs/hoverfly/releases/download'
def version = project.property('hoverfly-version')
println "Checking out Hoverfly $version"
src([
"$downloadUrl/$version/hoverfly_bundle_linux_386.zip",
"$downloadUrl/$version/hoverfly_bundle_linux_amd64.zip",
"$downloadUrl/$version/hoverfly_bundle_OSX_amd64.zip",
"$downloadUrl/$version/hoverfly_bundle_windows_386.zip",
"$downloadUrl/$version/hoverfly_bundle_windows_amd64.zip"
])
dest "$buildDir/tmp/dist"
onlyIfNewer true
}
task updateHoverflyBinaries(dependsOn: downloadHoverflyDistributions) {
def distDir = file(downloadHoverflyDistributions.dest)
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) }
}