forked from apache/groovy-geb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
452 lines (371 loc) · 11.1 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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
buildscript {
repositories {
mavenRepo urls: "http://gradle.artifactoryonline.com/gradle/plugins"
mavenCentral()
}
dependencies {
classpath "org.gradle.plugins:gradle-idea-plugin:0.2",
"org.apache.maven.wagon:wagon-webdav-jackrabbit:1.0-beta-6"
}
}
dependsOnChildren()
allprojects {
grailsVersion = "1.2.3"
seleniumVersion = "2.0a5"
groovyVersion = "1.6.7"
spockVersion = "0.5-groovy-1.6-SNAPSHOT"
spockDependency = "org.spockframework:spock-core:$spockVersion"
seleniumDependency = "org.seleniumhq.selenium:selenium-common:$seleniumVersion"
firefoxDriverDependency = "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
htmlUnitDriverDependency = "org.seleniumhq.selenium:selenium-htmlunit-driver:$seleniumVersion"
jettyDependency = "org.mortbay.jetty:jetty:6.1.21"
groovyDependency = "org.codehaus.groovy:groovy-all:$groovyVersion"
repositories {
mavenCentral()
mavenRepo name: "spock-snapshots", urls: ["http://m2repo.spockframework.org/snapshots"]
}
}
def groovyModules = [
":module:geb-core", ":module:test-utils", ":module:geb-grails",
":module:geb-spock", ":module:geb-junit3", ":module:geb-junit4",
":module:geb-easyb"
]
def publishedModules = [
":module:geb-core", ":module:geb-grails", ":module:geb-spock",
":module:geb-junit3", ":module:geb-junit4", ":module:geb-easyb"
]
if (hasProperty("withSamples")) {
groovyModules << "google"
}
subprojects {
version = '0.5-SNAPSHOT'
group = 'org.codehaus.geb'
apply plugin: "org.gradle.idea"
if (project.path in groovyModules) {
apply plugin: "groovy"
if (project.path != ":test-utils") {
apply from: "file:${rootDir}/clover.gradle"
}
dependencies {
groovy groovyDependency
}
compileGroovy.options.fork = false
compileTestGroovy.options.fork = false
if (project.hasProperty('t')) {
test.doFirst {
test.include "**/${t}*.class"
}
}
test.ignoreFailures = true
sourceCompatibility = 1.5
targetCompatibility = 1.5
configurations {
compile.transitive = true
testCompile.transitive = true
}
if (project.hasProperty("driver")) {
test {
systemProperties['geb.driver'] = project.driver
}
}
task listCompile(dependsOn: configurations.compile) << {
println "compile classpath = ${configurations.compile.resolve().collect {File file -> file.name}.sort()}"
}
task listRuntime(dependsOn: configurations.runtime) << {
println "runtime classpath = ${configurations.runtime.resolve().collect {File file -> file.name}.sort()}"
}
}
if (project.path in publishedModules) {
apply plugin: 'maven'
configurations {
deployerJars
}
dependencies {
deployerJars "org.apache.maven.wagon:wagon-http-lightweight:1.0-beta-6"
}
project.poms = [install.repositories.mavenInstaller.pom]
if (project.hasProperty('codehausUsername') && project.hasProperty('codehausPassword')) {
uploadArchives {
project.deployer = repositories.mavenDeployer {
uniqueVersion = false
configuration = configurations.deployerJars
repository(url: "https://dav.codehaus.org/repository/geb/") {
authentication(userName: codehausUsername, password: codehausPassword)
}
snapshotRepository(url: "https://dav.codehaus.org/snapshots.repository/geb/") {
authentication(userName: codehausUsername, password: codehausPassword)
}
pom.project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}
project.poms << project.deployer.pom
}
}
// Method that subprojects can use to mod the poms
project.modifyPom = {
project.poms*.whenConfigured(it)
}
// Remove test deps from all poms
modifyPom { pom ->
pom.dependencies.removeAll(pom.dependencies.findAll { it.scope == "test" })
}
}
}
project(':module:geb-core') {
dependencies {
compile seleniumDependency
testCompile project(":module:test-utils")
}
}
project(':module:geb-spock') {
dependsOn ":module:geb-core"
dependencies {
compile spockDependency
compile project(':module:geb-core')
testCompile project(":module:test-utils")
}
modifyPom { pom ->
// User provides their own spock
pom.dependencies.removeAll(pom.dependencies.findAll { it.groupId == "org.spockframework" })
}
}
project(':module:geb-junit3') {
dependsOn ":module:geb-core"
dependencies {
compile project(':module:geb-core')
compile "junit:junit:3.8.2"
testCompile project(":module:test-utils")
}
modifyPom { pom ->
// User provides their own junit
pom.dependencies.removeAll(pom.dependencies.findAll { it.groupId == "junit" })
}
}
project(':module:geb-junit4') {
dependsOn ":module:geb-core"
dependencies {
compile project(':module:geb-core')
compile "junit:junit:4.8.1"
testCompile project(":module:test-utils")
}
modifyPom { pom ->
// User provides their own junit
pom.dependencies.removeAll(pom.dependencies.findAll { it.groupId == "junit" })
}
}
project(':module:geb-easyb') {
/* dependsOn ":module:geb-core"*/
dependencies {
compile project(':module:geb-core')
compile ("org.easyb:easyb:0.9.7") {
exclude module: "groovy-all"
}
testCompile(project(":module:test-utils")) {
exclude module: "spock-core" // only need the test server
}
}
test.doLast {
assert testReportDir.exists() || testReportDir.mkdirs()
ant.java(
classname: 'org.easyb.BehaviorRunner',
fork: true,
classpath: sourceSets.test.runtimeClasspath.asPath,
output: "$testReportDir.absolutePath/easyb-output.txt",
failonerror: false,
dir: projectDir,
resultproperty: 'easybresult'
) {
fileTree(dir: "${projectDir}/src/test/stories").matching { include "*" }.each {
arg(value: it.absolutePath)
}
arg(value: "-txtstory")
arg(value: "$testReportDir.absolutePath/easyb.txt")
}
if (ant.easybresult != "0") System.err.println ">> Easyb Failed ($ant.easybresult)"
}
modifyPom { pom ->
// User provides their own easyb
pom.dependencies.removeAll(pom.dependencies.findAll { it.groupId == "org.easyb" })
}
}
project(':module:test-utils') {
dependsOn ":module:geb-spock"
dependencies {
compile project(':module:geb-spock'),
jettyDependency,
firefoxDriverDependency,
htmlUnitDriverDependency
}
}
if (hasProperty('withSamples')) {
project(':samples:google') {
dependencies {
compile project(':module:geb-spock')
}
sourceSets {
test {
resources {
fileTree('src/test/resources').include('**/*.groovy')
}
}
}
}
}
project(":module:geb-grails") {
dependsOn ":module:geb-spock"
dependsOn ":module:geb-junit3"
dependsOn ":module:geb-junit4"
dependsOn ":module:geb-easyb"
dependencies {
compile project(':module:geb-spock'),
project(":module:geb-junit3"),
project(":module:geb-junit4"),
project(":module:geb-easyb"),
"org.grails:grails-core:${grailsVersion}",
"org.grails:grails-test:${grailsVersion}",
"org.grails:grails-web:${grailsVersion}",
"org.slf4j:slf4j-log4j12:1.5.5"
}
modifyPom { pom ->
// set the grails deps to provided
pom.dependencies.findAll { it.groupId in ["org.grails", "org.slf4j"] }*.scope = "provided"
}
}
project(":module:grails-plugin") {
dependsOn ":module:geb-grails"
buildscript {
repositories {
mavenCentral()
mavenRepo name: "codehaus-snapshots", urls: 'http://snapshots.repository.codehaus.org'
mavenRepo name: "java.net", urls: 'http://download.java.net/maven/2'
}
}
apply plugin: "grails"
repositories {
flatDir dirs: "lib"
}
configurations {
compile.exclude module: "commons-logging"
compile.exclude module: 'xml-apis'
}
dependencies {
logging "org.slf4j:slf4j-log4j12:1.5.5"
compile project(':module:geb-grails'),
"org.grails:grails-crud:${grailsVersion}",
"org.grails:grails-gorm:${grailsVersion}"
runtime "hsqldb:hsqldb:1.8.0.5",
"net.sf.ehcache:ehcache-core:1.7.1",
"org.aspectj:aspectjrt:1.6.6"
}
System.setProperty("server.port", "8010")
System.setProperty("geb.building", "true") // disables geb deps in plugins build config
}
project(":doc:manual") {
src = file("src")
output = file("build/manual")
task compile << {
new markdown2book.Generator(src, output, "UTF-8").generate()
}
}
project(":doc:site") {
src = file("src")
output = file("build/site")
manualDir = file("$output/manual")
thisManual = file("$manualDir/$project.version")
task clean(overwrite: true) << {
if (output.exists()) {
assert output.deleteDir()
}
}
task includeManual(dependsOn: project(":doc:manual").compile, type: Sync) {
from project(":doc:manual").output
into project.thisManual
doLast {
ant.symlink link: "${manualDir.path}/latest", resource: thisManual.path, overwrite: true
}
}
task copySrc(type: Copy) {
from src
into output
}
task compile(dependsOn: [copySrc, includeManual]) {}
task upload(dependsOn: compile) << {
if (project.hasProperty('codehausUsername') && project.hasProperty('codehausPassword')) {
def rep = new org.apache.maven.wagon.repository.Repository("codehaus", "https://dav.codehaus.org/geb")
def auth = new org.apache.maven.wagon.authentication.AuthenticationInfo()
auth.userName = codehausUsername
auth.password = codehausPassword
def wagon = new org.apache.maven.wagon.providers.webdav.WebDavWagon()
wagon.connect(rep, auth)
output.eachFile {
if (it.directory) {
wagon.putDirectory(it, it.name)
} else {
wagon.put(it, it.name)
}
}
} else {
println "Can't upload site as credentials aren't set"
}
}
}
// Root Project
configurations {
build
}
dependencies {
build "com.cenqua.clover:clover:3.0.2"
build "org.apache.ant:ant-junit:1.8.1@jar"
build "org.apache.ant:ant-nodeps:1.8.1@jar"
}
task test(dependsOn: getTasksByName("test", true)) << {
def reportsDir = "${buildDir}/reports"
// Aggregate the test results
ant.taskdef(
name: 'junitreport2',
classname: "org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator",
classpath: configurations.build.asPath
)
def testReportsDir = new File("${reportsDir}/tests")
if (testReportsDir.exists()) {
testReportsDir.deleteDir()
}
testReportsDir.mkdirs()
ant.junitreport2(todir: testReportsDir) {
subprojects.each {
def testResultsDir = "${it.buildDir}/test-results"
if (new File(testResultsDir).exists()) {
fileset(dir: testResultsDir) {
include(name: "TEST-*.xml")
}
}
}
report(todir: testReportsDir)
}
// Aggregate the coverage results
if (project.hasProperty("withClover")) {
def db = "clover/clover.db"
def mergedDb = "${buildDir}/${db}"
def cloverReportsDir = "${reportsDir}/clover"
ant.taskdef(resource: "cloverlib.xml", classpath: configurations.build.asPath)
ant."clover-merge"(initstring: mergedDb) {
subprojects.each {
def projectCloverDb = "${it.buildDir}/${db}"
if (new File(projectCloverDb).exists()) {
cloverdb(initstring: projectCloverDb)
}
}
}
ant."clover-report"(initstring: mergedDb) {
current(outfile:"${cloverReportsDir}/clover.xml")
}
ant."clover-html-report"(initstring: mergedDb, outdir:"${cloverReportsDir}/html")
}
}