(no commit message)
[utils] / build / header.xml
1 <!-- PROPERTIES -->
2
3 <target name="echoUserPropertiesFileFound" if="user.properties.found">
4   <echo>Using properties file ${user.property.file}</echo>
5 </target>
6     
7 <target name="echoUserPropertiesFileNotFound" unless="user.properties.found">
8   <echo>Properties file ${user.property.file} not found, reverting to defaults</echo>
9 </target>
10
11
12 <property name="project.home" value=".."/>
13 <property name="build.dir" value="${project.home}/build"/>
14 <property name="lib.dir" value="${project.home}/lib"/>
15 <property environment="env"/>
16
17 <target name="download.dep">
18   <if>
19     <isset property="proxyhost"/>
20     <then>
21       <setproxy proxyhost="${proxyhost}" proxyport="${proxyport}"/>
22     </then>
23   </if>
24   <if>
25     <isset property="artifact"/>
26     <then>
27       <echo>Getting dependence ${group}/${artifact}/${version}</echo>
28       <dependencies verbose="true" fileSetId="my.deps"> 
29         <dependency group="${group}" artifact="${artifact}" version="${version}"/>
30       </dependencies> 
31       <copy todir="${download.dir}" flatten="yes">
32         <fileset refid="my.deps"/>
33       </copy>
34     </then>
35     <else>
36       <echo>Getting dependence ${group}/${version}</echo>
37       <dependencies verbose="true" fileSetId="my.deps"> 
38         <dependency group="${group}" version="${version}"/>
39       </dependencies> 
40       <copy todir="${download.dir}" flatten="yes">
41         <fileset refid="my.deps"/>
42       </copy>
43     </else>
44   </if>
45 </target>
46
47 <!-- LOG4j -->    
48 <target name="log4j.d">
49   <antcall target="download.dep">
50     <param name="group" value="log4j"/>
51     <param name="version" value="1.2.9"/>
52   </antcall>
53 </target>
54
55 <target name="commons-beanutils.d">
56   <antcall target="download.dep">
57     <param name="group" value="commons-beanutils"/>
58     <param name="version" value="1.7.0"/>
59   </antcall>
60 </target>
61
62 <target name="commons-collections.d">
63   <antcall target="download.dep">
64     <param name="group" value="commons-collections"/>
65     <param name="version" value="3.1"/>
66   </antcall>
67 </target>
68
69
70 <target name="commons-logging.d">
71   <antcall target="download.dep">
72     <param name="group" value="commons-logging"/>
73     <param name="artifact" value="commons-logging"/>
74     <param name="version" value="1.0.2"/>
75   </antcall>
76 </target>
77
78 <target name="commons-codec.d">
79   <antcall target="download.dep">
80     <param name="group" value="commons-codec"/>
81     <param name="version" value="1.3"/>
82   </antcall>
83 </target>
84
85 <target name="commons-email.d">
86   <antcall target="download.dep">
87     <param name="group" value="commons-email"/>
88     <param name="version" value="1.0"/>
89   </antcall>
90 </target>
91
92 <target name="servletapi.d">
93   <antcall target="download.dep">
94     <param name="group" value="servletapi"/>
95     <param name="version" value="2.4"/>
96   </antcall>
97 </target>
98
99 <target name="jstl.d">
100   <antcall target="download.dep">
101     <param name="group" value="jstl"/>
102     <param name="version" value="1.1.2"/>
103   </antcall>
104   <antcall target="download.dep">
105     <param name="group" value="taglibs"/>
106         <param name="artifact" value="standard"/>
107     <param name="version" value="1.1.2"/>
108   </antcall>
109 </target>
110
111
112
113 <target name="quartz.d">
114   <antcall target="download.dep">
115     <param name="group" value="quartz"/>
116     <param name="version" value="1.5.1"/>
117   </antcall>
118 </target>
119
120
121
122 <target name="logging.d" depends="log4j.d,commons-logging.d">
123 </target>
124
125 <target name="dom4j.d">
126   <antcall target="download.dep">
127     <param name="group" value="dom4j"/>
128     <param name="version" value="1.6"/>
129   </antcall>
130   <antcall target="download.dep">
131     <param name="group" value="jaxen"/>
132     <param name="version" value="1.1-beta-4"/>
133   </antcall>
134 </target>
135
136 <target name="ehcache.d">
137   <antcall target="download.dep">
138     <param name="group" value="ehcache"/>
139     <param name="version" value="1.1"/>
140   </antcall>
141 </target>
142
143 <target name="xerces.d">
144   <antcall target="download.dep">
145     <param name="group" value="xerces"/>
146     <param name="version" value="2.4.0"/>
147   </antcall>
148 </target>
149
150 <target name="oro.d">
151   <antcall target="download.dep">
152     <param name="group" value="oro"/>
153     <param name="version" value="2.0.6"/>
154   </antcall>
155 </target>
156
157 <target name="cglib.d">
158   <antcall target="download.dep">
159     <param name="group" value="cglib"/>
160     <param name="version" value="2.1"/>
161   </antcall>
162 </target>
163
164 <target name="hibernate.d" depends="cglib.d,oro.d">
165   <antcall target="download.dep">
166     <param name="group" value="hibernate"/>
167     <param name="version" value="3.0.5"/>
168   </antcall>
169 </target>
170
171 <target name="hibernate.standalone.d" depends="hibernate.d">
172   <copy todir="${download.dir}">
173     <fileset dir="${special.lib.dir}/hibernate">
174        <include name="*.jar"/>
175     </fileset>
176   </copy>
177 </target>
178
179 <target name="spring.d">
180   <antcall target="download.dep">
181     <param name="group" value="springframework"/>
182     <param name="artifact" value="spring"/>
183     <param name="version" value="1.2.5"/>
184   </antcall>
185 </target>
186
187 <target name="activation.d">
188   <copy todir="${download.dir}">
189     <fileset dir="${special.lib.dir}/jaf-1.0.2">
190        <include name="*.jar"/>
191     </fileset>
192   </copy>
193 </target>
194
195 <target name="mail.d" depends="activation.d">
196   <copy todir="${download.dir}">
197     <fileset dir="${special.lib.dir}/javamail-1.3.3_01">
198        <include name="*.jar"/>
199     </fileset>
200   </copy>
201 </target>
202
203
204
205 <target name="httpclient.d">
206   <antcall target="download.dep">
207     <param name="group" value="commons-httpclient"/>
208     <param name="version" value="3.0"/>
209   </antcall>
210 </target>
211
212 <target name="jtidy.d">
213   <antcall target="download.dep">
214     <param name="group" value="jtidy"/>
215     <param name="version" value="4aug2000r7-dev"/>
216   </antcall>
217 </target>
218
219 <property name="support.dist.dir" value="${lib.dir}/wamblee/support"/>
220 <target name="wamblee.support.d">
221   <copy todir="${download.dir}">
222     <fileset dir="${support.dist.dir}">
223       <include name="wamblee-support.jar"/>
224     </fileset>
225   </copy>
226 </target>
227 <target name="wamblee.support.test.d">
228   <copy todir="${download.dir}">
229     <fileset dir="${support.dist.dir}">
230       <include name="wamblee-support-test.jar"/>
231     </fileset>
232   </copy>
233 </target>
234
235
236 <target name="junit.d">
237   <antcall target="download.dep">
238     <param name="group" value="junit"/>
239     <param name="version" value="3.8.1"/>
240   </antcall>
241   <copy todir="${download.dir}">
242     <fileset dir="${special.lib.dir}/test">
243        <include name="*.jar"/>
244     </fileset>
245   </copy>
246 </target>
247
248 <target name="emma.d">
249   <antcall target="download.dep">
250     <param name="group" value="emma"/>
251     <param name="artifact" value="emma"/>
252     <param name="version" value="2.0.5312"/>
253   </antcall>
254   <antcall target="download.dep">
255     <param name="group" value="emma"/>
256     <param name="artifact" value="emma_ant"/>
257     <param name="version" value="2.0.5312"/>
258   </antcall>
259 </target>
260
261 <target name="jmock.d">
262   <antcall target="download.dep">
263     <param name="group" value="jmock"/>
264     <param name="artifact" value="jmock"/>
265     <param name="version" value="1.0.1"/>
266   </antcall>
267   <antcall target="download.dep">
268     <param name="group" value="jmock"/>
269     <param name="artifact" value="jmock-cglib"/>
270     <param name="version" value="1.0.1"/>
271   </antcall>
272 </target>
273
274 <target name="dbunit.d">
275   <antcall target="download.dep">
276     <param name="group" value="dbunit"/>
277     <param name="version" value="2.1"/>
278   </antcall>
279 </target>
280
281
282 <target name="antlr.d">
283   <antcall target="download.dep">
284     <param name="group" value="antlr"/>
285     <param name="version" value="2.7.2"/>
286   </antcall>
287 </target>
288
289 <target name="checkstyle.d" depends="antlr.d,commons-beanutils.d,commons-logging.d,commons-collections.d">
290   <antcall target="download.dep">
291     <param name="group" value="checkstyle"/>
292     <param name="version" value="4.1"/>
293   </antcall>
294 </target>
295
296 <!-- common test dependencies for all test code --> 
297 <target name="test.d" depends="junit.d,jmock.d,dbunit.d,emma.d">
298 </target>
299
300 <!-- downloaded dependencies for ant tasks --> 
301 <target name="ant.d" depends="checkstyle.d">
302 </target>
303
304
305
306  <target name="import_header" unless="build_header_included">
307  
308     <property name="ant.lib.dir" value="${build.dir}/lib/ant"/>
309     <property name="test.lib.dir" value="lib/test"/>
310     <property name="special.lib.dir" value="${build.dir}/lib/special"/>
311         <property name="ant.downloaded.lib.dir" value="${build.dir}/lib/ant/downloaded"/>
312
313         
314     <!-- ========================================================================================
315          Ant task defs
316          ======================================================================================== -->
317  
318     <!-- ant-contrib integration --> 
319     <property name="ant.contrib.home" value="${ant.lib.dir}/ant-contrib-1.0b2"/>
320     <taskdef resource="net/sf/antcontrib/antlib.xml">
321       <classpath>
322         <pathelement location="${ant.contrib.home}/ant-contrib.jar" />
323       </classpath>
324     </taskdef>
325     
326     <!-- taskdef for ant-dependencies task --> 
327     <taskdef name="dependencies" classpath="${ant.lib.dir}/ant-dependencies.jar" 
328       classname="org.apache.tools.ant.taskdefs.optional.dependencies.Dependencies"/>
329   
330     <!-- Emma integration --> 
331         <if>
332           <available file="${test.lib.dir}"/>
333           <then>
334         <path id="emma.lib">
335           <fileset dir="${test.lib.dir}" includes="emma*.jar"/>
336         </path>
337         <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
338         <property name="emma.enabled" value="false"/>
339           </then>
340     </if>
341     
342     <!-- checkstyle -->
343     <property name="checkstyle.home" value="${ant.downloaded.lib.dir}"/>
344     <taskdef resource="checkstyletask.properties">
345       <classpath>
346         <fileset dir="${checkstyle.home}">
347           <include name="*.jar"/>
348         </fileset>
349       </classpath>
350     </taskdef>
351     <property name="checkstyle.rules" value="style.xml"/>
352     <property name="checkstyle.test.rules" value="test-style.xml"/>
353     
354              
355     <!-- jalopy -->
356     <!-- TMP download this dependence as well 
357     <property name="jalopy.home" value="${lib.dir}/jalopy-ant-0.6.2"/>
358     <property name="jalopy.rules" value="${build.dir}/formatting-rules.xml"/>
359     <taskdef name="jalopy"
360          classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
361       <classpath>
362         <fileset dir="${jalopy.home}">
363           <include name="*.jar" />
364         </fileset>
365       </classpath>
366     </taskdef>
367     -->
368   
369     <!-- simian integration -->
370     <!-- TMP download this dependence as well 
371     <property name="simian.home" value="${lib.dir}/simian"/>
372     <taskdef resource="simiantask.properties" classpath="${simian.home}/simian.jar"/>
373     --> 
374     
375     <!-- macker integration -->
376     <!-- TMP download this dependence as well 
377     <property name="macker.home" value="${lib.dir}/macker-0.4.2"/>
378     <path id="macker.path">
379           <fileset dir="${macker.home}">
380             <include name="**/*.jar"/>
381           </fileset>
382     </path>
383     <taskdef name="macker"
384       classname="net.innig.macker.ant.MackerAntTask"
385       classpathref="macker.path"/>
386
387     --> 
388     
389     <!-- ========================================================================================
390          Locate user properties to (optionally) override defaults
391          ======================================================================================== -->
392  
393     <!--
394       Give user a chance to override without editing this file
395       (and without typing -D each time they run it).
396
397       The following properties must be defined in this file:
398       - jcoverage.home: root of the jcoverage installation. 
399       - jalopy.home: root of the jalopy installation. 
400     -->
401     <property name="user.property.file" value="${user.home}/wamblee.properties"/>
402     <available file="${user.property.file}" property="user.properties.found"/>
403     <property file="${user.property.file}"/>
404     
405     <antcall target="echoUserPropertiesFileFound"/>
406     <antcall target="echoUserPropertiesFileNotFound"/>
407
408     <!-- project properties defaults, can be overriden in the user's properties file -->
409     
410       <!--  The project.home property can also be overriden in a build.xml
411             in case the source is in a subdirectory and not necessarily
412             in the top-level directory --> 
413    
414   
415         <if>
416           <isset property="webroot.dir"/>
417           <then>
418             <property name="external.lib.dir" value="${webroot.dir}/WEB-INF/lib"/>
419           </then>
420           <else>
421             <property name="external.lib.dir" value="lib/external"/>
422           </else>
423         </if>
424    
425     <property name="build.properties.dir" value="${project.home}" />
426     <property name="build.properties.name" value="build.properties" />
427     
428     <mkdir dir="${external.lib.dir}"/>
429     <mkdir dir="${test.lib.dir}"/>
430     
431     <property name="conf.dir" value="conf"/>
432     <property name="log4j.properties.dir" value="${conf.dir}/properties"/>
433     
434     <!-- Compilation properties -->
435     <property name="javac.debug" value="true"/>
436     <property name="javac.debug.level" value="lines,vars,source"/>
437     <property name="javac.source" value="1.5"/>
438
439     <!-- ========================================================================================
440          Standard path definitions to be used with all projects 
441          ======================================================================================= -->
442     <property name="xmlschemas.dir" value="${conf.dir}/schemas"/>
443     <path id="xmlschemas.path">
444       <pathelement location="${xmlschemas.dir}"/>
445     </path>
446
447     <!-- ========================================================================================
448          Path definitions for external libraries.
449          ======================================================================================== -->
450  
451     <!-- Ignore system classpath! -->
452     <property name="build.sysclasspath" value="ignore" />
453
454     <!-- JUnit -->
455     <property name="junit.halt.on.failure" value="false"/>
456     <property name="unitreport" value="cl-unit.xml"/>
457     
458     <!-- DocCheck path -->
459     <property name="doccheck.home" value="${ant.lib.dir}/doccheck1.2b2/doccheck.jar"/>
460     <path id="doccheck.path">
461       <pathelement location="${doccheck.home}"/>
462     </path>
463     
464     <!-- PdfDoclet path -->
465     <property name="pdfdoclet.home" value="${ant.lib.dir}/pdfdoclet-1.0.2-all.jar"/>
466     <path id="pdfdoclet.path">
467       <pathelement location="${pdfdoclet.home}"/>
468     </path>
469         
470     <!-- Hibernate paths --> 
471     <!--  name of the file in the source directory containing
472           the names of hibernate files to look at in the correct order --> 
473     <property name="hibernate.home" value="${lib.dir}/hibernate-3.0"/>
474     <path id="hibernate.basic.path">
475       <fileset dir="${hibernate.home}">
476         <include name="*.jar"/>
477       </fileset>
478       <path refid="xerces.path"/>
479       <path refid="dom4j.path"/>
480     </path>
481     <path id="hibernate.appserver.path"> 
482       <path refid="hibernate.basic.path"/>
483       <fileset dir="${hibernate.home}/appserver">
484         <include name="*.jar"/>
485       </fileset>
486     </path>
487     <path id="hibernate.standalone.path"> 
488       <path refid="hibernate.basic.path"/>
489       <fileset dir="${hibernate.home}/standalone">
490         <include name="*.jar"/>
491       </fileset>
492     </path>
493
494     <!-- Commented the inclusion of a system-wide path in the user's environment into a 
495          classpath. System wide classpaths should not be used. -->
496     <!-- property name="classpath_id" value="build.path" / -->
497     <!-- property name="classpath" refid="${classpath_id}"/ -->
498     <property name="classpath" value=""/>
499     
500     
501     <!-- ========================================================================================
502          Database settings
503          ======================================================================================== -->
504     <property name="database" value="Derby"/>
505     
506   
507    
508     <!-- ========================================================================================
509          Information
510          ======================================================================================== -->
511     <echo level="debug" message="project.home=${project.home}"/>
512     <echo level="debug" message="project.libs=${project.libs}"/>
513     <echo level="debug" message="classpath=${classpath}"/>
514
515
516     <!-- ========================================================================================
517          Included marker
518          ======================================================================================== -->
519     <property name="build_header_included" value="true" />
520 </target>
521       
522 <!--  =================================================================
523      Sets up the directory definitions for the module
524      ================================================================= -->
525 <target name="init_directory_properties" depends="import_header">
526         <!-- Set module properties for this build -->
527
528         <property name="module.home" value="." />
529         
530         <!--  Replace the dash by a / to create a relative directory 
531               from a module name --> 
532         <propertyregex property="module.reldir" 
533                        input="${module.name}"
534                        regexp="-"
535                        replace="/"
536                        global="true"
537                        defaultValue="${module.name}"/>
538         <!-- property name="module.build.dir"
539                 value="${build.dir}/${module.reldir}" / -->
540     <property name="module.build.dir" value="build"/>
541         <property name="module.api.forrest.dir" value="${forrest.build.site.dir}/api/${module.name}" />
542         <if>
543           <isset property="webroot.dir"/>
544           <then>
545             <property name="module.classes.dir" value="${webroot.dir}/WEB-INF/classes" />
546           </then>
547           <else>
548             <property name="module.classes.dir" value="${module.build.dir}/bin" />
549           </else>
550         </if>
551         
552         <property name="module.testclasses.dir" value="${module.build.dir}/testbin" />
553         <!-- Directory where generated SQL will be put by the schema export-->
554         <property name="module.sql.dir" value="${module.build.dir}/sql" />
555
556
557         <property name="module.jcovclasses.dir"
558                 value="${module.build.dir}/testjcov" />
559         <property name="module.jars.dir" value="${module.build.dir}/jars" />
560         <property name="module.jar.file"
561                 value="${module.jars.dir}/${module.jar.name}" />
562         <property name="module.source.dir" value="${module.home}/src" />
563         <property name="module.forrest.src.dir" value="${module.home}/xdocs" />
564         <property name="module.ejbsource.dir" value="${module.home}/ejbsrc" />
565         <property name="module.test.dir" value="${module.home}/test" />
566         <property name="module.testjar.name"
567                 value="${module.name}-test.jar" />
568         <property name="module.testresourcesjar.name"
569                 value="${module.name}-test-resources.jar" />
570         <property name="module.resource.dir"
571                 value="${module.home}/resources" />
572         <property name="module.testresource.dir"
573                 value="${module.resource.dir}/test" />
574     <property name="module.testoutput.dir"
575         value="${module.resource.dir}/testoutput"/>
576         <property name="module.report.dir"
577                 value="${module.build.dir}/testresults" />
578         <property name="module.emmareport.dir"
579                 value="${module.report.dir}/html/emma"/>
580         <property name="module.docbase.dir"
581                 value="${module.build.dir}/docs" />
582         <property name="module.javadoc.dir"
583                 value="${module.docbase.dir}/api" />
584         <property name="module.javadocjar.name"
585                 value="${module.name}-doc.jar" />
586         <property name="module.testjavadocjar.name"
587                 value="${module.name}-test-doc.jar" />
588         <property name="module.testjavadoc.dir"
589                 value="${module.docbase.dir}/testapi" />
590         <property name="module.pdfdoc.dir"
591                 value="${module.docbase.dir}/pdf" />
592         <property name="module.doccheck.dir"
593                 value="${module.docbase.dir}/doccheck" />
594         <property name="module.checkstyle.dir"
595             value="${module.docbase.dir}/checkstyle" />
596         <property name="module.jar.name" value="${module.name}.jar" />
597         
598         <!--  Replace the dash by a / to create a relative directory 
599               from a module name --> 
600         <property name="module.dist.dir" value="${lib.dir}/${module.reldir}" />
601 </target>
602
603 <!-- ============================================================================
604   Initialize the environment for other tasks. Normally, every task which
605   does not depend on any other task should at least depend on init. 
606   ============================================================================ -->
607   
608   <target name="help" depends="import_header">
609     <antcall target="help-within-module"/>
610     <antcall target="help-outside-module"/>
611   </target>
612   
613   <target name="help-within-module" depends="init_directory_properties" if="module.name">
614     <antcall target="help-impl"/>
615   </target>
616   
617   <target name="help-outside-module" unless="module.name">
618     <antcall target="help-outside-module-2">
619       <param name="module.name" value="MODULE_NAME"/>
620     </antcall>
621   </target>
622   
623   <target name="help-outside-module-2" depends="init_directory_properties">
624     <antcall target="help-impl"/>
625   </target>
626   
627   
628   <target name="help-impl">
629     <echo>
630     
631       Preparation:
632       
633       To execute with a specific proxy host and port, start ant with the 
634       command-line options   -Dproxyhost=hostname -Dproxyport=portnumber.
635       
636       deps:          Download dependencies, this is necessary for using 
637                      any of the build targets.
638       clean-deps:    Remove downloaded dependencies. 
639       
640       General build targets: 
641       
642       clean:         Cleans up all build results (excluding the dist location).
643       compile:       Compiles all java clasess. Target dir ${module.classes.dir} 
644       jar:           Creates a jar file. Target: ${module.jar.file} 
645       dist:          Makes the build results available for other modules Target: ${module.dist.dir}. 
646       dist-lite:     Similar to dist but only creates the jars for code and test code. Useful
647                      during development because it takes much less time than the dist
648                      target
649       clean-dist:    Cleans up the dist directories. 
650       
651       Test: 
652       
653       test:          Compile and run tests. 
654       junit-reports: As test but generates a test report. Target: ${module.report.dir}(/html/unit) 
655       reports:       As junit-reports but also generates an emma test coverage
656                      report
657                      
658       Note: By specifying -Dtest=TestCaseName on the ant command line, 
659       only the specified testcase will be run. 
660       
661       Emma can also be executed manually:
662              
663          emma:          Overwrites the production classes by their instrumented versions.
664          emma-reports:  Generates emma code coverage reports after running the
665                         testcases with instrumented classes.
666       
667       Javadoc targets: 
668       
669       javadoc:       Generates javadoc. Target: ${module.javadoc.dir} 
670       doccheck:      Checks documentation. Target: ${module.doccheck.dir}
671           
672           Forrest:
673           
674           forrest:       Generates project docs using forrest. 
675       
676       Code analysis: 
677       
678       checkstyle:    Checks the style of the code. 
679       format:        Formats to the code in accordance with the checkstyle rules.
680       simian:        Analyse similarities in the code.
681           
682           Building a web application: 
683           
684           To build a web application archive (WAR) you must set the property
685           webroot.dir to the value of the directory which is the root of your
686           web application. This must be done before the header.xl is 
687           sourced. The build support will then make sure that 
688           classes and libs are put in the correct directories below 
689           ${webroot.dir}/WEB-INF, and it will build a web archive. 
690       
691       Database targets:  ** database targets are not functional yet **
692       
693       For all targets below the database is configured using 
694       hibernate.properties (hibernate.dialect property) and 
695       the JDBC connection properties in database.properties. 
696       
697       The schemaexport and schemaupdate targets require the 
698       setting of a property named hibernate.filelist. The value
699       of the property must be the fully qualified class name of
700       a concrete subclass of ConfigFileList which has a default 
701       public constructor and defines the Hibernate mapping files that
702       can be used. 
703       
704       schemaexport:  Generate SQL code to create the required database structures.
705       
706       startdb:       Startup a lightweight database. The database
707       type to start is obtained from the currently
708       configured database. 
709       
710       schemaupdate:  Populate the database with a schema by running
711       Hibernate schemaupdate against the currently
712       configured database.  
713     </echo>
714   </target>
715   
716