root / build.gradle @ 460f2a096fd9063f77651e57bf9854311aed62c4

View | Annotate | Download (2.4 KB)

1
2
def excludedProjects = [
3
	':spepintegrators',
4
	':esoedelegators',
5
	':esoeauthnplugins',
6
	':esoessoplugins',
7
	':esoeidentityplugins',
8
	':spepintegrators:grails'
9
]
10
11
configure(subprojects.findAll{!(it.path in excludedProjects)}) {
12
	usePlugin 'groovy'
13
	usePlugin 'eclipse'
14
15
	group = 'esoeproject'
16
	version = '0.9.6'
17
18
	sourceSets {
19
		main {
20
			java {
21
				srcDir 'src'
22
			}
23
		}
24
		test {
25
			groovy {
26
				srcDir 'tests/regression'
27
				srcDir 'tests/functional'
28
			}
29
		}
30
	}
31
32
	def cobSerFile = file("${project.buildDir}/cobertura.ser")
33
	def srcOriginal = file("${sourceSets.main.classesDir}")
34
	def srcCopy = file("${srcOriginal}-copy")
35
	def cobReportDir = file("${project.buildDir}/reports/coverage")
36
37
	repositories  {
38
		mavenCentral()
39
		mavenRepo urls:'http://download.java.net/maven/2/'
40
	}
41
42
	dependencies {
43
		groovy 'org.codehaus.groovy:groovy-all:1.6.5'
44
45
		testRuntime 'net.sourceforge.cobertura:cobertura:1.9.3'
46
		testRuntime 'cglib:cglib-nodep:2.2'
47
48
		testCompile 'junit:junit:4.7'
49
		testCompile 'org.spockframework:spock-core:0.3'
50
	    testCompile 'org.easymock:easymock:2.5.2'
51
52
		compile 'javax.servlet:servlet-api:2.5'
53
54
		['api', 'log4j12'].each {
55
			compile "org.slf4j:slf4j-${it}:1.5.8"
56
		}
57
	}
58
59
	test.doFirst  {
60
		cobSerFile.delete()
61
		srcCopy.deleteDir()
62
		ant.taskdef(resource:'tasks.properties', classpath: configurations.testRuntime.asPath)
63
		if (!srcOriginal.exists()) srcOriginal.mkdirs()
64
		copy {
65
			from srcOriginal
66
			into srcCopy
67
		}
68
		ant.'cobertura-instrument'(datafile:cobSerFile) {
69
			fileset(dir: srcOriginal) {
70
				include name: "com/qut/middleware/**/*.class"
71
			}
72
		}
73
	}
74
75
	test {
76
		//options.systemProperties['net.sourceforge.cobertura.datafile']="${cobSerFile}"
77
		//stopAtFailuresOrErrors = false
78
	}
79
80
	test.doLast {
81
		if (srcCopy.exists()) {
82
			// replace instrumented classes with backup copy again
83
			srcOriginal.deleteDir()
84
			srcCopy.renameTo(srcOriginal)
85
86
			// create cobertura reports
87
			ant.'cobertura-report'(destdir:cobReportDir, format:'html', srcdir:"src/main/java", datafile:cobSerFile)
88
			ant.'cobertura-report'(destdir:cobReportDir, format:'xml', srcdir:"src/main/java", datafile:cobSerFile)
89
		}
90
	}
91
92
	task copy(type:Copy) {
93
		from 'src'
94
		into compileJava.destinationDir
95
		exclude '**/*.java'
96
	}
97
98
	afterEvaluate {
99
		//it.eclipseCp.srcDirs += it.sourceSets.main.groovy.srcDirs
100
		//it.eclipseCp.testSrcDirs += it.sourceSets.test.groovy.srcDirs
101
	}
102
103
	classes.dependsOn copy
104
}
105
106
dependsOnChildren()
107