This repository has been archived by the owner on Jul 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
421 lines (373 loc) · 16.1 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
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
<?xml version ="1.0"?>
<!--L
Copyright Washington University in St. Louis, SemanticBits, Persistent Systems, Krishagni.
Distributed under the OSI-approved BSD 3-Clause License.
See http://ncip.github.com/wustl-common-package/LICENSE.txt for details.
L-->
<!--Ant Script for create Build for Common package-->
<project name="CommonPackage" default="compile">
<!--define require dir and Properties -->
<property name="base.dir" value="."/>
<property name="src.dir" value="${base.dir}/src"/>
<property name="test.dir" value="${base.dir}/test"/>
<property name="target.dir" value="${base.dir}/classes"/>
<property name="lib.dir" value="${base.dir}/lib"/>
<property name="build.dir" value="${base.dir}/build"/>
<property name="applet.dir" value="${base.dir}/Applet"/>
<property name="hbm.dir" value="${src.dir}/edu/wustl/common/hbm"/>
<property name="extra_lib.dir" value="${base.dir}/extra_lib"/>
<property name="generateforce" value="true"/>
<property name="junit.dir" value="${base.dir}/junit"/>
<property name="junit.report.dir" value="${junit.dir}/reports"/>
<property name="junit.classes.dir" value="${junit.dir}/classes"/>
<!--Properties set for checkstyle "Tools that generate report of code convention violations"-->
<property name="checkstyle.dir" value="${base.dir}/checkstyle"/>
<property name="checkstyle.rules.file" value="${checkstyle.dir}/CheckStyleRules.xml"/>
<property name="checkstyle.report.formatter" value="${checkstyle.dir}/report_formatter/checkstyle-simple.xsl"/>
<property name="checkstyle.report.dir" value="${checkstyle.dir}/checkstyle_reports"/>
<property name="checkstyle.unformatted.report" value="${checkstyle.report.dir}/checkstyle_report.xml"/>
<property name="checkstyle.formatted.report" value="${checkstyle.report.dir}/CommonPackage_checkstyle_report.html"/>
<!--Properties set for checkstyle "PMD scans Java source code and looks for potential code problems"-->
<!--Read for more details http://pmd.sourceforge.net/cpd.html -->
<property name="pmd.dir" value="${base.dir}/pmd-3.8"/>
<property name="pmd.report.dir" value="${pmd.dir}/reports"/>
<property name="pmd.report.html" value="${pmd.report.dir}/Common_Package_PMD_Report.html"/>
<property name="metadatatest.dir" value="${base.dir}/metadataTestReport"/>
<property name="metadatatest.report.dir" value="${metadatatest.dir}/Report"/>
<path id="app.classpath">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<path id="xdoclet.classpath">
<path refid="app.classpath"/>
<pathelement location="${extra_lib.dir}/commons-net-1.2.2.jar"/>
<pathelement location="${extra_lib.dir}/hibernate-tools.jar"/>
<pathelement location="${extra_lib.dir}/servlet-api.jar"/>
<pathelement location="${extra_lib.dir}/xdoclet-1.2.jar"/>
<pathelement location="${extra_lib.dir}/xdoclet-hibernate-module-1.2.jar"/>
<pathelement location="${extra_lib.dir}/xdoclet-xdoclet-module-1.2.jar"/>
<pathelement location="${extra_lib.dir}/xerces.jar"/>
<pathelement location="${extra_lib.dir}/xjavadoc-1.0.2.jar"/>
<pathelement location="${extra_lib.dir}/xsdlib.jar"/>
<pathelement location="${test.dir}" />
</path>
<path id="junit.classpath">
<path refid="app.classpath"/>
<pathelement location="${target.dir}"/>
</path>
<path id="checkstyle.classpath">
<pathelement location="${build.dir}/commonpackage.jar"/>
<pathelement location="${lib.dir}/DynamicExtensions.jar"/>
</path>
<!-- sub tasks -->
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<delete dir="${target.dir}"/>
<mkdir dir="${target.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${applet.dir}"/>
<delete dir="${junit.dir}"/>
<mkdir dir="${junit.dir}"/>
<!-- Create the checkstyle report directory-->
<delete dir="${checkstyle.report.dir}"/>
<mkdir dir="${checkstyle.report.dir}"/>
<!-- Create the PMD report directory-->
<delete dir="${pmd.report.dir}"/>
<mkdir dir="${pmd.report.dir}"/>
</target>
<!-- Compile all files, generated and hand-written -->
<target name="compile" depends="init">
<javac destdir="${target.dir}" includes="**/*.*" includeAntRuntime="false">
<src path="${src.dir}"/>
<src path="${test.dir}"/>
<classpath>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
<copy todir="${target.dir}">
<fileset dir="${src.dir}">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*.hbm.xml"/>
<include name="**/*.ser"/>
</fileset>
<fileset dir="${test.dir}">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*.hbm.xml"/>
<include name="**/*.ser"/>
</fileset>
</copy>
</target>
<target name="compileTest" depends="compile">
<mkdir dir="${junit.classes.dir}"/>
<javac destdir="${junit.classes.dir}" includes="**/*.*" includeAntRuntime="false">
<src path="${test.dir}"/>
<classpath>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${target.dir}"/>
</classpath>
</javac>
</target>
<!-- Create the Applet JAR Begins-->
<!--target name="AppletJAR" depends="compile" >
<delete>
<fileset dir="${applet.dir}">
<exclude name="**/CVS*"/>
<exclude name="**/java.policy.applet*"/>
</fileset>
</delete>
<copy todir="${applet.dir}/edu/wustl/common/treeApplet">
<fileset dir="${target.dir}/edu/wustl/common/treeApplet">
<include name="**/*.class"/>
</fileset>
</copy>
<copy todir="${applet.dir}/edu/wustl/common/tree">
<fileset dir="${target.dir}/edu/wustl/common/tree">
<include name="**/*.class"/>
</fileset>
</copy>
<jar taskname="BuildJar" jarfile="${applet.dir}/TreeApplet.jar">
<fileset dir="${applet.dir}">
<exclude name="**/CVS*"/>
<exclude name="**/java.policy.applet*"/>
</fileset>
</jar>
<delete dir="${applet.dir}/edu"/>
</target-->
<!-- Create the Applet JAR Ends-->
<!-- Compile all files, generated and hand-written -->
<target name="applet_compile" depends="init" >
<delete>
<fileset dir="${applet.dir}">
<exclude name="**/CVS*"/>
<exclude name="**/java.policy.applet*"/>
</fileset>
</delete>
<javac destdir="${applet.dir}" includeAntRuntime="false" fork="yes" executable="C:/Program Files/Java/jdk1.5.0_05/bin/javac" compiler="javac1.5">
<src path="${src.dir}"/>
<include name="**/edu/wustl/common/tree/*.java"/>
<include name="**/edu/wustl/common/treeApplet/*.java"/>
<classpath>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<!-- Create the Applet JAR Begins-->
<target name="AppletJAR" depends="applet_compile" >
<delete>
<fileset dir="${applet.dir}">
<include name="**/*.jar"/>
</fileset>
</delete>
<copy todir="${applet.dir}/images">
<fileset dir="${base.dir}/images">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${applet.dir}">
<fileset dir="${lib.dir}">
<include name="**/swingx-2006_10_08.jar"/>
</fileset>
</copy>
<jar taskname="buildJar" jarfile="${applet.dir}/TreeApplet.jar">
<manifest>
<attribute name="Class-Path" value="swingx-2006_10_08.jar"/>
</manifest>
<fileset dir="${applet.dir}">
<exclude name="**/CVS*"/>
<exclude name="**/java.policy.applet*"/>
</fileset>
</jar>
</target>
<!-- Create the Applet JAR Ends-->
<!-- Generate the hbm files from the XDoclet -->
<target name="GenerateHBM" description="Generates Hibernate class descriptor files.">
<!-- Define the hibernatedoclet task -->
<taskdef name="hibernatedoclet" classname="xdoclet.modules.hibernate.HibernateDocletTask">
<classpath refid="xdoclet.classpath"/>
</taskdef>
<!-- Execute the hibernatedoclet task -->
<hibernatedoclet destdir="${src.dir}" excludedtags="@version,@author,@todo"
force="${generateforce}" mergedir="${src.dir}" verbose="false">
<fileset dir="${src.dir}">
<include name="**/domain/*.java"/>
<include name="**/cde/*.java"/>
<include name="**/category/*.java"/>
</fileset>
<hibernate version="2.0"/>
</hibernatedoclet>
<!-- Upgrade grammar from Hibernate1 to Hibernate2 -->
<replace dir="${src.dir}">
<include name="**/domain/*.hbm.xml"/>
<include name="**/cde/*.hbm.xml"/>
<include name="**/category/*hbm.xml"/>
<replacefilter token="readonly=" value="inverse="/>
<replacefilter token="role=" value="name="/>
<replacefilter token="hibernate-mapping.dtd" value="hibernate-mapping-2.0.dtd"/>
</replace>
<copy todir="${hbm.dir}">
<fileset dir="${src.dir}/edu/wustl/common/domain">
<include name="*.hbm.xml"/>
</fileset>
<fileset dir="${src.dir}/edu/wustl/common/cde">
<include name="*.hbm.xml"/>
</fileset>
<fileset dir="${src.dir}/edu/wustl/common/querysuite/metadata/category">
<include name="*.hbm.xml"/>
</fileset>
</copy>
<delete>
<fileset dir="${src.dir}/edu/wustl/common/domain" includes="*.hbm.xml"/>
<fileset dir="${src.dir}/edu/wustl/common/cde" includes="*.hbm.xml"/>
<fileset dir="${src.dir}/edu/wustl/common/querysuite/metadata/category" includes="*.hbm.xml"/>
</delete>
</target>
<target name="build_code_zip" depends="compile" >
<zip destfile="${build.dir}/commonpackage-src.zip">
<fileset dir="${src.dir}" includes="**/*"/>
</zip>
</target>
<target name="build_jar" depends="compile" >
<delete>
<fileset dir="${build.dir}" includes="**/*"/>
</delete>
<jar taskname="build_jar" jarfile="${build.dir}/commonpackage.jar">
<fileset dir="${target.dir}">
<include name="**/*"/>
<exclude name="**/SqlGeneratorTestCase*"/>
<exclude name="**/ExpressionTestCases*"/>
<exclude name="**/JoinGraphTestCase*"/>
</fileset>
<fileset dir="${base.dir}" includes="**/ExceptionFormatter.properties"/>
<fileset dir="${base.dir}" includes="**/dbutil.properties"/>
</jar>
<antcall target="build_code_zip"/>
</target>
<target name="Generate-Schema" depends="build_jar">
<java classname="edu.wustl.common.util.dbManager.GenerateSchema">
<arg value="false"/>
<classpath>
<pathelement location="${build.dir}/catissuecore.jar"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
</java>
</target>
<target name="runJunit" depends="compileTest">
<mkdir dir="${junit.report.dir}"/>
<delete>
<fileset dir="${junit.report.dir}" includes="**/*"/>
</delete>
<junit printsummary="yes" haltonerror="no" haltonfailure="no" fork="yes">
<test name="edu.wustl.common.querysuite.TestAll" outfile="${junit.report.dir}/Junit_report_CommonPackage"/>
<formatter type="plain"/>
<!--batchtest todir="${junit.report.dir}">
<fileset dir="${test.dir}">
<include name="**/TestAll.java"/>
</fileset>
</batchtest-->
<classpath>
<pathelement location="${junit.classes.dir}"/>
<pathelement location="${target.dir}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
</junit>
</target>
<target name="checkstyle" depends="build_jar" description="Generates a report of code convention violations.">
<taskdef resource="checkstyletask.properties" classpath="${extra_lib.dir}/checkstyle-all-4.2.jar"/>
<checkstyle config="${checkstyle.rules.file}" failureProperty="checkstyle.failed" failOnViolation="false" classpathref="checkstyle.classpath" >
<formatter type="xml" tofile="${checkstyle.unformatted.report}" />
<!-- Adding all querysuite packages-->
<fileset dir="${src.dir}" includes="**/querysuite/**/*.java"/>
</checkstyle>
<style in="${checkstyle.unformatted.report}" out="${checkstyle.formatted.report}" style="${checkstyle.report.formatter}"/>
</target>
<!-- ,,,,,junit,logging-jakarta-commons,logging-java,migrating,,optimizations,strictexception,,,"-->
<target name="pmd" depends="init" description="PMD scans Java source code and looks for potential code problems.">
<taskdef name="pmd" classpath="${pmd.dir}/lib/pmd-3.8.jar" classname="net.sourceforge.pmd.ant.PMDTask"/>
<pmd shortFilenames="true">
<ruleset>basic</ruleset>
<ruleset>braces</ruleset>
<ruleset>clone</ruleset>
<ruleset>codesize</ruleset>
<ruleset>controversial</ruleset>
<ruleset>coupling</ruleset>
<ruleset>design</ruleset>
<ruleset>finalizers</ruleset>
<ruleset>imports</ruleset>
<ruleset>j2ee</ruleset>
<ruleset>migrating</ruleset>
<ruleset>naming</ruleset>
<ruleset>strings</ruleset>
<ruleset>unusedcode</ruleset>
<ruleset>sunsecure</ruleset>
<!--ruleset>javabeans</ruleset-->
<formatter type="html" toFile="${pmd.report.html}"/>
<fileset dir="${src.dir}" includes="**/querysuite/**/*.java"/>
</pmd>
</target>
<target name="executeQueries">
<delete dir="${junit.classes.dir}"/>
<mkdir dir="${junit.classes.dir}"/>
<javac srcdir="${test.dir}" destdir="${junit.classes.dir}" >
<include name="edu/wustl/common/querysuite/ExecuteQueries.java"/>
<!--include name="**/ExecuteQueries.java"/-->
<classpath refid="app.classpath"/>
</javac>
<property file="queryDetails.properties"/>
<echo message="Database Settings:"/>
<echo message="Database Type: ${database.type}"/>
<echo message="Database Host: ${database.host}"/>
<echo message="Database Host: ${database.port}"/>
<echo message="Database Name: ${database.name}"/>
<echo message="Database User name: ${database.username}"/>
<echo message="Database Password: ${database.password}"/>
<echo message="SQL File: ${base.dir}/${sql.fileName}"/>
<java classname="edu.wustl.common.querysuite.ExecuteQueries" fork="true">
<arg value="${database.type}"/>
<arg value="${database.host}"/>
<arg value="${database.port}"/>
<arg value="${database.name}"/>
<arg value="${database.username}"/>
<arg value="${database.password}"/>
<arg value="${base.dir}/${sql.fileName}"/>
<arg value="${databse.tableNames}"/>
<classpath>
<pathelement location="${junit.classes.dir}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
<classpath refid="app.classpath"/>
</java>
</target>
<!-- Metadata Report Generation task -->
<target name="QueryMetadataTestReport" depends="compileTest">
<delete dir="${metadatatest.report.dir}"/>
<mkdir dir="${metadatatest.report.dir}"/>
<java classname="edu.wustl.common.querysuite.MetadataTestReportGenerator" fork="true">
<arg value="${metadatatest.report.dir}"/>
<classpath>
<pathelement location="${metadatatest.dir}"/>
<pathelement location="${target.dir}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
<classpath refid="app.classpath"/>
</java>
</target>
</project>