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