-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
281 lines (228 loc) · 8.72 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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
def projectId = 'multi-user-test-runner'
def scmOrganization = 'Vincit'
def signPackage = Boolean.parseBoolean(
project.hasProperty("signPackage") ? signPackage : "true"
)
static String readFile(String filename) {
return new File(filename).getText("UTF-8");
}
static String getVersion() {
try {
return readFile("version");
} catch(IOException e) {
try {
return readFile("../version");
} catch(IOException ex) {
return "dev";
}
}
}
def mutrVersion = getVersion()
def snapshotPrefix = '-SNAPSHOT'
task tagRelease << {
version = mutrVersion ?: "test"
exec {
executable 'git'
args 'tag', version
}
exec{
executable 'git'
args 'push', "ssh://git@$System.env.REPO_URL", "refs/tags/$version"
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'findbugs'
apply plugin: 'signing'
group = 'fi.vincit'
sourceCompatibility = 1.8
version = System.env.SNAPSHOT ? mutrVersion + snapshotPrefix : mutrVersion
repositories {
mavenCentral()
}
jar {
manifest {
attributes 'Implementation-Title': archivesBaseName,
'Implementation-Version': version
}
}
if (signPackage) {
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
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "$System.env.REPOSITORY_URL") {
authentication(
userName: "$System.env.DEPLOY_USERNAME",
password: "$System.env.DEPLOY_PASSWORD"
)
}
addFilter('core') {artifact, file ->
artifact.name == 'multi-user-test-runner'
}
def pomMetadata = {
name 'Multi User Test Runner'
packaging 'jar'
description '''
JUnit 4.12+ test runner for testing authentication with multiple users. Makes testing
authorization with multiple user/role combination easier and reduces amount of boilerplate
code.
'''
url "https://${scmOrganization}.github.io/$projectId/"
scm {
connection "scm:git:[email protected]/$scmOrganization/${projectId}.git"
developerConnection "scm:git:[email protected]/$scmOrganization/${projectId}.git"
url "https://github.com/$scmOrganization/$projectId"
}
inceptionYear '2015'
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'juhasipo'
name 'Juha Siponen'
}
}
}
pom('core').project pomMetadata
}
}
}
install.repositories.mavenInstaller.pom = uploadArchives.repositories.mavenDeployer.pom('core')
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
ignoreFailures = true
excludeFilter = file("$rootProject.projectDir/findBugsExcludeFilter.xml")
}
}
}
project(':core') {
archivesBaseName = 'multi-user-test-runner'
javadoc {
failOnError = true
options.overview = "src/main/java/overview.html"
}
dependencies {
compileOnly group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
compileOnly group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
compileOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.0.0'
compileOnly group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.0.0'
}
}
project(':integration-test') {
dependencies {
compile project(':core')
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
}
project(':junit-5-legacy-test') {
def version = System.env.JUNIT5_VERSION ?: "5.0.0/4.12.0"
def parts = version.split("/")
def engineVersion = ""
def vintageVersion = ""
if (parts.length == 2) {
engineVersion = parts[0]
vintageVersion = parts[1]
} else {
engineVersion = parts[0]
vintageVersion = parts[0]
}
dependencies {
compile project(':core')
compile project(':integration-test')
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: engineVersion
testCompile group: 'org.junit.vintage', name: 'junit-vintage-engine', version: vintageVersion
}
sourceCompatibility = 1.8
}
// TODO: Implement proper JUnit 5 support
project(':junit-5-test') {
dependencies {
compile project(':core')
compile project(':integration-test')
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.0.0'
testCompile group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.0.0'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
}
sourceCompatibility = 1.8
}
project(':spring-test') {
def version = System.env.SPRING_VERSION ?: "4.2.0.RELEASE/3.2.5.RELEASE"
def parts = version.split("/")
def springVersion = parts[0]
def springSecurityVersion = parts[1]
println("Using Spring version ${springVersion}")
println("Using Spring Security version ${springSecurityVersion}")
dependencies {
compile project(':core')
compile project(':integration-test')
compile group: 'org.springframework.security', name: 'spring-security-core', version: springSecurityVersion
compile group: 'org.springframework', name: 'spring-test', version: springVersion
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
}
project(':examples') {
sourceCompatibility = 1.8
def springBootVersion = '2.0.0.RELEASE'
def h2Version = '1.4.192'
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:$springBootVersion")
compile("org.springframework.boot:spring-boot-starter-security:$springBootVersion")
compile("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion")
compile("com.h2database:h2:$h2Version")
compile("org.apache.httpcomponents:httpclient:4.5.3")
compile("javax.interceptor:javax.interceptor-api:1.2.2") // For JavaDoc as @Transactional requires it
testCompile project(':core')
testCompile("org.springframework.boot:spring-boot-starter-test:$springBootVersion")
testCompile 'com.jayway.restassured:rest-assured:2.5.0'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
// From Petri Kainulainen's examples
// https://github.com/pkainulainen/gradle-examples/blob/master/integration-tests/build.gradle
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/test/java')
}
}
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
check.dependsOn integrationTest
integrationTest.mustRunAfter test
}