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