-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathbuild.xml
606 lines (537 loc) · 26.6 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
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
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
<?xml version="1.0"?>
<!-- *********************************************************** -->
<!-- ** Ant build script for OpenMRS ** -->
<!-- ** ** -->
<!-- *********************************************************** -->
<project name="OpenMRS-trunk" default="dist">
<tstamp>
<format property="timestamp" pattern="MMM dd yyyy hh:mm aa" />
</tstamp>
<!-- Environment properties -->
<property environment="env"/>
<property name="env.COMPUTERNAME" value="${env.HOSTNAME}"/>
<!-- Library versions and JARs -->
<property name="lib.dir" location="lib" />
<property file="${lib.dir}/lib.properties" />
<fileset id="lib.files" dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<path id="lib.path">
<fileset refid="lib.files" />
</path>
<!-- Every java and xml file in the test directory -->
<fileset id="test.files" dir="${test.dir}" description="All files in /test/">
<include name="**/*" />
</fileset>
<!-- Base definitions (cannot be overwritten by user property file) -->
<property file="build.properties" />
<!-- CheckStyle properties -->
<property file="openmrs-checkstyle.properties" />
<!-- Taskdefs -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<fileset dir="${ant-contrib.dir}" includes="*.jar" />
</classpath>
</taskdef>
<taskdef file="${tomcat.dir}/tomcatTasks.properties">
<classpath>
<pathelement path="${tomcat.dir}/catalina-ant.jar" />
</classpath>
</taskdef>
<taskdef resource="checkstyletask.properties">
<classpath>
<pathelement path="${checkstyle.dir}/checkstyle-all-5.1.jar"/>
</classpath>
</taskdef>
<!-- Load user's build properties -->
<echo message="Attempting to load: ${env.OPENMRS_BUILD_PROPERTIES_FILE}" />
<available file="${env.OPENMRS_BUILD_PROPERTIES_FILE}" property="env.file.exists"/>
<available file="${user.home}/Application Data/OpenMRS/OPENMRS-build.properties" property="appdata.file.exists"/>
<available file="${user.home}/.OpenMRS/OPENMRS-build.properties" property="unix.file.exists"/>
<if>
<equals arg1="${env.file.exists}" arg2="true" />
<then>
<!-- Load user overrides from environment variable -->
<property file="${env.OPENMRS_BUILD_PROPERTIES_FILE}"/>
</then>
<elseif>
<equals arg1="${appdata.file.exists}" arg2="true" />
<then>
<!-- Load user overrides from userhome/Application Data/OpenMRS dir -->
<echo message="Using build properties in: ${user.home}/Application Data/OpenMRS/OPENMRS-build.properties" />
<property file="${user.home}/Application Data/OpenMRS/OPENMRS-build.properties"/>
</then>
</elseif>
<elseif>
<equals arg1="${unix.file.exists}" arg2="true" />
<then>
<!-- Load user overrides from userhome/.OPENMRS-build.properties file -->
<echo message="Using build properties in: ${user.home}/.OpenMRS/OPENMRS-build.properties" />
<property file="${user.home}/.OpenMRS/OPENMRS-build.properties"/>
</then>
</elseif>
<else>
<echo message="WARNING:"/>
<echo message="No custom build properties found. Using default properties" />
</else>
</if>
<!-- import default properties -->
<import file="properties.xml" />
<!-- *********************************************************** -->
<!-- ** TARGETS ** -->
<!-- *********************************************************** -->
<target name="init" description="initialization done before most compile/packaging targets">
<loadfile srcfile="${openmrs.version.revision.filename}" property="repositoryFileInput" />
<if>
<contains string="${repositoryFileInput}" substring="<?xml" casesensitive="false" />
<then>
<!-- SVN pre-1.4 uses XML format -->
<propertyregex property="openmrs.version.revision"
input="${repositoryFileInput}"
regexp="${openmrs.version.revision.regexp}"
select="\1"
defaultValue="? (error with pre-1.4 revision regexp)" />
</then>
<else>
<!-- SVN 1.4+ does not use XML format, just grab 11th line -->
<propertyregex property="openmrs.version.revision"
input="${repositoryFileInput}"
regexp="^(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n"
select="\11"
defaultValue="? (error in post-1.4 revision regexp)" />
</else>
</if>
<property
name="openmrs.version.long"
value="${openmrs.version.major}.${openmrs.version.minor}.${openmrs.version.maintenance} ${openmrs.version.suffix} Build ${openmrs.version.revision}"/>
<property
name="openmrs.version.short"
value="${openmrs.version.major}.${openmrs.version.minor}.${openmrs.version.maintenance}.${openmrs.version.revision}-${openmrs.version.suffix}"/>
<property
name="openmrs.version.shortnumericonly"
value="${openmrs.version.major}.${openmrs.version.minor}.${openmrs.version.maintenance}.${openmrs.version.revision}"/>
<echo message="version: ${openmrs.version.long}"/>
<property
name="openmrs.api.name"
value="openmrs-api-${openmrs.version.short}.jar"/>
<!-- These variables are replaced in the web.xml file during compilation
and then read in by org.openmrs.web.Listener at openmrs startup -->
<filterset id="web.xml.variables.to.replace">
<filter token="WEBAPP.DISPLAY.NAME" value="${webapp.display.name}" />
<filter token="WEBAPP.DESCRIPTION" value="${webapp.description}" />
<filter token="TIMESTAMP" value="${timestamp}" />
</filterset>
<!-- Other variables are put in the jar manifest file to be read in
during object construction -->
</target>
<target name="clean" description="Delete build and dist directories">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${doc.dir}" />
</target>
<target name="compile-api" depends="init" description="compile api">
<mkdir dir="${build.dir}" />
<!-- Copy hibernate metadata and logging settings to build directory -->
<copy todir="${build.dir}">
<fileset dir="${metadata.dir}/api/hibernate" includes="**/*" />
<fileset dir="${metadata.dir}/api/spring" includes="applicationContext-service.xml" />
<fileset dir="${metadata.dir}/model" includes="liquibase-update-to-latest.xml" />
<fileset dir="${metadata.dir}/model/archive" includes="update-to-1.4.2.01-db.mysqldiff.sql" />
</copy>
<javac destdir="${build.dir}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" classpathref="api.compile.classpath">
<compilerarg line="${compile.arguments}" />
<src path="${src.dir}/api" />
</javac>
</target>
<target name="package-all" depends="package-api,package-api-tests,package-web-src"
description="packages api, test, and web jars for use in modules"/>
<!-- the api package will contain test classes unless an "ant clean" is done right before -->
<target name="package-api" depends="compile-api" description="create openmrs api jar">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/${openmrs.api.name}">
<manifest>
<attribute name="Class-Path" value="${openmrs.api.name}" />
<attribute name="Build-Timestamp" value="${timestamp}" />
<!-- Build properties for OpenmrsConstants to pick up -->
<section name="org/openmrs/util/">
<attribute name="Package-Title" value="org.openmrs.util"/>
<attribute name="Specification-Title" value="OpenMRS Build Version and Short Version"/>
<attribute name="Specification-Vendor" value="${openmrs.version.long}"/>
<attribute name="Specification-Version" value="${openmrs.version.shortnumericonly}"/>
</section>
</manifest>
<fileset dir="${build.dir}">
<include name="**/*"/>
<exclude name="**/web/**" />
<exclude name="junit*/" /> <!-- the junit built files -->
<exclude name="**/*Test*.class" />
<exclude name="**/include/" /> <!-- to skip all xml and omod files -->
<exclude name="**/test/" />
<exclude name="liquibase-data/" /> <!-- to skip the liquibase starter xml files -->
</fileset>
<fileset dir="${build.dir}">
<!-- For spring's exclusion of tests that were accidentally put into omods -->
<include name="org/openmrs/util/TestTypeFilter.class" />
</fileset>
</jar>
</target>
<target name="package-javadoc-api" description="packages api documentation into /doc/api.zip">
<delete dir="${doc.dir}/api" />
<copy todir="${doc.dir}/api">
<fileset file="${metadata.dir}/images/openmrs-logo-small.gif" />
</copy>
<javadoc packagenames="org.openmrs.*" destdir="${doc.dir}/api" classpathref="api.compile.classpath" author="true" version="true" windowtitle="${doc.title}" header="${doc.header}" footer="${doc.footer}" bottom="${doc.bottom}">
<tag name="should" scope="all" description="Expected behavior: " />
<packageset dir="${src.dir}/api" defaultexcludes="yes">
<include name="org/openmrs/**" />
<exclude name="**/.svn" />
</packageset>
</javadoc>
<delete file="${doc.dir}/api.zip" />
<zip destfile="${doc.dir}/api.zip" basedir="${doc.dir}" includes="api/**" />
</target>
<target name="compile-api-tests" depends="package-api" description="compile the java files in /test/api">
<mkdir dir="${build.dir}" />
<javac srcdir="${test.dir}/api" destdir="${build.dir}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" classpathref="api.test.classpath">
<compilerarg line="${compile.arguments}" />
</javac>
<!-- move files over that are required for modules to use this test-openmrs-api*.jar file -->
<copy todir="${build.dir}/org/openmrs/test/" file="${test.dir}/api/org/openmrs/test/TestingApplicationContext.xml" />
<copy todir="${build.dir}/org/openmrs/include" file="${test.dir}/api/org/openmrs/include/initialInMemoryTestDataSet.xml" />
<!-- copy the extra files to the build dir in case an ant-clean was just done -->
<copy todir="${build.dir}">
<!-- dbunit files for db and api tests -->
<fileset dir="${test.dir}/api" includes="**/*.xml"/>
<!-- module files for module tests -->
<fileset dir="${test.dir}/api" includes="**/*.omod"/>
</copy>
</target>
<target name="package-api-tests" depends="compile-api-tests" description="create api-tests jar">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/tests-${openmrs.api.name}">
<manifest>
<attribute name="Class-Path" value="tests-${openmrs.api.name}" />
</manifest>
<fileset dir="${build.dir}">
<exclude name="**/web/" />
<include name="**/test/*.class" /> <!-- include the helper files -->
<include name="**/*Test*.class" /> <!-- include all junit tests and inner classes -->
<include name="**/include/*.xml" />
<!-- For spring's exclusion of tests. These are in the openmrs-api.jar file -->
<exclude name="org/openmrs/util/TestTypeFilter.class" />
</fileset>
<!-- Put this xml in a separate fileset so that its in the root of the jar file -->
<fileset file="${build.dir}/org/openmrs/test/TestingApplicationContext.xml" />
</jar>
</target>
<target name="compile-web" depends="package-api" description="compile webapp">
<mkdir dir="${build.dir}" />
<javac srcdir="${src.dir}/web" destdir="${build.dir}" debug="${javac.debug}" debuglevel="${javac.debuglevel}"
deprecation="${compile.deprecation}" optimize="${compile.optimize}">
<compilerarg line="${compile.arguments}" />
<classpath>
<path refid="web.compile.classpath" />
<path location="${dist.dir}/${openmrs.api.name}" />
</classpath>
</javac>
<!-- copy the extra files to the build dir in case an ant-clean was just done -->
<copy todir="${build.dir}">
<!-- vm files for the initial setup wizard -->
<fileset dir="${src.dir}/web" includes="**/*.vm"/>
</copy>
</target>
<target name="compile-web-tests" depends="compile-api-tests,compile-web" description="compile the java files in /test/api">
<mkdir dir="${build.dir}" />
<javac srcdir="${test.dir}/web" destdir="${build.dir}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" classpathref="api.test.classpath">
<compilerarg line="${compile.arguments}" />
</javac>
<!-- copy the extra files to the build dir in case an ant-clean was just done -->
<copy todir="${build.dir}">
<!-- dbunit files for db and api tests -->
<fileset dir="${test.dir}/web" includes="**/*.xml"/>
<!-- module files for module tests -->
<fileset dir="${test.dir}/web" includes="**/*.omod"/>
</copy>
</target>
<target name="deploy" depends="package-web" if="tomcat.home" description="Move war into the tomcat's webapps directory - ">
<echo message="Deploying war file to Tomcat webapps directory"/>
<copy todir="${tomcat.home}/webapps" file="${dist.dir}/${webapp.name}.war"/>
</target>
<target name="undeploy" if="tomcat.home" description="undeploy war file from servlet container's deployment dir">
<echo message="Undeploying war file from Tomcat webapps directory"/>
<delete file="${tomcat.home}/webapps/${webapp.name}.war"/>
<delete dir="${tomcat.home}/webapps/${webapp.name}"/>
</target>
<target name="deploy-web" description="Copies all jsp/css/properties files to webapps dir without restarting the war">
<!-- If you receive errors about "Failed to Copy", make sure your user has write access to ${tomcat.home}/webapps/${webapp.name} -->
<copy todir="${tomcat.home}/webapps/${webapp.name}" failonerror="false">
<fileset dir="web">
<include name="**/*.jsp"/>
<include name="**/*.tag"/>
<include name="**/*.css"/>
<include name="**/*.js"/>
<include name="**/*.withjstl"/>
<include name="**/*.tag"/>
<include name="**/messages*.properties"/>
<include name="**/*_theme*.properties"/>
<include name="**/images/**/*" />
<!-- This fileset doesn't exclude /web/test so that
developers can easily test /web/test files by running deploy-web -->
</fileset>
</copy>
</target>
<target name="package-web" depends="compile-web" description="create webapp war file">
<mkdir dir="${dist.dir}/web" />
<!-- copy the web.xml file to the dist folder (for variable replacement) -->
<copy todir="${dist.dir}/web" preservelastmodified="true" overwrite="true">
<fileset file="web/WEB-INF/web.xml" />
<filterset refid="web.xml.variables.to.replace" />
</copy>
<!-- Extract the liquibase files so they can be included in the war file -->
<unzip src="${metadata.dir}/model/liquibase-data.zip"
dest="${build.dir}/liquibase-data" />
<war destfile="${dist.dir}/${webapp.name}.war" basedir="web" excludes="**/web.xml, **/test/" webxml="${dist.dir}/web/web.xml" duplicate="add">
<classes dir="${build.dir}">
<include name="**/web/**/*.class" />
<include name="**/web/**/*.vm" /> <!-- velocity macro files for initial setup -->
<exclude name="**/test/" />
<exclude name="**/*Test*.class" /> <!-- more inclusive with trailing wildcard -->
</classes>
<classes file="${metadata.dir}/api/log4j/log4j.xml" />
<classes file="${metadata.dir}/api/log4j/velocity.properties" />
<classes dir="${build.dir}/liquibase-data">
<include name="*" /> <!-- for the initial setup files: liquibase-schema-only.xml, liquibase-core-data.xml, liquibase-demo-data.xml-->
</classes>
<classes dir="web/WEB-INF">
<include name="*_theme*.properties"/>
</classes>
<lib file="${dist.dir}/${openmrs.api.name}" />
<lib dir="${antlr.dir}" includes="*.jar" />
<!-- lib dir="${asm.dir}" includes="*.jar" /-->
<lib dir="${c3p0.dir}" includes="*.jar" />
<lib dir="${cglib.dir}" includes="*.jar" />
<lib dir="${commons-beanutils.dir}" includes="*.jar" />
<lib dir="${commons-collections.dir}" includes="*.jar" excludes="*test*.jar" />
<lib dir="${commons-fileupload.dir}" includes="*.jar" />
<lib dir="${commons-io.dir}" includes="*.jar" />
<lib dir="${commons-lang.dir}" includes="*.jar" />
<lib dir="${database.dir}" includes="*.jar" />
<lib dir="${dom4j.dir}" includes="*.jar" />
<lib dir="${dwr.dir}" includes="*.jar" />
<lib dir="${ehcache.dir}" includes="*.jar" />
<lib dir="${hl7api.dir}" includes="*.jar" />
<lib dir="${hibernate.dir}" includes="*.jar" />
<lib dir="${jfreechart.dir}" includes="*.jar" />
<lib dir="${jstl.dir}" includes="*.jar" />
<lib dir="${jta.dir}" includes="*.jar" />
<lib dir="${log4j.dir}" includes="*.jar" />
<lib dir="${slf4j.dir}" includes="*.jar" />
<lib dir="${mail.dir}" includes="*.jar" />
<lib dir="${saxon.dir}" includes="*.jar" />
<lib dir="${simple.dir}" includes="*.jar" />
<lib dir="${spring.dir}" includes="*.jar" excludes="*test*.jar"/>
<lib dir="${stax.dir}" includes="*.jar" />
<lib dir="${taglibs.dir}" includes="*.jar" />
<lib dir="${velocity.dir}" includes="*.jar" />
<lib dir="${xerces.dir}" includes="*.jar" excludes="*Samples*.jar" />
<lib dir="${xstream.dir}" includes="*.jar" />
<lib dir="${liquibase.dir}" includes="*.jar" />
<lib dir="${json.dir}" includes="*.jar" />
<lib dir="${reflectionutil.dir}" includes="*.jar" />
</war>
</target>
<target name="package-web-src" depends="compile-web" description="Create jar file containing web java src">
<mkdir dir="${build.dir}" />
<javac destdir="${build.dir}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" classpathref="web.compile.classpath">
<compilerarg line="${compile.arguments}" />
<src path="${src.dir}/web" />
<include name="**/*.java" />
</javac>
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/web-${openmrs.api.name}">
<fileset dir="${build.dir}" includes="**/web/**/*" />
<fileset dir="${basedir}/web/WEB-INF" includes="openmrs-servlet.xml" />
</jar>
</target>
<target name="dist" depends="package-web" description="create distribution war file and api jar file packages" />
<target name="install" description="Install application in Tomcat" depends="package-web">
<echo>Installing ${webapp.name} to ${tomcat.manager.url} as tomcat user named ${tomcat.username}</echo>
<deploy url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${webapp.name}" war="${dist.dir}/${webapp.name}.war" />
</target>
<target name="remove" depends="init" description="Remove application in Tomcat">
<echo>Removing ${webapp.name} from ${tomcat.manager.url} as tomcat user named ${tomcat.username}</echo>
<undeploy url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${webapp.name}" />
</target>
<target name="update" description="Update application in Tomcat">
<antcall target="remove" />
<sleep seconds="2" />
<antcall target="install" />
<exec executable="/usr/local/bin/growlnotify" os="Mac OS X" logError="true" failifexecutionfails="false">
<arg line="-m 'OpenMRS is ready' Build completed -a Eclipse" />
</exec>
<!-- on Ubuntu, requires "libnotify-bin" package -->
<exec executable="notify-send" os="Linux" logError="true" failifexecutionfails="false">
<arg line="-i ${basedir}/web/images/openmrs_logo_white.gif 'OpenMRS is ready' 'Build completed'" />
</exec>
</target>
<target name="reload" depends="package-web" description="Explode war and reload application in Tomcat">
<mkdir dir="${tomcat.home}/webapps/${webapp.name}" />
<unzip src="${dist.dir}/${webapp.name}.war" dest="${tomcat.home}/webapps/${webapp.name}" overwrite="true" />
<reload url="${tomcat.manager.url}" username="${tomcat.username}" password="${tomcat.password}" path="/${webapp.name}" />
</target>
<target name="tomcat-start" description="Start Tomcat">
<echo message="Starting Tomcat denoted by the tomcat.home property" />
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<jvmarg line='-Dcatalina.home="${tomcat.home}" -Xmx512M -Xms128M -XX:PermSize=64M -XX:MaxPermSize=128m -XX:NewSize=64m -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000'/>
</java>
</target>
<target name="tomcat-stop" description="Stop Tomcat">
<echo message="Stopping Tomcat denoted by the tomcat.home property" />
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<jvmarg line='-Dcatalina.home="${tomcat.home}"'/>
<arg line="stop"/>
</java>
</target>
<target name="tomcat-start-jrebel" description="Start Tomcat with JRebel">
<echo message="Copying ${jrebel.config} to ${tomcat.home}/webapps/${webapp.name}/WEB-INF/classes" />
<copy todir="${tomcat.home}/webapps/${webapp.name}/WEB-INF/classes" failonerror="false" overwrite="true">
<fileset file="${jrebel.config}" />
</copy>
<echo message="Starting Tomcat denoted by the tomcat.home property" />
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<jvmarg line='-Dcatalina.home="${tomcat.home}" -Xverify:none -javaagent:${jrebel.home}/jrebel.jar=org.openmrs.util.OpenmrsClassLoader,org.openmrs.module.ModuleClassLoader -Xmx512M -Xms128M -XX:PermSize=64M -XX:MaxPermSize=128m -XX:NewSize=64m -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000'/>
</java>
</target>
<target name="arden-clean-grammar">
<delete>
<fileset dir="${build.dir}/org/openmrs/arden">
<include name="**/*.class"/>
<include name="**/*.java"/>
</fileset>
<!--fileset dir="${build.dir}/api/org/openmrs/arden/parser">
<include name="**/*.class"/>
<include name="**/*.java"/>
</fileset>-->
<fileset dir="${src.dir}/api/org/openmrs/arden">
<include name="**/ArdenBase*.java"/>
<include name="**/*.txt"/>
<include name="**/*.smap"/>
<include name="**/*.class"/>
<include name="**/*.txt"/>
</fileset>
</delete>
</target>
<!--target name="arden-make-antlr" depends="arden-clean-grammar" > -->
<target name="arden-make-antlr" >
<antlr target="${src.dir}/api/org/openmrs/arden/ArdenRecognizer.g">
<classpath path="lib/antlr/antlr_2.7.6.jar" />
</antlr>
</target>
<!-- These targets are either not used or are broken and should be removed -bwolfe 20090102
<target name="arden-tests">
<java
classpath=".;build;lib/antlr/antlrdebug_1.0.0.jar;lib/antlr/antlr_2.7.6.jar"
classname="org.openmrs.arden.ArdenBaseParser">
<arg value="${src.dir}/api/org/openmrs/arden/test"/>
</java>
</target>
<target name="queryparser-clean-grammar" description="TODO: write description">
<delete>
<fileset dir="${build.dir}/org/openmrs/logic/queryparser">
<include name="**/*.class"/>
<include name="**/*.java"/>
</fileset>
<fileset dir="${src.dir}/api/org/openmrs/logic/queryparser">
<include name="**/LogicQuery*.java"/>
<include name="**/*.txt"/>
<include name="**/*.smap"/>
<include name="**/*.class"/>
<include name="**/*.txt"/>
</fileset>
</delete>
</target>
<target name="queryparser-make-antlr" description="TODO: write description">
<antlr target="${src.dir}/api/org/openmrs/logic/queryparser/LogicQueryParser.g">
<classpath path="lib/antlr/antlr_2.7.6.jar" />
</antlr>
</target>
-->
<target name="checkstyle" description="Validate code style">
<checkstyle config="${metadata.dir}/openmrs-checkstyle.xml">
<fileset dir="${src.dir}" includes="**/*.java" />
</checkstyle>
</target>
<target name="hl7-test" description="Spawns the HL7API test panel for testing HL7 messages (see http://hl7api.sourceforge.net)">
<java classname="ca.uhn.hl7v2.app.TestPanel" fork="yes" spawn="yes">
<classpath>
<fileset dir="${hl7api.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${commons-logging.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${xerces.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</java>
</target>
<target name="junit-report" depends="compile-api-tests,compile-web-tests" description="Run tests and create JUnit report (requires driver.jar property)">
<delete dir="${junit-tests.dir}" failonerror="false"/>
<mkdir dir="${junit-tests.dir}" />
<path id="junit-path">
<fileset refid="lib.files" />
<pathelement path="${build.dir}"/>
<pathelement path="${metadata.dir}/api/log4j/"/>
<pathelement path="web/WEB-INF/"/>
<pathelement location="${dist.dir}/${openmrs.api.name}"/>
</path>
<!-- fork the vm so that translation happens faster -->
<junit fork="yes" forkmode="once" clonevm="false">
<classpath refid="junit-path"/>
<formatter type="xml"/>
<!-- overwrite this system property so that there are less properties printed -->
<sysproperty key="repositoryFileInput" value="" />
<batchtest todir="${junit-tests.dir}" haltonfailure="no">
<fileset dir="${build.dir}">
<include name="org/openmrs/**/*Test.class" />
<exclude name="**/test/*" /> <!-- util classes used by junit -->
<exclude name="org/openmrs/web/**/*" /> <!-- util classes used by junit -->
</fileset>
</batchtest>
</junit>
<!-- run the web tests separately to reduce memory errors -->
<junit fork="yes" forkmode="once" clonevm="false">
<classpath refid="junit-path"/>
<formatter type="xml"/>
<!-- overwrite this system property so that there are less properties printed -->
<sysproperty key="repositoryFileInput" value="" />
<batchtest todir="${junit-tests.dir}" haltonfailure="no">
<fileset dir="${build.dir}">
<include name="org/openmrs/web/**/*Test.class" />
<exclude name="**/SummaryTest.class" />
<exclude name="**/test/*" /> <!-- util classes used by junit -->
</fileset>
</batchtest>
</junit>
<delete dir="${junit-reports.dir}" failonerror="false" />
<mkdir dir="${junit-reports.dir}" />
<junitreport todir="${junit-reports.dir}">
<fileset dir="${junit-tests.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit-reports.dir}"/>
</junitreport>
<!-- TODO add other execs for different OS's. Switch to osfamily with Ant 1.7 -->
<exec os="Windows XP" executable="C:/Program Files/Mozilla Firefox/firefox.exe" failifexecutionfails="false">
<arg value="file:///${junit-reports.dir}/index.html"/>
</exec>
<exec os="Linux" executable="firefox" failifexecutionfails="false">
<arg value="file:///${junit-reports.dir}/index.html"/>
</exec>
<exec os="Mac OS X" executable="open" failifexecutionfails="false">
<arg line="-a Firefox"/>
<arg value="file:///${junit-reports.dir}/index.html"/>
</exec>
</target>
</project>