-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
331 lines (275 loc) · 11.9 KB
/
build.xml
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
<?xml version="1.0"?>
<project name="EPA-Commons" default="core" basedir=".">
<!-- =================== Properties ====================================== -->
<property file="build.properties" />
<property file="${user.home}/build.properties" />
<property name="env" environment="env" value="env" />
<property name="J2EE_HOME" value="${env.J2EE_HOME}" />
<property name="JAVA_HOME" value="${env.JAVA_HOME}" />
<property name="core.src.dir" value="src/core" />
<property name="postgres.src.dir" value="src/postgres" />
<property name="lib.dir" value="lib" />
<property name="core.test.dir" value="test/core" />
<property name="core.test.unit.dir" value="${core.test.dir}/unit" />
<property name="core.test.integration.dir"
value="${core.test.dir}/integration"
/>
<property name="postgres.test.dir" value="test/postgres" />
<property name="postgres.test.unit.dir" value="${postgres.test.dir}/unit" />
<property name="postgres.test.integration.dir"
value="${postgres.test.dir}/integration"
/>
<property name="build.home" value="build/sandbox" />
<property name="build.dist.dir" value="${build.home}/dist" />
<property name="build.classes.dir" value="${build.dist.dir}/classes" />
<property name="reports.dir" value="${build.home}/reports" />
<property name="reports.tests.dir" value="${reports.dir}/tests" />
<property name="app.name" value="emf" />
<property name="app.path" value="/${app.name}" />
<property name="test.database" value="Postgres" />
<path id="classpath">
<pathelement location="${build.classes.dir}" />
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<!-- ===================START Basic Targets ====================================== -->
<target name="init">
<mkdir dir="${build.home}" />
<mkdir dir="${build.classes.dir}" />
<mkdir dir="${reports.tests.dir}" />
</target>
<target name="clean">
<delete includeemptydirs="true" failonerror="no">
<fileset dir="${build.home}" includes="**/*" />
</delete>
</target>
<target name="compile-core-src" depends="clean, init">
<antcall target="do-compile-src">
<param name="src.dir" value="${core.src.dir}" />
</antcall>
</target>
<target name="compile-postgres-src" depends="clean, init, compile-core-src">
<antcall target="do-compile-src">
<param name="src.dir" value="${postgres.src.dir}" />
</antcall>
</target>
<target name="do-compile-src">
<javac srcdir="${src.dir}"
destdir="${build.classes.dir}"
classpathref="classpath"
debug="on"
target="1.6"
source="1.6"
/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" includes="**/*.*" />
</copy>
</target>
<target name="compile-core-tests" depends="clean, init, compile-core-src">
<antcall target="do-compile-tests">
<param name="test.unit.dir" value="${core.test.unit.dir}" />
<param name="test.integration.dir"
value="${core.test.integration.dir}"
/>
</antcall>
</target>
<target name="compile-postgres-tests"
depends="clean, init, compile-core-src, compile-postgres-src, compile-core-tests"
>
<antcall target="do-compile-tests">
<param name="test.unit.dir" value="${postgres.test.unit.dir}" />
<param name="test.integration.dir"
value="${postgres.test.integration.dir}"
/>
</antcall>
</target>
<target name="do-compile-tests">
<javac srcdir="${test.unit.dir}"
destdir="${build.classes.dir}"
classpathref="classpath"
debug="on"
/>
<javac srcdir="${test.integration.dir}"
destdir="${build.classes.dir}"
classpathref="classpath"
debug="on"
/>
</target>
<target name="compile-core"
depends="compile-core-src, compile-core-tests"
/>
<target name="compile-postgres"
depends="compile-postgres-src, compile-postgres-tests"
/>
<target name="compile"
depends="clean, init, compile-core, compile-postgres"
/>
<!-- ===============END Basic ====================================== -->
<!-- ===============START Tests ====================================== -->
<target name="core-tests" depends="compile-core, do-tests" />
<target name="postgres-tests"
depends="compile-postgres, core-tests, do-tests"
/>
<target name="tests" depends="compile, do-tests" />
<target name="mysql-tests">
<antcall target="core-tests">
<param name="test.database" value="MySql" />
</antcall>
</target>
<target name="do-tests">
<junit printsummary="yes" haltonfailure="yes">
<classpath refid="classpath" />
<jvmarg value="-DDatabase=${test.database}" />
<formatter type="xml" />
<batchtest fork="yes" todir="${reports.tests.dir}">
<fileset dir="${build.classes.dir}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<target name="setup-reference-schema"
depends="compile"
description="Sets up Reference schema"
>
<java classname="gov.epa.emissions.commons.io.reference.ReferenceDatasourceSetup"
fork="true"
failonerror="true"
classpathref="classpath"
>
<arg line="test/postgres.conf config/ref/delimited"/>
</java>
</target>
<!-- DEFAULT target-->
<target name="core" depends="tests" />
<target name="mysql-core" depends="mysql-tests" />
<!-- Continuous Integration target -->
<target name="ci-build"
depends="compile, core"
description="Continuous Integration build"
/>
<!-- ===============END Tests ====================================== -->
<!-- ===============START CVS Targets ====================================== -->
<target name="cvs-properties-load">
<property file=".cvs" />
</target>
<target name="cvs-username-check"
depends="cvs-properties-load"
unless="cvs.username"
>
<echo message="Please create a .cvs file in your project home directory w/ the following properties:"
/>
<echo message="username='cvs username'" />
</target>
<target name="cvs-update" depends="cvs-username-check" if="cvs.username">
<cvs command="update"
cvsroot=":pserver:${cvs.username}@cvs.sourceforge.net:/cvsroot/emisview"
quiet="yes"
reallyquiet="yes"
failonerror="yes"
/>
<echo message="EMF update is complete." />
</target>
<!-- ===============END CVS Targets ====================================== -->
<!-- ===============START Coverage Targets =============================== -->
<path id="cobertura.classpath">
<fileset dir="${lib.dir}/dev/cobertura">
<include name="**/*.jar" />
</fileset>
<path refid="classpath" />
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<property name="coverage.dir" value="${reports.dir}/coverage" />
<property name="instrumented.dir" value="${coverage.dir}/instrumented" />
<property name="reports.xml.dir" value="${coverage.dir}/tests/xml" />
<property name="reports.html.dir" value="${coverage.dir}/tests/html" />
<property name="coverage.xml.dir" value="${coverage.dir}/coverage/xml" />
<property name="coverage.html.dir" value="${coverage.dir}/coverage/html" />
<target name="coverage-init">
<mkdir dir="${build.classes.dir}" />
<mkdir dir="${instrumented.dir}" />
<mkdir dir="${reports.xml.dir}" />
<mkdir dir="${reports.html.dir}" />
<mkdir dir="${coverage.xml.dir}" />
<mkdir dir="${coverage.html.dir}" />
</target>
<target name="instrument" depends="coverage-init">
<delete file="cobertura.ser" />
<cobertura-instrument todir="${instrumented.dir}">
<ignore regex="org.apache.log4j.*" />
<fileset dir="${build.classes.dir}">
<include name="**/*.class" />
<exclude name="**/*Test.class" />
</fileset>
</cobertura-instrument>
</target>
<target name="run-instrumented-tests" depends="compile, instrument">
<junit printsummary="yes" haltonfailure="yes">
<classpath location="${instrumented.dir}" />
<classpath refid="classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${reports.xml.dir}">
<fileset dir="${test.emf.unit.dir}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${reports.xml.dir}">
<fileset dir="${reports.xml.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${reports.html.dir}" />
</junitreport>
</target>
<target name="coverage-check">
<cobertura-check branchrate="34" totallinerate="100" />
</target>
<target name="xml-coverage-report">
<cobertura-report srcdir="${core.src.dir}}"
destdir="${coverage.xml.dir}"
format="xml"
/>
</target>
<target name="html-coverage-report">
<cobertura-report destdir="${coverage.html.dir}">
<fileset dir="${core.src.dir}">
<include name="**/*.java" />
</fileset>
</cobertura-report>
</target>
<target name="coverage"
depends="compile,instrument,run-instrumented-tests,xml-coverage-report,html-coverage-report"
description="Compile, instrument ourself, run the tests and generate JUnit and coverage reports."
/>
<!-- ===============END Coverage Targets =============================== -->
<!-- ================START Distribution Targets ========================= -->
<target name="dist" depends="core, do-dist" />
<target name="do-dist" depends="compile">
<copy todir="${build.classes.dir}">
<fileset dir="${core.src.dir}" includes="**/*" />
</copy>
<jar jarfile="${build.home}/${app.name}.jar"
basedir="${build.classes.dir}"
/>
</target>
<!-- ================END Distribution Targets ========================= -->
<!-- ===============START Commons-dependent modules ============================== -->
<!-- Analysis Engine -->
<target name="analysisengine.basedir.check">
<property name="analysisengine.basedir" value="${basedir}/../${analysisengine.project.name}" />
<echo message="Checking existence of AnalysisEngine project in '${analysisengine.basedir}'"/>
<available file="${analysisengine.basedir}" property="analysisengine.basedir.present" />
</target>
<target name="analysisengine-dist-warning" depends="analysisengine.basedir.check" unless="analysisengine.basedir.present">
<property name="parent.basedir" value="${basedir}/.." />
<echo message="You need to checkout the AnalysisEngine module from CVS into ${analysisengine.basedir} before attempting to build the AnalysisEngine codebase" />
</target>
<target name="analysisengine-dist" depends="analysisengine.basedir.check, analysisengine-dist-warning" if="analysisengine.basedir.present">
<ant dir="${analysisengine.basedir}" target="do-dist" inheritall="false" />
<copy todir="${lib.dir}">
<fileset dir="${analysisengine.basedir}/build/sandbox" includes="*.jar" />
</copy>
</target>
<!-- ===============END Commons-dependent modules ============================== -->
</project>