forked from dimagi/commcare-j2me
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
178 lines (150 loc) · 4.11 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
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'pmd'
apply plugin: 'jacoco'
sourceCompatibility = 1.7
repositories {
mavenCentral()
}
checkstyle {
toolVersion = "6.7"
sourceSets = [sourceSets.main]
}
findbugs {
ignoreFailures = true
sourceSets = [sourceSets.main]
effort = "max"
}
pmd {
ignoreFailures = true
sourceSets = [sourceSets.main]
}
jacoco {
toolVersion = "0.7.4.+"
}
test {
reports.junitXml.destination = file('build/reports/tests')
}
sourceSets {
main {
java {
srcDir 'core/src/main/java'
}
}
harness {
java {
srcDir 'core/src/main/java'
srcDir 'util/schema-gen/src'
}
resources{
srcDir 'core/src/test/resources'
}
}
translate {
java {
srcDir 'core/src/main/java'
srcDir 'util/schema-gen/src'
srcDir 'util/validator/org.javarosa.xform.validator/src'
}
}
test {
java {
srcDir 'core/src/test/java'
}
resources{
srcDir 'core/src/test/resources'
}
}
}
dependencies {
compile 'kxml2:kxml2:2.3.0'
compile files('lib/regexp-me.jar')
testCompile 'junit:junit:4.12'
harnessCompile 'kxml2:kxml2:2.3.0'
harnessCompile files('lib/regexp-me.jar')
harnessCompile 'xpp3:xpp3:1.1.4c'
harnessCompile files('util/schema-gen/lib/json-simple-1.1.1.jar')
harnessCompile 'commons-cli:commons-cli:1.3.1'
translateCompile 'kxml2:kxml2:2.3.0'
translateCompile files('lib/regexp-me.jar')
translateCompile 'xpp3:xpp3:1.1.4c'
translateCompile files('util/schema-gen/lib/json-simple-1.1.1.jar')
translateCompile 'commons-cli:commons-cli:1.3.1'
}
jar {
baseName = "javarosa-libraries"
}
configurations {
harness
translate
testsAsJar
}
task harnessJar(type: Jar, dependsOn: harnessClasses) {
baseName = "javarosa-cli"
from sourceSets.harness.output
from sourceSets.main.output
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
configurations.runtime.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes 'Main-Class': 'org.javarosa.engine.Harness'
}
}
// used to provide the test source files to external projects, such as odk,
// which might want to import classes
task testsrcJar(type: Jar, dependsOn: testClasses) {
classifier = 'tests'
from files(sourceSets.test.output.classesDir)
}
task formTranslateJar(type: Jar, dependsOn: translateClasses) {
baseName = "form_translate"
from sourceSets.translate.output
from sourceSets.main.output
from {
configurations.translateCompile.collect {
it.isDirectory() ? it : zipTree(it)
}
configurations.translateRuntime.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes 'Main-Class': 'org.javarosa.xform.schema.Harness'
}
}
artifacts {
harness harnessJar
translate formTranslateJar
testsAsJar testsrcJar
}
task copyTestResources(type: Copy) {
from sourceSets.test.resources
into "${buildDir}/classes/test"
}
processTestResources.dependsOn copyTestResources
def buildDeps = hasProperty('javarosaDeps') ? javarosaDeps : null
/* for use primarily by the build server to extract the required 3rd-party
libraries into the javarosa source tree. to use this in your own build, set the
'extract-libs-fresh' property, then also set the 'javarosa-deps' property to
the path of the library archive (make sure you are using the version of the
archive compatible with the version you wish to build) */
task extractLibs(type: Copy) {
if (buildDeps != null) {
from zipTree(file("${buildDeps}")) into file("${projectDir}")
}
}
compileJava.dependsOn extractLibs
task jenkinsTest {
inputs.files test.outputs.files
doLast {
def timestamp = System.currentTimeMillis()
test.getReports().getJunitXml().getDestination().eachFile { it.lastModified = timestamp }
}
}
check.dependsOn(jenkinsTest)