root/trunk/build.xml

Revision 1676, 35.3 KB (checked in by kohlhaas, 8 months ago)

Test signing of jar files

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?xml version="1.0"  encoding="utf-8"?>
2<!--
3Rapla builds are based on the ANT-tool from apache.org.
4Ant is a build tool written in java that uses a build-file, like this one.
5Ant does all the nasty work like compiling,building and testing the different distributions.
6For more information visit "http://jakarata.apache.org".
7
8The rapla-source distribution comes with a copy of ANT located in the lib directory:
9ant.jar,optional.jar
10
11You will also find junit.jar
12junit.jar is a testing-framework for automated testing used for most of our tests
13(currently there are'nt many).
14
15
16Building instructions
17(shamelessly taken from the Apache Cocoon-build-file and replaced cocoon with rapla)
18=====================
19
20Ok, let's build the baby. First, make sure your current working directory is
21where this very file is located. Then type
22
23  ./build.sh (unix)
24  .\build.bat (win32)
25
26if everything is right and all the required packages are visible, this action
27will generate a file called "rapla.jar" in the "./build" directory.
28Note, that if you do further development, compilation time is reduced since
29Ant is able of detecting which files have changed and to recompile them at need.
30
31Also, you'll note that reusing a single JVM instance for each task, increases
32tremendously the performance of the whole build system, compared to other
33tools (i.e. make or shell scripts) where a new JVM is started for each task.
34
35
36Building on another directory
37=============================
38
39Sometimes you might want to build on an external directory to keep the
40distribution clean: no worries, this is just an environment property away.
41Suppose you want to use the "../build" directory instead, you simply tipe
42
43 [unix]  ./build.sh  -Dbuild.dir=../build
44 [win32] .\build.bat -Dbuild.dir=..\build
45
46By using the -Dxxx=yyy argument, you are setting environments in the JVM: Ant
47is designed to give higher priority to system environments to allow you to
48modify _any_ <property> that you can find in the building instructions below,
49so it's just a matter of understanding what property you want to change
50and you don't have to touch this file (which you shouldn't need to do).
51
52
53Build targets
54=============
55
56The build system is not only responsible of compiling Rapla into a jar file,
57but is also responsible for creating the HTML documentation, javadocs,
58distributions and web site. In fact, the file you have here is _exactly_ what
59is used by rapla maintainers to take care of everything in the Rapla
60project, no less and no more.
61
62To know more about the available targets take a look at this file, which is
63pretty self-explanatory or type
64
65 [unix]  ./build.sh  -projecthelp
66 [win32] .\build.bat -projecthelp
67
68and concentrate on the target descriptions that start with a star '*': these
69are the one you should call, the others are internal targets that are called
70by the main ones.
71
72
73Many thanks to Stefano Mazzocchi
74-->
75
76<!-- Rapla build-file
77Copyright (C) 2001-2002 Christopher Kohlhaas
78
79This programm is free software; you can redistribute it and/or modify
80it under the terns of the GNU General Public License as published by the
81Free Software Foundation. A copy of the license has been included with
82these distribution in the COPYING file, if not go to www.fsf.org .
83
84As a special exception, you are granted the permission to link this
85program with every library, of wich license fullfills the Open Source
86Definition as published by the Open Source Initiative (OSI).
87-->
88
89<project name="Rapla" default="choose-target" basedir=".">
90    <!-- set global properties for this build -->
91    <property name="build.compiler.emacs" value="on" />
92    <property name="build.compiler.warnings" value="true" />
93    <property name="build.compiler.pedantic" value="true" />
94    <property name="build.compiler.depend" value="true" />
95    <property name="build.compiler.fulldepend" value="true" />
96
97    <!-- This is for the crlf-fix -->
98    <patternset id="text-files">
99        <include name="**.java" />
100        <include name="**.txt" />
101    </patternset>
102
103    <property name="main.dir" value="${basedir}" />
104
105    <target name="properties" if="eclipse.running">
106        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" />
107    </target>
108
109    <target name="init" depends="properties">
110        <!-- Create the time stamp -->
111        <tstamp />
112        <tstamp>
113            <format property="BUILD_TIME" pattern="yyyy-MM-dd HH:mm" locale="en" />
114        </tstamp>
115        <property name="doc.properties" value="doc.properties" />
116        <property name="build.properties" value="build.properties" />
117
118      <available file="${main.dir}/${build.properties}" property="build.properties.present" />
119                 
120        <copy todir="${main.dir}">
121            <fileset dir="${main.dir}">
122                <include name="build.properties.template" unless="build.properties.present" />
123            </fileset>
124            <mapper type="glob" from="*.template" to="*" />
125        </copy>
126
127       
128        <property file="${main.dir}/${build.properties}" />
129        <property file="${main.dir}/${doc.properties}" />
130
131        <!-- All the libraries are used for compilation by default-->
132        <patternset id="default-compile-libraries">
133            <include name="client/*.jar" />
134            <include name="common/*.jar" />
135            <include name="server/*.jar" />
136            <include name="*.jar" />
137        </patternset>
138
139        <!-- Information about the compiler -->
140        <!-- property name="build.compiler" value="javac1.3"/-->
141        <property name="debug" value="on" />
142        <property name="optimize" value="off" />
143        <property name="deprecation" value="on" />       
144        <property name="verbose" value="no" />
145        <property name="target_vm" value="1.5" />
146        <property name="packages" value="org.*" />
147
148        <!-- The rapla-directories -->
149        <property name="doc.dir" value="${main.dir}/xdocs" />
150        <property name="src.dir" value="${main.dir}/src" />
151        <property name="lib.dir" value="${main.dir}/lib" />
152        <property name="build.dir" value="${main.dir}/build" />
153        <property name="dist.dir" value="${main.dir}/dist" />
154        <property name="temp.dir" value="${main.dir}/temp" />
155        <property name="testsrc.dir" value="${main.dir}/test-src" />
156        <property name="generated.dir" value="${main.dir}/generated-src" />
157        <property name="test.dir" value="${basedir}/test" />
158        <property name="test-dist-src.dir" value="${test.dir}/rapla-source-test" />
159        <property name="build.src" value="${build.dir}/src" />
160        <property name="build.javadocs" value="${build.dir}/javadocs" />
161        <property name="build.dest" value="${build.dir}/classes" />
162        <property name="build.test" value="${build.dir}/test/classes" />
163        <property name="dist-src.dir" value="${dist.dir}/rapla-source-${doc.version}" />
164        <property name="dist-bin.dir" value="${dist.dir}/rapla-binary-${doc.version}" />
165        <property name="webapp.dir" value="${build.dir}/webapp" />
166        <property name="keystore.file" value="${main.dir}/testkeystore" />
167        <property name="keystore.password" value="secret" />
168
169        <property name="main.lib" value="rapla.jar" />
170       
171        <!-- The class and properties file to start rapla from the command-line.
172         This poperties are necessary for the start scripts-->
173        <property name="start.class" value="org.rapla.Main" />
174
175        <property name="target" value="dist-bin" />
176        <available file="${lib.dir}/test-only/hsqldb.jar" property="hsqldb.present" />
177        <available file="${keystore.file}" property="keystore.present" />
178     
179       
180        <!-- filters will replace tokens in source files with the values in doc.properties -->
181        <filterset id="docfilter">
182            <filter token="doc.name" value="${doc.name}" />
183            <filter token="doc.date" value="${doc.date}" />
184            <filter token="doc.version" value="${doc.version}" />
185            <filter token="doc.buildtime" value="${BUILD_TIME}" />
186            <filter token="doc.year" value="${doc.year}" />
187            <filter token="doc.copyright" value="${doc.copyright}" />
188            <filter token="doc.developer-list-link" value="${doc.developer-list-link}" />
189            <filter token="doc.developer-list" value="${doc.developer-list}" />
190            <filter token="doc.homepage" value="${doc.homepage}" />
191        </filterset>
192    </target>
193
194    <target name="choose-target" depends="init" description="Executes the target specified in build.properties. Default is dist-bin.">
195        <antcall target="${target}" />
196    </target>
197
198    <!-- =================================================================== -->
199    <!--   The Targets prepare,compile,compile-resources and build are for   -->
200    <!--   creating the ${main.lib}                                            -->
201    <!-- =================================================================== -->
202
203    <target name="prepare" depends="init">
204        <mkdir dir="${temp.dir}" />
205        <mkdir dir="${generated.dir}" />
206        <mkdir dir="${build.dir}" />
207        <mkdir dir="${build.dest}" />
208        <mkdir dir="${build.dest}/META-INF" />
209    </target>
210
211    <target name="compile" depends="prepare">
212        <!-- Compile the java code from ${src} into ${build.dir} -->
213        <javac srcdir="${src.dir}" destdir="${build.dest}" debug="${debug}" source="${target_vm}" target="${target_vm}" optimize="${optimize}" deprecation="${deprecation}" verbose="${verbose}">
214            <classpath>
215                <fileset dir="${lib.dir}">
216                    <patternset refid="default-compile-libraries" />
217                </fileset>
218            </classpath>
219        </javac>
220
221        <!-- The png,license,xsl and rng files must be in the correct classpath  -->
222        <copy todir="${build.dest}">
223            <fileset dir="${src.dir}">
224                <exclude name="**/*.java" />
225                <exclude name="**/*Resources.xml" />
226                <exclude name="**/package.html" />
227            </fileset>
228        </copy>
229
230    </target>
231
232    <!-- Set a variable if plugin meta is already up-to-date.                  -->
233    <target name="pluginmeta-check" depends="prepare">
234        <condition property="pluginmeta.notrequired">
235            <and>
236                <uptodate>
237                    <srcfiles dir="${build.dest}" includes="**/*Plugin.class" />
238                    <mapper type="merge" to="${build.dest}/META-INF/rapla-plugin.list" />
239                </uptodate>
240            </and>
241        </condition>
242    </target>
243
244    <target name="generate-plugin-meta" unless="pluginmeta.notrequired" description="Generate the rapla-plugin.list" depends="pluginmeta-check,compile">
245        <echo message="generating Plugin Metainfo" />
246        <mkdir dir="${generated.dir}/META-INF" />
247        <java classname="org.rapla.framework.ServiceListCreator" failonerror="true" fork="yes">
248            <arg value="${build.dest}" />
249            <arg value="${generated.dir}/META-INF/rapla-plugin.list" />
250            <classpath>
251                <pathelement path="${build.dest}" />
252                <fileset dir="${lib.dir}">
253                    <patternset refid="default-compile-libraries" />
254                </fileset>
255            </classpath>
256        </java>
257        <copy file="${generated.dir}/META-INF/rapla-plugin.list" tofile="${build.dest}/META-INF/rapla-plugin.list" />
258    </target>
259
260    <!-- Set a variable if resources are already up-to-date.                  -->
261    <target name="resources-check" depends="init">
262        <condition property="resources.notrequired">
263            <and>
264                <uptodate>
265                    <srcfiles dir="${src.dir}">
266                        <include name="**/*Resources.xml" />
267                    </srcfiles>
268                    <mapper type="glob" from="*Resources.xml" to="${build.dest}/*Resources.class" />
269                </uptodate>
270                <uptodate property="test" srcfile="${main.dir}/${doc.properties}" targetfile="${build.dest}/org/rapla/RaplaResources.class" />
271            </and>
272        </condition>
273    </target>
274
275    <target name="compile-resources" unless="resources.notrequired" description="Generate and compile the RaplaResources" depends="resources-check,compile">
276
277        <echo message="generating Resourcefiles" />
278
279        <java classname="org.rapla.components.xmlbundle.impl.TranslationParser" failonerror="true" fork="yes">
280            <arg value="${src.dir}" />
281            <arg value="${temp.dir}/unfiltered-resources" />
282            <classpath>
283                <pathelement path="${build.dest}" />
284                <fileset dir="${lib.dir}">
285                    <patternset refid="default-compile-libraries" />
286                </fileset>
287            </classpath>
288        </java>
289
290        <uptodate property="resources.rebuild">
291            <srcfiles dir="${build.dest}" includes="**/*Resources*.class" />
292            <mapper type="merge" to="{$main.dir}/${doc.properties}" />
293        </uptodate>
294
295        <echo message="Applying filter to ResourceFiles" />
296        <copy todir="${generated.dir}">
297            <fileset dir="${temp.dir}/unfiltered-resources">
298                <include name="**/*.java" />
299            </fileset>
300            <filterset refid="docfilter" />
301        </copy>
302       
303          <fixcrlf srcdir="${generated.dir}">
304               <include name="**/*.java" />
305          </fixcrlf>
306         
307        <javac srcdir="${generated.dir}" destdir="${build.dest}" source="${target_vm}" target="${target_vm}" verbose="${verbose}">
308            <include name="**/*.java" />
309        </javac>
310        <!--    <delete dir="${temp.dir}/languages" /> -->
311    </target>
312
313    <target name="build" depends="compile,compile-resources,generate-plugin-meta">
314        <mkdir dir="${build.src}" />
315
316        <jar jarfile="${build.dir}/${main.lib}">
317            <fileset dir="${build.dest}">
318                <exclude name="org/rapla/bootstrap/*"/>
319            </fileset>
320            <manifest>
321                <attribute name="Created-By" value="${user.name}" />
322                <!-- TODO replace it with an automated generated jar list -->
323                <!-- The class-path is helpfull when starting with the java -jar command or double-clicking on the jar.-->
324                <attribute name="Class-Path" value="picollo.jar avalon-framework-4.2.0.jar .. ../.." />
325                <attribute name="Main-Class" value="org.rapla.Main" />
326                <section name="common">
327                    <attribute name="Implementation-Title" value="common" />
328                    <attribute name="Implementation-Version" value="${doc.version} ${TODAY}" />
329                </section>
330            </manifest>
331        </jar>
332       
333        <jar jarfile="${build.dir}/raplabootstrap.jar">
334             <fileset dir="${build.dest}">
335               <include name="org/rapla/bootstrap/*" />
336             </fileset>
337             <manifest>
338                    <attribute name="Created-By" value="${user.name}" />
339                    <attribute name="Main-Class" value="org.rapla.bootstrap.RaplaStandaloneLoader" />
340                    <section name="common">
341                        <attribute name="Implementation-Title" value="common" />
342                        <attribute name="Implementation-Version" value="${doc.version} ${TODAY}" />
343                    </section>
344             </manifest>
345        </jar>
346       
347        <patternset id="client-libraries">
348            <include name="common/**" />
349            <include name="client/**" />
350        </patternset>
351
352    </target>
353 
354    <target name="start" depends="compile,compile-resources,generate-plugin-meta,compile-tests" description="Use this during development to quick-launch rapla.">
355        <copy todir="${temp.dir}/start">
356            <fileset dir="${main.dir}/webapp">
357                <include name="rapla.xconf" />
358                <include name="raplaclient.xlog" />
359                <include name="*data.xml" />
360            </fileset>
361        </copy>
362        <java classname="${start.class}" failonerror="yes" fork="yes" dir="${main.dir}">
363            <classpath>
364                <pathelement path="${build.dest}" />
365                <pathelement path="${build.test}" />
366                <fileset dir="${lib.dir}">
367                    <patternset refid="default-compile-libraries" />
368                </fileset>
369            </classpath>
370            <arg value="-c" />
371            <arg value="${temp.dir}/start/rapla.xconf" />
372            <arg value="build-script" />
373        </java>
374    </target>
375
376    <target name="run" depends="dist-bin" description="build and run binary-distribution">
377        <java classname="${start.class}" fork="yes" dir="${dist-bin.dir}">
378            <classpath>
379                <fileset dir="${dist-bin.dir}/webapp/WEB-INF/lib">
380                </fileset>
381            </classpath>
382                <arg value="-c" />
383            <arg value="webapp/WEB-INF/rapla.xconf" />
384        </java>
385    </target>
386
387    <!-- =================================================================== -->
388    <!--       Build the webapps folder                                      -->
389    <!-- =================================================================== -->
390    <target name="webapp" depends="build" description="Build the rapla web-application">
391        <mkdir dir="${webapp.dir}" />
392        <mkdir dir="${webapp.dir}/WEB-INF" />
393        <mkdir dir="${webapp.dir}/WEB-INF/lib" />
394        <mkdir dir="${webapp.dir}/WEB-INF/classes" />
395
396        <copy todir="${webapp.dir}">
397            <fileset dir="${main.dir}/webapp">
398                <include name="*.*" />
399                <include name="webclient/**" />
400                <include name="images/**" />
401            </fileset>
402         
403        </copy>
404
405            <copy todir="${webapp.dir}/webclient">
406                <fileset dir="${lib.dir}/common">
407                <include name="*.jar" />
408            </fileset>
409            <fileset dir="${lib.dir}/client">
410                <include name="*.jar" />
411            </fileset>
412        </copy>
413       
414        <copy todir="${webapp.dir}/WEB-INF/lib">
415            <fileset dir="${lib.dir}">
416                <include name="${build.dir}/${main.lib}" />
417            </fileset>
418            <fileset dir="${lib.dir}/common">
419                <include name="*.jar" />
420            </fileset>
421            <fileset dir="${lib.dir}/server">
422                <include name="*.jar" />
423            </fileset>
424            <fileset dir="${build.dir}">
425                <include name="${main.lib}" />
426            </fileset>
427        </copy>
428       
429       
430        <copy todir="${webapp.dir}/WEB-INF/">
431            <fileset dir="${main.dir}/webapp/WEB-INF">
432                <include name="raplaserver.xlog" />
433                <include name="raplaserver.xconf" />
434                <include name="rapla.xconf" />
435                  <include name="raplaclient.xlog" />
436                <include name="data.xml" />
437                <include name="simpsons-data.xml" />
438                <include name="rapla-hsqldb.*" />
439                <include name="rapla-*.sql" />
440                  <include name="web.xml" />
441            </fileset>
442        </copy>
443
444    </target>
445
446        <target name="sign" if="keystore.present">
447           <signjar
448        alias="rapla" keystore="${keystore.file}"
449        storepass="${keystore.password}"
450        lazy="true"
451        >
452      <path>
453        <fileset dir="${webapp.dir}/webclient" includes="**/*.jar" />
454        <fileset dir="${webapp.dir}/WEB-INF/lib" includes="**/*.jar" />
455      </path>
456    </signjar>
457        </target>
458    <!-- =================================================================== -->
459    <!--     Create the basic binary distribution that can run Rapla         -->
460    <!-- =================================================================== -->
461        <target name="dist-bin" depends="webapp,sign" description="Build the binary distribution">
462                <mkdir dir="${dist-bin.dir}" />
463             
464        <copy todir="${dist-bin.dir}/webapp">
465            <fileset dir="${webapp.dir}" />
466        </copy>
467
468        <mkdir dir="${dist-bin.dir}/service" />
469        <copy todir="${dist-bin.dir}/service">
470            <fileset dir="${main.dir}/service" >
471                <include name="**" />
472            </fileset>
473        </copy>
474
475        <mkdir dir="${dist-bin.dir}/jetty" />
476        <copy todir="${dist-bin.dir}/jetty/lib">
477            <fileset dir="${lib.dir}">
478                <include name="servlet*.jar" />
479                <include name="jetty*.jar" />
480            </fileset>
481        </copy>
482        <copy todir="${dist-bin.dir}/jetty">
483            <fileset dir="${main.dir}/jetty" >
484                <include name="jetty.xml" />
485                <include name="webdefault.xml" />
486            </fileset>
487        </copy>
488        <copy todir="${dist-bin.dir}">
489            <fileset dir="${build.dir}">
490                <include name="raplabootstrap.jar" />
491            </fileset>
492            <fileset dir="${main.dir}/templates">
493                <include name="rapla.exe" />
494            </fileset>
495            <fileset dir="${main.dir}">
496                <include name="README**" />
497                <include name="INSTALL**" />
498                <include name="legal/**" />
499            </fileset>
500        </copy>
501        <copy todir="${dist-bin.dir}">
502            <fileset dir="${main.dir}/templates/scripts">
503                <include name="raplaserver_*" />
504            </fileset>
505            <mapper type="glob" from="raplaserver_*" to="raplaserver.*" />
506        </copy>
507            <copy todir="${dist-bin.dir}">
508            <fileset dir="${main.dir}/templates/scripts">
509                <include name="raplaclient_*" />
510            </fileset>
511            <mapper type="glob" from="raplaclient_*" to="raplaclient.*" />
512        </copy>
513              <copy todir="${dist-bin.dir}">
514            <fileset dir="${main.dir}/templates/scripts">
515                <include name="rapla_*" />
516            </fileset>
517            <mapper type="glob" from="rapla_*" to="rapla.*" />
518        </copy>
519              <copy todir="${dist-bin.dir}">
520            <fileset dir="${main.dir}/templates/scripts">
521                <include name="raplaimport_*" />
522            </fileset>
523            <mapper type="glob" from="raplaimport_*" to="raplaimport.*" />
524        </copy>
525              <copy todir="${dist-bin.dir}">
526            <fileset dir="${main.dir}/templates/scripts">
527                <include name="raplaexport_*" />
528            </fileset>
529            <mapper type="glob" from="raplaexport_*" to="raplaexport.*" />
530        </copy>
531
532                  <fixcrlf srcdir="${dist-bin.dir}" eol="crlf">
533             <include name="*.bat" />
534                </fixcrlf>
535      <fixcrlf srcdir="${dist-bin.dir}" eol="lf">
536              <include name="*.sh" />
537            </fixcrlf>
538        <chmod perm="u+x">
539            <fileset dir="${dist-bin.dir}">
540                <include name="*.sh" />
541                <include name="*.bat" />
542            </fileset>
543        </chmod>
544    </target>
545
546    <!-- =================================================================== -->
547    <!--     Create the source distribution                                  -->
548    <!-- =================================================================== -->
549    <target name="dist-src" depends="prepare" description="Build the source distribution">
550        <mkdir dir="${dist-src.dir}" />
551        <copy todir="${dist-src.dir}/lib">
552            <fileset dir="${lib.dir}">
553                <include name="*.jar" />
554                <include name="client/**" />
555                <include name="common/**" />
556                <include name="server/**" />
557            </fileset>
558        </copy>
559        <mkdir dir="${dist-src.dir}/lib/unused" />
560        <copy todir="${dist-src.dir}">
561            <fileset dir="${main.dir}">
562                <include name="src/**" />
563                <include name="generated-src/**" />
564                <include name="test-src/**" />
565                <include name="templates/**" />
566                <exclude name="**/*.el" />
567                <include name="legal/**" />
568                <include name="README**" />
569                <include name="INSTALL.txt" />
570                <include name="doc.properties" />
571                <include name=".project" />
572                <include name=".classpath" />
573                <include name="jetty/**" />
574                <include name="bin/*" />
575                <include name="build.xml" />
576                <include name="build.properties.template" />
577                <include name="build.sh" />
578                <include name="build.bat" />
579               
580                  <include name="webapp/**" />
581                <include name="service/**" />
582                  <include name="webapp/webclient/**" />
583                <exclude name="webapp/logs/**" />
584                <exclude name="webapp/WEB-INF/logs/**" />
585                  <exclude name="webapp/WEB-INF/data.xml.bak" />
586                <exclude name="webapp/webclient/rapla.jar" />
587           </fileset>
588        </copy>
589        <chmod perm="u+x">
590            <fileset dir="${dist-src.dir}">
591                <include name="**/*.bat" />
592                <include name="**/*.sh" />
593                <include name="bin/ant" />
594                <include name="bin/antRun" />
595            </fileset>
596        </chmod>
597    </target>
598
599
600    <!-- =================================================================== -->
601    <!-- Packages the distribution as .zip  and tar.gz                       -->
602    <!-- =================================================================== -->
603    <target name="tarball">
604        <fixcrlf srcdir="${tarball.dir}" eol="lf" eof="remove">
605            <patternset refid="text-files" />
606            <exclude name="**/*.bat" />
607        </fixcrlf>
608        <tar tarfile="${temp.dir}/tarball.tar">
609            <tarfileset dir="${tarball.dir}/..">
610                <!-- This is a workaround until tarfileset supports the prefix-->
611                <include name="${tarball.name}/**" />
612                <exclude name="${tarball.name}/**/*.sh" />
613                <exclude name="${tarball.name}/**/*.bat" />
614                <exclude name="${tarball.name}/**/ant" />
615                <exclude name="${tarball.name}/**/antRun" />
616            </tarfileset>
617            <tarfileset dir="${tarball.dir}/.." mode="755">
618                <include name="${tarball.name}/**/*.sh" />
619                <include name="${tarball.name}/**/*.bat" />
620                <include name="${tarball.name}/**/ant" />
621                <include name="${tarball.name}/**/antRun" />
622            </tarfileset>
623        </tar>
624
625        <gzip zipfile="${dist.dir}/${tarball.name}.tar.gz" src="${temp.dir}/tarball.tar" />
626        <delete file="${temp.dir}/tarball.tar" />
627
628        <fixcrlf srcdir="${tarball.dir}" eol="crlf">
629            <patternset refid="text-files" />
630            <exclude name="**/*.sh" />
631            <exclude name="**/ant" />
632            <exclude name="**/antRun" />
633        </fixcrlf>
634
635        <zip zipfile="${dist.dir}/${tarball.name}.zip">
636            <!-- This is a workaround until tarfileset supports the prefix-->
637            <zipfileset dir="${tarball.dir}" prefix="${tarball.name}" />
638        </zip>
639
640        <fixcrlf srcdir="${tarball.dir}">
641            <patternset refid="text-files" />
642        </fixcrlf>
643    </target>
644
645    <target name="tarballs" description="Generate all tarballs for download" depends="init,dist-bin,dist-src">
646        <antcall target="tarball">
647            <param name="tarball.name" value="rapla-binary-${doc.version}" />
648            <param name="tarball.dir" value="${dist-bin.dir}" />
649        </antcall>
650        <antcall target="tarball">
651            <param name="tarball.name" value="rapla-source-${doc.version}" />
652            <param name="tarball.dir" value="${dist-src.dir}" />
653        </antcall>
654    </target>
655
656    <!-- =================================================================== -->
657    <!-- Creates the API documentation                                       -->
658    <!-- =================================================================== -->
659    <target name="javadocs" depends="prepare" description="Generate the API documentation">
660        <!-- Filter-Information for the java-doc generator and the rapla-language-files-->
661        <delete dir="${build.src}" />
662        <delete dir="${build.javadocs}" />
663        <mkdir dir="${build.src}" />
664        <mkdir dir="${build.javadocs}" />
665        <copy todir="${build.src}">
666            <fileset dir="${src.dir}">
667                <include name="**/*.java" />
668                <include name="**/package.html" />
669                <include name="**/overview.html" />
670            </fileset>
671            <filterset refid="docfilter" />
672        </copy>
673        <copy file="${main.dir}/templates/javadoc.css" tofile="${build.javadocs}/javadoc.css" />
674        <copy file="${src.dir}/org/rapla/gui/images/tafel.png" tofile="${build.javadocs}/logo.png" />
675        <javadoc packagenames="${packages}" destdir="${build.javadocs}" author="true" version="true" use="false" noindex="true" windowtitle="${doc.name} API (${doc.version})" bottom="Copyright &#169; ${doc.year} ${doc.copyright}. All Rights Reseserved." stylesheetfile="${build.javadocs}/javadoc.css" overview="${build.src}/org/rapla/overview.html">
676            <packageset dir="${build.src}" defaultexcludes="yes">
677                <include name="org/rapla" />
678                <include name="org/rapla/facade" />
679                <include name="org/rapla/entities" />
680                <include name="org/rapla/entities/domain" />
681                <include name="org/rapla/entities/dynamictype" />
682                <include name="org/rapla/entities/configuration" />
683                <include name="org/rapla/framework" />
684                <include name="org/rapla/examples" />
685                <include name="org/rapla/components/xmlbundle" />
686                <include name="org/rapla/components/util" />
687                <include name="org/rapla/components/util/iterator" />
688                <include name="org/rapla/components/calendar" />
689                <include name="org/rapla/components/iolayer" />
690                <include name="org/rapla/components/layout" />
691                <include name="org/rapla/components/tablesorter" />
692                <include name="org/rapla/plugin" />
693                <include name="org/rapla/plugin/mail" />
694                <include name="org/rapla/gui" />
695                <include name="org/rapla/gui/images" />
696                <include name="org/rapla/gui/toolkit" />
697                <include name="org/rapla/examples" />
698                <include name="org/rapla/entities" />
699                <include name="org/rapla/servletpages" />
700                <exclude name="**/rpc/**" />
701                <exclude name="**/internal/**" />
702                <exclude name="**/impl/**" />
703                <exclude name="**/print/**" />
704            </packageset>
705            <classpath>
706                <fileset dir="${lib.dir}">
707                    <patternset refid="default-compile-libraries" />
708                </fileset>
709            </classpath>
710            <link href="http://java.sun.com/javase/6/docs/api/" />
711            <link href="http://excalibur.apache.org/apidocs/" />
712        </javadoc>
713    </target>
714
715    <!-- =================================================================== -->
716    <!-- Test                                                                -->
717    <!-- =================================================================== -->
718    <target name="compile-tests" depends="prepare,compile,compile-resources,generate-plugin-meta">
719        <mkdir dir="${build.test}" />
720        <javac srcdir="${testsrc.dir}" destdir="${build.test}" debug="${debug}" source="${target_vm}" target="${target_vm}" optimize="${optimize}" deprecation="${deprecation}">
721            <classpath>
722                <fileset dir="${lib.dir}">
723                    <patternset refid="default-compile-libraries" />
724                </fileset>
725                <pathelement path="${build.dest}" />
726            </classpath>
727        </javac>
728    </target>
729
730    <target name="check-test" unless="test.class">
731        <echo message="You must specify a test.class. Example: build -Dtest.class=mypackage.MyTest test " />
732    </target>
733
734    <target name="test" if="test.class" description="Run one JUnit-Test" depends="compile-tests,check-test">
735        <junit printsummary="no" haltonfailure="yes" fork="yes" dir="${main.dir}">
736            <classpath>
737                <pathelement path="${build.dest}" />
738                <pathelement path="${build.test}" />
739                <fileset dir="${lib.dir}">
740                    <patternset refid="default-compile-libraries" />
741                    <include name="test-only/*" />
742                </fileset>
743            </classpath>
744            <formatter type="plain" usefile="no" />
745            <test name="${test.class}" />
746        </junit>
747        <echo message="Tests complete" />
748    </target>
749
750    <target name="test-all" description="Run all JUnit-Tests" depends="clean-test,compile-tests">
751        <junit printsummary="no" haltonfailure="yes" fork="yes" dir="${main.dir}">
752            <classpath>
753                <pathelement path="${build.dest}" />
754                <pathelement path="${build.test}" />
755                <fileset dir="${lib.dir}">
756                    <patternset refid="default-compile-libraries" />
757                    <include name="test-only/*" />
758                </fileset>
759            </classpath>
760            <formatter type="plain" usefile="no" />
761            <batchtest>
762                <fileset dir="${build.test}">
763                    <include name="**/*Test.class" />
764                    <exclude name="**/storage/dbsql/**/*.class" unless="hsqldb.present" />
765                    <exclude name="**/*$$*Test.class" />
766                    <exclude name="**/Abstract**.class" />
767                    <exclude name="**/SunBugsTest.class" />
768                </fileset>
769            </batchtest>
770        </junit>
771        <echo message="Tests complete" />
772    </target>
773
774    <!-- ===================================================================
775       Tests the build-process of the binary and the source-distribution.
776       Performs the following steps:
777
778       1. clean the test directory
779       2. build a source-distribution in the test directory
780       3. start the test (target test-all)
781       4. build a binary-distribution out of the source-distribution
782       5. start the binary-distribution and test for exceptions
783       6. clean the test dir
784       ===================================================================  -->
785    <target name="test-build" description="Tests the build-process of the binary and the source-distribution" depends="init">
786        <delete dir="${test.dir}" />
787        <mkdir dir="${test.dir}" />
788        <mkdir dir="${test-dist-src.dir}" />
789        <ant antfile="build.xml" target="dist-src">
790            <property name="dist-src.dir" value="${test-dist-src.dir}" />
791        </ant>
792
793        <ant antfile="${test-dist-src.dir}/build.xml" target="test-all" dir="${test-dist-src.dir}" inheritAll="false">
794            <property name="main.dir" value="${test-dist-src.dir}" />
795        </ant>
796
797        <ant antfile="${test-dist-src.dir}/build.xml" target="dist-bin" dir="${test-dist-src.dir}" inheritAll="false" />
798        <ant antfile="${test-dist-src.dir}/build.xml" target="run" dir="${test-dist-src.dir}" inheritAll="false" />
799
800        <!-- frees the space requiered by testing -->
801        <delete dir="${test.dir}" />
802    </target>
803
804    <!-- =================================================================== -->
805    <!-- Cleanup                                                             -->
806    <!-- =================================================================== -->
807    <target name="clean" description="Clean the build directory" depends="init">
808        <delete dir="${build.dir}" />
809        <delete dir="${temp.dir}" />
810    </target>
811
812    <target name="clean-dist" description="Clean the dist directory" depends="init">
813        <delete dir="${dist.dir}" />
814    </target>
815
816    <target name="clean-test" depends="init">
817        <delete dir="${test.dir}" />
818    </target>
819
820</project>
Note: See TracBrowser for help on using the browser.