-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.old.xml
789 lines (683 loc) · 34.2 KB
/
build.old.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
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
<!--
NOTE: FOR HISTORICAL REFERENCE ONLY
This build script does not work with the new structure of the
sourcebase. The project is currently built using buildr using
the script "buildfile".
-->
<project name="caBIG Study Calendar" default="reference-only">
<target name="reference-only">
<echo>
NOTE: build.old.xml IS FOR HISTORICAL REFERENCE ONLY
The ant script does not work with the new structure of the
sourcebase. The project is currently built using buildr using
the script "buildfile".
</echo>
</target>
<!-- PROPERTIES AND PATHS -->
<property name="application-short-name" value="psc"/>
<property name="version" value="2.5-SNAPSHOT"/>
<property name="svn-executable" value="svn"/>
<property name="src-dir.main" value="src/main/java"/>
<property name="src-dir.bering" value="src/main/db/migrate"/>
<property name="src-dir.unit-test" value="src/test/java"/>
<property name="src-dir.web" value="src/main/webapp"/>
<property name="src-dir.test-infrastructure" value="test/infrastructure/src/main/java"/>
<property name="src-dir.test-infrastructure-test" value="test/infrastructure/src/test/java"/>
<property name="build-dir.main" value="${src-dir.web}/WEB-INF/classes"/>
<property name="build-dir.test" value="target/test-classes"/>
<property name="build-dir.webapp" value="${src-dir.web}"/>
<property name="build-dir.csm" value="${basedir}/${build-dir.test}"/>
<property name="dist.war-name" value="${application-short-name}.war"/>
<property name="api-dir" value="target/psc-api-${version}"/>
<property name="metrics-dir" value="target/metrics"/>
<property name="coverage-dir" value="${metrics-dir}/coverage"/>
<property name="dbunit-dtd-filename" value="target/dbunit-sc.dtd"/>
<property name="create-hsqldb.dbname" value="hsqldb-psc"/>
<property name="csm-security-policy" value="CSM_policy.xml"/>
<!-- emma needs this -->
<path id="cp.compiled-source">
<pathelement location="${build-dir.main}"/>
</path>
<path id="cp.jdbc">
<fileset dir="db/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="cp.tomcat.common">
<fileset dir="tools/tomcat/lib/common">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="cp.tomcat.server">
<fileset dir="tools/tomcat/lib/server">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="cp.main">
<path refid="cp.compiled-source"/>
<path refid="cp.tomcat.common"/>
<fileset dir="${src-dir.web}/WEB-INF/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="cp.test">
<path refid="cp.main"/>
<path refid="cp.jdbc"/>
<path refid="cp.tomcat.common"/>
<pathelement location="${build-dir.test}"/>
<fileset dir="test/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- TASK LIBRARIES -->
<path id="cp.emma">
<pathelement location="test/lib/emma.jar"/>
<pathelement location="test/lib/emma_ant.jar"/>
</path>
<taskdef resource="emma_ant.properties" classpathref="cp.emma"/>
<path id="cp.bering">
<path refid="cp.jdbc"/>
<path refid="cp.main"/>
</path>
<target name="taskdefs">
<taskdef resource="edu/northwestern/bioinformatics/bering/antlib.xml" classpathref="cp.bering"/>
<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="cp.test"/>
<taskdef name="datasource-properties"
classname="gov.nih.nci.cabig.ctms.tools.ant.DataSourcePropertiesTask" classpathref="cp.main"/>
</target>
<!-- TARGETS -->
<target name="init" depends="taskdefs, default-properties">
<mkdir dir="${build-dir.main}"/>
<mkdir dir="${build-dir.test}"/>
<mkdir dir="${metrics-dir}"/>
<datasource-properties applicationDirectoryName="${application-short-name}"
databaseConfigurationName="${config.database}"/>
<echo>All database ops for this build will use ${datasource.url}</echo>
</target>
<target name="default-properties">
<property environment="env"/>
<property name="test.failfast" value="false"/>
<property name="config.database" value="datasource"/>
<!-- Note that this will only work on unixish systems -->
<exec executable="hostname" outputproperty="hostname" failifexecutionfails="false">
<arg value="-s"/>
</exec>
<!-- This is apparently the thing to do for windows. Untested. -->
<property name="hostname" value="${env.COMPUTERNAME}"/>
</target>
<target name="clean">
<delete dir="target"/>
<delete dir="${build-dir.main}"/>
<delete dir="dist"/>
</target>
<target name="resources" description="Copy resources into classpath" depends="init">
<tstamp>
<format property="buildtime" pattern="yyyy-MM-dd HH:mm:ss.S" />
</tstamp>
<copy todir="${build-dir.main}" filtering="true" overwrite="true">
<fileset dir="${src-dir.main}">
<include name="applicationContext-spring.xml"/>
<include name="applicationContext-setup.xml"/>
</fileset>
<filterset>
<filter token="config.database" value="${config.database}"/>
<filter token="application-short-name" value="${application-short-name}"/>
<filter token="buildInfo.versionNumber" value="${version}"/>
<filter token="buildInfo.username" value="${user.name}"/>
<filter token="buildInfo.hostname" value="${hostname}"/>
<filter token="buildInfo.timestamp" value="${buildtime}"/>
</filterset>
</copy>
<copy todir="${build-dir.main}">
<fileset dir="${src-dir.main}">
<include name="**/*.xml"/>
<include name="**/*.xsd"/>
<include name="**/*.xsl"/>
<include name="**/*.wadl"/>
<include name="**/*.properties"/>
<include name="**/*.ftl"/>
</fileset>
</copy>
<mkdir dir="${build-dir.main}/db/migrate"/>
<copy todir="${build-dir.main}/db/migrate">
<fileset dir="${src-dir.bering}">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${build-dir.test}">
<fileset dir="${src-dir.unit-test}">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</fileset>
</copy>
<!-- Create valid CSM configuration for testing -->
<copy todir="${build-dir.csm}" filtering="true" overwrite="true">
<fileset dir="${basedir}/csm/upt">
<include name="*.xml"/>
</fileset>
<filterset>
<filter token="tomcat.security.dir" value="${build-dir.csm}"/>
<filter token="datasource.dialect.upt" value=""/>
<filter token="datasource.driver" value="${datasource.driver}"/>
<filter token="datasource.url" value="${datasource.url}"/>
<filter token="datasource.username" value="${datasource.username}"/>
<filter token="datasource.password" value="${datasource.password}"/>
</filterset>
</copy>
</target>
<target name="compile" description="Compile all java source" depends="resources">
<javac destdir="${build-dir.main}" classpathref="cp.main"
debug="true" source="1.5" encoding="UTF-8">
<src path="${src-dir.main}"/>
</javac>
<javac destdir="${build-dir.test}" classpathref="cp.test"
debug="true" source="1.5" encoding="UTF-8">
<src path="${src-dir.unit-test}"/>
<!-- TODO: when we switch to buildr, test-infrastructure should be a separate module -->
<src path="${src-dir.test-infrastructure}"/>
<src path="${src-dir.test-infrastructure-test}"/>
</javac>
</target>
<target name="webapp" description="Merge created application into deployment directory" depends="compile, webapp.main"/>
<target name="webapp.main" description="Copy externals into webapp">
<!-- copy in the Oracle driver if it's present -->
<copy todir="${build-dir.webapp}/WEB-INF/lib">
<fileset dir="db/lib">
<include name="ojdbc14.jar"/>
</fileset>
</copy>
</target>
<target name="webapp.create-context">
<property name="webapp.context.docBase" value="${basedir}/${build-dir.webapp}"/>
<echo file="${webapp.context-file}"><![CDATA[
<Context path="${webapp.deploy-path}" docBase="${webapp.context.docBase}" debug="9">
<Realm className="org.apache.catalina.realm.JAASRealm" appName="study_calendar"
userClassNames="gov.nih.nci.security.authorization.domainobjects.User"
roleClassNames="gov.nih.nci.security.authorization.domainobjects.Role"/>
</Context>
]]></echo>
</target>
<target name="api" description="Create javadoc for application code API (i.e. domain objects)" depends="init">
<mkdir dir="${api-dir}"/>
<javadoc destdir="${api-dir}" classpathref="cp.main" source="1.5" use="true">
<fileset dir="${src-dir.main}">
<include name="**/api/*.java"/>
<include name="**/domain/*.java"/>
<include name="**/domain/delta/*.java"/>
<include name="**/domain/scheduledactivitystate/*.java"/>
<include name="**/utils/*DayRange.java"/>
<include name="**/utils/FormatTools.java"/>
<include name="**/studycalendar/*Error.java"/>
<include name="**/studycalendar/*Exception.java"/>
<exclude name="**/xml/domain/*"/>
</fileset>
<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
</javadoc>
<zip destfile="target/psc-api-${version}.zip" basedir="${api-dir}/..">
<include name="**/*"/>
</zip>
</target>
<!-- DATABASE SETUP -->
<target name="migrate" description="migrate database schema" depends="init">
<property name="migrate.version" value=""/>
<property name="bering.dialect" value=""/>
<migrate classpathRef="cp.bering"
driver="${datasource.driver}"
dialect="${bering.dialect}"
url="${datasource.url}"
userid="${datasource.username}"
password="${datasource.password}"
targetVersion="${migrate.version}"
migrationsDir="${basedir}/src/main/db/migrate"
/>
</target>
<target name="dbunit-dtd" description="Create DTD for dbunit" depends="init">
<dbunit
driver="${datasource.driver}"
url="${datasource.url}"
userid="${datasource.username}"
password="${datasource.password}"
>
<classpath refid="cp.test"/>
<export
dest="${dbunit-dtd-filename}"
format="dtd"/>
</dbunit>
</target>
<!-- TEST SETUP & EXECUTION -->
<target name="test.unit" description="Run unit tests. Use -Dpattern= to select a subset.">
<property name="pattern" value="**/*Test.java"/>
<echo>Running tests matching pattern=${pattern}</echo>
<antcall target="test.unit.exec"/>
</target>
<target name="api-report" description="Generate reports for our silver-level review.
These reports show the inputs and outputs of PlannedCalendarService and ScheduledCalendarService APIs. ">
<property name="pattern" value="**/*CalendarServiceIntegrationTest.java"/>
<echo>Running tests matching pattern=${pattern}</echo>
<antcall target="test.unit.exec"/>
</target>
<target name="test.unit.database-only">
<property name="test.unit.database-only" value="indeed"/>
<echo>Running database-sensitive tests</echo>
<antcall target="test.unit.exec"/>
</target>
<target name="test.unit.exec" depends="compile">
<emma enabled="${emma.enabled}">
<!-- Hibernate (I think because of a Spring classloader issue (TODO: we should check that this is still true))
can't find hbm files from another part of the classpath, so we must use fullcopy to the instrumentation dir -->
<instr instrpathref="cp.compiled-source" destdir="${out.instrumented.dir}"
metadatafile="${coverage-dir}/metadata.emma" merge="true" mode="fullcopy"/>
</emma>
<mkdir dir="${build-dir.test}/junit"/>
<junit printsummary="yes" haltonfailure="${test.failfast}" failureproperty="test.unit.failed" fork="true" forkmode="once" dir="${basedir}">
<classpath>
<!-- the pathelement only included on classpath if out.instrumented.dir defined, i.e. if EMMA is enabled -->
<pathelement location="${out.instrumented.dir}/classes"/>
<path refid="cp.test"/>
<path refid="cp.emma"/>
</classpath>
<jvmarg value="-XX:MaxPermSize=256m"/>
<jvmarg value="-Demma.coverage.out.file=${coverage-dir}/coverage.emma"/>
<jvmarg value="-Demma.coverage.out.merge=false"/>
<jvmarg value="-Dgov.nih.nci.security.configFile=${build-dir.csm}/ApplicationSecurityConfig.xml"/>
<jvmarg value="-Djava.awt.headless=true"/>
<formatter type="plain" usefile="false"/>
<formatter type="xml" usefile="true"/>
<batchtest todir="${build-dir.test}/junit">
<fileset dir="${src-dir.unit-test}">
<patternset>
<include name="${pattern}"/>
</patternset>
</fileset>
<fileset dir="${src-dir.test-infrastructure-test}">
<patternset>
<include name="${pattern}"/>
</patternset>
</fileset>
</batchtest>
</junit>
<emma enabled="${emma.enabled}">
<merge outfile="${coverage-dir}/session.emma">
<fileset dir="${coverage-dir}" includes="*.emma"/>
</merge>
<report sourcepath="${src-dir.main}">
<fileset dir="${coverage-dir}">
<include name="session.emma"/>
</fileset>
<txt outfile="${coverage-dir}/coverage.txt"/>
<html outfile="${coverage-dir}/coverage.html"/>
<xml outfile="${coverage-dir}/coverage.xml"/>
</report>
</emma>
<fail if="test.unit.failed">One or more unit tests failed. See above or set test.failfast=true.</fail>
</target>
<!-- Work in progress -->
<target name="test.restful-api.properties">
<!-- defaults for test.restful-api invocations -->
<property name="config.database" value="rest-test"/>
</target>
<target name="test.restful-api.resources">
<copy file="test/restful-api/logback-test.xml" todir="${build-dir.test}" overwrite="true"/>
</target>
<target name="test.restful-api.redeploy" depends="test.restful-api.properties, tomcat.redeploy"/>
<target name="test.restful-api" depends="test.restful-api.properties, compile, test.restful-api.resources">
<taskdef name="jtestr" classname="org.jtestr.ant.JtestRAntRunner" classpath="test/lib/jtestr-0.3.1.jar"/>
<jtestr tests="test/restful-api"/>
</target>
<target name="test.restful-api.setup" depends="test.restful-api.properties, migrate, compile">
<java fork="true" failonerror="true"
classname="edu.northwestern.bioinformatics.studycalendar.test.restfulapi.OneTimeSetup">
<classpath refid="cp.test"/>
<arg value="${basedir}"/>
</java>
</target>
<!-- N.b.: this task must not depend on init (directly or otherwise) or the automated build will break. -->
<target name="create-hsqldb" description="Creates the read-only HSQLDB instance for testing">
<property name="config.database" value="${create-hsqldb.dbname}"/>
<property name="hsqldb-dir" value="db/hsqldb"/>
<property name="create-hsqldb.url" value="jdbc:hsqldb:file:${basedir}/${hsqldb-dir}/${create-hsqldb.dbname}"/>
<delete dir="${hsqldb-dir}"/>
<propertyfile file="${user.home}/.psc/${config.database}.properties" comment="Generated by PSC's create-hsqldb task">
<entry key="datasource.url" value="${create-hsqldb.url}"/>
<entry key="datasource.username" value="sa"/>
<entry key="datasource.password" value=""/>
<entry key="datasource.driver" value="org.hsqldb.jdbcDriver"/>
</propertyfile>
<echo>${create-hsqldb.url}</echo>
<mkdir dir="${hsqldb-dir}"/>
<ant antfile="">
<property name="datasource.url" value="${create-hsqldb.url}"/>
<target name="hsqldb"/>
<target name="migrate"/>
</ant>
<sql driver="org.hsqldb.jdbcDriver" url="${create-hsqldb.url}"
userid="sa" password="" classpathref="cp.test" autocommit="true">
<!-- database must be explicitly shutdown in HSQLDB >=1.7.2, so that the lock is
released and the tests can reopen it -->
SHUTDOWN SCRIPT;
</sql>
<echo>Marking ${create-hsqldb.url} read-only</echo>
<echo append="true" file="${hsqldb-dir}/${create-hsqldb.dbname}.properties">hsqldb.files_readonly=true${line.separator}</echo>
</target>
<!-- CODE METRICS TARGETS -->
<target name="emma" depends="init" description="enables EMMA code coverage recording during the build (i.e. during tests)">
<property name="emma.enabled" value="true"/>
<!-- EMMA instrumented classes output directory; must only exist if EMMA is enabled -->
<property name="out.instrumented.dir" value="${coverage-dir}/instrumented-classes"/>
<mkdir dir="${out.instrumented.dir}"/>
</target>
<!-- ARTIFACT CREATION -->
<target name="jar.security-plugin-api" depends="webapp">
<mkdir dir="dist"/>
<property name="security-plugin-api-jarname" value="${application-short-name}-security-plugin-api.jar"/>
<jar destfile="dist/${security-plugin-api-jarname}" basedir="${build-dir.webapp}/WEB-INF/classes">
<include name="edu/northwestern/bioinformatics/studycalendar/security/plugin/**/*"/>
<include name="edu/northwestern/bioinformatics/studycalendar/tools/spring/**/*"/>
<include name="**/*Exception.class"/>
<include name="**/*Failure.class"/>
</jar>
</target>
<target name="war" description="creates a deployable WAR file. Please use war-ccts if you are deploying PSC in CCTS." >
<mkdir dir="dist"/>
<property name="webapp.deploy-path" value="/${application-short-name}"/>
<property name="webapp.context-file" value="dist/context.xml"/>
<property name="webapp.context.docBase" value="${dist.war-name}"/>
<antcall target="webapp.create-context"/>
<antcall target="webapp"/>
<war basedir="${build-dir.webapp}" destfile="dist/${dist.war-name}" webxml="${build-dir.webapp}/WEB-INF/web.xml">
<exclude name="WEB-INF/web.xml"/>
<metainf dir="dist">
<include name="context.xml"/>
</metainf>
</war>
</target>
<target name="war-ccts" description="creates a deployable WAR file for CCTS ." >
<mkdir dir="dist"/>
<property name="webapp.deploy-path" value="/${application-short-name}"/>
<property name="webapp.context-file" value="dist/context.xml"/>
<property name="webapp.context.docBase" value="${dist.war-name}"/>
<antcall target="webapp.create-context"/>
<antcall target="webapp"/>
<war basedir="${build-dir.webapp}" destfile="dist/${dist.war-name}" webxml="${build-dir.webapp}/WEB-INF/web.xml">
<exclude name="WEB-INF/web.xml"/>
<metainf dir="dist">
<include name="context.xml"/>
</metainf>
<lib dir="grid/lib" includes="*.jar" excludes="cog-jglobus.jar"/>
</war>
</target>
<target name="dist" description="creates the distribution package" depends="jar.security-plugin-api">
<property name="dist.war.target" value="war"/>
<antcall target="${dist.war.target}"/>
<property name="install.name" value="psc-${version}"/>
<property name="install.dir" value="dist/${install.name}"/>
<property name="install-samples.dir" value="${install.dir}/conf-samples"/>
<mkdir dir="${install-samples.dir}"/>
<copy file="dist/${dist.war-name}" tofile="${install.dir}/psc.war" failonerror="true"/>
<copy file="db/datasource.properties.example" tofile="${install-samples.dir}/datasource.properties"/>
<copy file="csm/csm_jaas.config" tofile="${install-samples.dir}/csm_jaas.config" filtering="true">
<filterset>
<filter token="datasource.driver" value="REPLACE with your database driver classname (e.g., org.postgresql.Driver)"/>
<filter token="datasource.url" value="REPLACE with your database URL (e.g., jdbc:postgresql:psc)"/>
<filter token="datasource.username" value="REPLACE with your database username"/>
<filter token="datasource.password" value="REPLACE with your database password"/>
</filterset>
</copy>
<exec executable="${svn-executable}" taskname="svn">
<arg value="export"/>
<arg value="https://ncisvn.nci.nih.gov/svn/psc/documents/PSC_Install_Guide.doc"/>
<arg value="${install.dir}/psc_install.doc"/>
</exec>
<property name="install.zip" value="${install.name}-bin.zip"/>
<zip destfile="dist/${install.zip}" basedir="dist">
<include name="${install.name}/**/*"/>
</zip>
<delete dir="${install.dir}"/>
</target>
<target name="dist-ccts" description="creates the distribution package for CCTS">
<property name="install.variant" value="ccts"/>
<property name="install.name" value="psc-${version}-ccts"/>
<property name="dist.war.target" value="war-ccts"/>
<antcall target="dist"/>
</target>
<target name="dist.xsd" description="uploads the XSD to bioinformatics.northwestern.edu">
<exec executable="scp">
<arg value="${basedir}/src/main/java/psc.xsd"/>
<arg value="ligand:/usr/local/share/www/www_bioinformatics_northwestern_edu/ns/psc"/>
</exec>
</target>
<!-- AUTOMATED BUILDS -->
<target name="oracle">
<property name="config.database" value="oracle"/>
</target>
<target name="postgresql">
<property name="config.database" value="postgresql"/>
</target>
<target name="hsqldb">
<property name="config.database" value="${create-hsqldb.dbname}"/>
</target>
<target name="autobuild.properties">
<!-- overrides properties set in default-properties -->
<property name="test.failfast" value="false"/>
</target>
<target name="autobuild.exec" depends="clean, test.unit"/>
<target name="autobuild.exec.db" depends="migrate, clean, test.unit.database-only"/>
<target name="autobuild.artifacts">
<property name="autobuild.artifacts-dir" value="target/artifacts"/>
<mkdir dir="${autobuild.artifacts-dir}/emma"/>
<copy todir="${autobuild.artifacts-dir}/emma">
<fileset dir="${coverage-dir}">
<exclude name="instrumented-classes/**/*"/>
<exclude name="instrumented-classes"/>
<exclude name="*.emma"/>
</fileset>
</copy>
<symlink link="${autobuild.artifacts-dir}/emma/index.html" resource="coverage.html" failonerror="false"/>
</target>
<target name="autobuild-full" description="Automated build for all unit tests against HSQLDB"
depends="autobuild.properties, create-hsqldb, hsqldb, emma, autobuild.exec, autobuild.artifacts"/>
<target name="autobuild-oracle" description="Automated build for all unit tests against Oracle"
depends="autobuild.properties, oracle, migrate, autobuild.exec"/>
<target name="autobuild-postgresql" description="Automated build for all unit tests against PostgreSQL"
depends="autobuild.properties, postgresql, migrate, autobuild.exec"/>
<target name="autobuild-matrix.properties" depends="autobuild.properties">
<echo>Determining matrix build to run based on '${config.database}'</echo>
<condition property="autobuild-matrix.db.hsqldb">
<contains string="${config.database}" substring="hsqldb"/>
</condition>
<condition property="autobuild-matrix.db.postgresql">
<contains string="${config.database}" substring="postgresql"/>
</condition>
<condition property="autobuild-matrix.db.oracle">
<contains string="${config.database}" substring="oracle"/>
</condition>
<echo> hsqldb? ${autobuild-matrix.db.hsqldb}</echo>
<echo>postgresql? ${autobuild-matrix.db.postgresql}</echo>
<echo> oracle? ${autobuild-matrix.db.oracle}</echo>
</target>
<target name="autobuild-matrix.database-hsqldb" if="autobuild-matrix.db.hsqldb">
<property name="create-hsqldb.dbname" value="${config.database}"/>
<antcall target="create-hsqldb"/>
</target>
<target name="autobuild-matrix.database-other" depends="migrate" unless="autobuild-matrix.db.hsqldb"/>
<target name="autobuild-matrix.database-setup" depends="autobuild-matrix.database-hsqldb, autobuild-matrix.database-other"/>
<target name="autobuild-matrix" description="Automated build for all unit tests, using Hudson's matrix builder to select the database"
depends="autobuild-matrix.properties, autobuild-matrix.database-setup, emma, autobuild.exec, autobuild.artifacts"/>
<target name="autobuild.dist" depends="dist">
<property name="autobuild.artifacts-dir" value="target/artifacts"/>
<tstamp>
<format property="today" pattern="yyyyMMdd-HHmmss" />
</tstamp>
<copy file="dist/${install.zip}"
tofile="${autobuild.artifacts-dir}/${install.name}-${today}-bin.zip"
verbose="true"/>
</target>
<target name="autobuild-nightly" description="Automated nightly build for distribution"
depends="autobuild.properties, migrate, autobuild.exec, autobuild.dist"/>
<!-- TOMCAT DEPLOYMENT -->
<target name="tomcat.init" depends="webapp">
<property name="tomcat.config-file" value="tools/tomcat/tomcat.properties"/>
<fail message="Tomcat manager not configured (could not read ${tomcat.config-file}).">
<condition>
<not><available file="${tomcat.config-file}"/></not>
</condition>
</fail>
<property file="${tomcat.config-file}"/>
<property name="webapp.context-file" value="${basedir}/tools/tomcat/context.xml"/>
<property name="webapp.deploy-path" value="${tomcat.deploy-path}"/> <!-- backwards compatibility -->
<taskdef file="tools/tomcat/tomcatTasks.properties">
<classpath>
<path refid="cp.tomcat.common"/>
<path refid="cp.tomcat.server"/>
</classpath>
</taskdef>
</target>
<target name="tomcat.deploy" depends="tomcat.init, webapp.create-context"
description="Deploy to local Tomcat install for development">
<deploy url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
config="${webapp.context-file}"
path="${webapp.deploy-path}"
/>
</target>
<target name="tomcat.undeploy" depends="tomcat.init" description="Remove from local Tomcat install">
<undeploy url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
path="${webapp.deploy-path}"
failonerror="false"
/>
</target>
<target name="tomcat.redeploy" depends="tomcat.undeploy, tomcat.deploy"
description="Replace application in local Tomcat install (required for some configuration changes)"/>
<target name="tomcat.reload" depends="tomcat.init" description="Reload running application instance">
<reload url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
path="${webapp.deploy-path}"
/>
</target>
<target name="tomcat.start" depends="tomcat.init" description="Start previously deployed instance">
<start url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
path="${webapp.deploy-path}"
/>
</target>
<target name="tomcat.stop" depends="tomcat.init" description="Stop running instance">
<stop url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
path="${webapp.deploy-path}"
/>
</target>
<target name="tomcat.list" depends="tomcat.init">
<list url="${tomcat.manager.url}"
username="${tomcat.username}"
password="${tomcat.password}"
/>
</target>
<target name="tomcat.security" depends="tomcat.init" description="Automatically copies global (CSM) configuration files to Tomcat.">
<fail message="Could not locate Tomcat. Please set the catalina.base property (tools/tomcat/tomcat.properties is a good place to do this).">
<condition>
<not><isset property="catalina.base"/></not>
</condition>
</fail>
<property name="catalina.base" value="PLEASE SET catalina.base EXTERNALLY"/>
<echo>Configuring CSM and UPT for the Tomcat instance in ${catalina.base}</echo>
<property name="tomcat.security.dir" value="${catalina.base}/conf/cabig"/>
<mkdir dir="${tomcat.security.dir}"/>
<copy todir="${tomcat.security.dir}" overwrite="true">
<filterset>
<filter token="datasource.driver" value="${datasource.driver}"/>
<filter token="datasource.url" value="${datasource.url}"/>
<filter token="datasource.username" value="${datasource.username}"/>
<filter token="datasource.password" value="${datasource.password}"/>
<filter token="tomcat.security.dir" value="${tomcat.security.dir}"/>
</filterset>
<fileset dir="conf/upt">
<include name="csm_jaas.config"/>
</fileset>
</copy>
<echo taskname="todo">
===== MANUAL STEPS =====
========================
The automatic portion of the security setup is complete. If you have not
done so already, please perform the following manual actions.
* In ${catalina.base}/conf/catalina.properties, add two lines:
gov.nih.nci.security.configFile=${tomcat.security.dir}/ApplicationSecurityConfig.xml
java.security.auth.login.config=${tomcat.security.dir}/csm_jaas.config
========= END ==========
===== MANUAL STEPS =====</echo>
</target>
<target name="test.unit.report">
<!-- junitreport -->
<junitreport todir="${build-dir.test}/junit">
<fileset dir="${build-dir.test}/junit">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${build-dir.test}/junit/summary"/>
<report format="noframes" todir="${build-dir.test}/junit/summary"/>
</junitreport>
<!-- junitdocreport -->
<taskdef name="junitDocReport" classname="edu.duke.cabig.catrip.test.report.ant.JUnitDocReport">
<classpath>
<!-- the pathelement only included on classpath if out.instrumented.dir defined, i.e. if EMMA is enabled -->
<pathelement location="${out.instrumented.dir}/classes"/>
<path refid="cp.test"/>
<path refid="cp.emma"/>
</classpath>
</taskdef>
<echo>Load junit results from ${build-dir.unit-test}/junit</echo>
<echo>Load junit tests from ${src-dir.unit-test}</echo>
<junitDocReport format="html" useTestType="true" destfile="${build-dir.test}/junit/summary/junitDocReport.html">
<junitResults>
<fileset dir="${build-dir.test}/junit">
<include name="*.xml"/>
</fileset>
</junitResults>
<junitDocs>
<fileset dir="${src-dir.unit-test}">
<include name="**/*Test.java"/>
</fileset>
</junitDocs>
</junitDocReport>
</target>
<!--
Current version of spring-beandoc (0.8.1) chokes on <tx:annotation-driven/>,
so it is not capable of reading much of the application context.
This target generates graphs for the security contexts only.
RMS20080204
-->
<target name="beandoc">
<property name="build-dir.beandoc" value="target/beandoc"/>
<path id="cp.beandoc">
<!--<path refid="cp.main"/>-->
<fileset dir="tools/spring-beandoc/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef
name="beandoc"
classname="org.springframework.beandoc.client.AntTask"
classpathref="cp.beandoc"/>
<beandoc outputDir="${build-dir.beandoc}"
beandocProps="${basedir}/tools/spring-beandoc/beandoc.properties">
<fileset dir="${basedir}/src/main">
<include name="java/**/applicationContext*security.xml"/>
<!--
<include name="java/**/applicationContext*.xml"/>
<include name="webapp/**/*-servlet.xml"/>
-->
</fileset>
</beandoc>
</target>
<target name="reports" depends="test.unit.report"/>
<target name="deploy-xml-schema">
<exec executable="scp">
<arg file="${src-dir.main}/psc.xsd"/>
<arg value="ligand:/usr/local/share/www/www_bioinformatics_northwestern_edu/ns/psc"/>
</exec>
</target>
</project>