releasing version 2.7~beta1+ds-6
[debian/jabref.git] / build.xml
1 <?xml version="1.0"?>
2 <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3    Filename: $RCSfile$
4    Purpose:  Ant build file for Jabref.
5
6              Ant-Download: http://jakarta.apache.org/ant
7              Ant-Manual:   http://jakarta.apache.org/ant/manual/index.html
8
9              Jabref-Homepage:    http://jabref.sourceforge.net
10              Jabref@SourceForge: http://sourceforge.net/projects/jabref
11              Jabref@FreshMeat:   http://freshmeat.net
12              Jabref-CVSRoot:     :pserver:anonymous@cvs.jabref.sourceforge.net:/cvsroot/jabref
13
14              Further questions:
15                help mailing list:      must be inserted
16
17    Precondition: 1. Ant should be installed.
18                  2. JAVA_HOME environment variable contains the path to JDK1.5 or higher
19                  3. ANT_HOME environment variable contains the path to ant's home directory
20
21    Language: XML
22    Compiler: Ant
23    Authors:  Joerg K. Wegner, wegnerj@informatik.uni-tuebingen.de
24              Morten O. Alver
25    Version:  $Revision: 3362 $
26              $Date: 2010-11-10 22:22:40 +0100 (Wed, 10 Nov 2010) $
27              $Author: mortenalver $
28
29    modified:
30              23.11.2006 c.oezbek
31              - tried to fix classpath issues
32              28.07.2005 r.nagel
33              - insert dynamic build info generation (resource/build.properties)
34              - copy fonts directory, used by the new about dialog
35              - change static "version" into mainfest file into ${jabref.version}
36              09.06.2005 r.nagel
37              - bugfix, first it should be made a rebuild of the build directory
38              and then a jar should be generated from this directory
39              - take all files for the jar archive !!! FROM BUILD directory !!!
40
41 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
42
43 <project name="JabRef" default="jars" basedir=".">
44
45         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46         PROPERTY SETUP
47      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
48
49         <!-- some version information -->
50         <property name="jabref.version" value="2.7b" />
51         <property name="jabref.placeholder.version" value="@version@" />
52         <!-- used by replace task -->
53
54         <!-- Set the properties for intermediate directory -->
55         <property name="build.jar" value="JabRef-${jabref.version}.jar" />
56         <property name="build.dir" value="build" />
57         <property name="build.classes" value="${build.dir}/classes" />
58         <property name="build.tmp" value="${build.dir}/tmp" />
59         <property name="build.osx" value="${build.dir}/classes/osxadapter" />
60         <property name="build.lib" value="${build.dir}/lib" />
61         <property name="build.win" value="${build.dir}/windows" />
62         <property name="build.images" value="${build.dir}/images" />
63         <property name="build.fonts" value="${build.dir}/images/font" />
64         <property name="build.resource" value="${build.dir}/resource" />
65         <property name="build.help" value="${build.dir}/help" />
66         <property name="build.javadocs" value="${build.dir}/docs/API" />
67         <property name="build.extensions" value="${build.dir}/extensions" />
68         <property name="build.extension-javadocs" value="${build.extensions}/API" />
69         <property name="build.extension-layout" value="${build.extensions}/layout" />
70         <property name="build.openoffice.meta" value="${build.resource}/openoffice" />
71         <property name="build.tests" value="${build.dir}/tests" />
72
73         <!-- Set the properties for source directories -->
74         <property name="src.dir" value="src" />
75         <property name="src.tests" value="src/java/tests" />
76         <property name="plugin.dir" value="src/plugins/" />
77         <property name="txt.dir" value="src/txt" />
78         <property name="java.dir" value="${src.dir}/java" />
79         <property name="osx.dir" value="${src.dir}/osx" />
80         <property name="win.installer.dir" value="${src.dir}/windows/nsis" />
81         <property name="resource.dir" value="${src.dir}/resource" />
82         <property name="bin.dir" value="${src.dir}/scripts" />
83         <property name="images.dir" value="${src.dir}/images" />
84         <property name="fonts.dir" value="${src.dir}/images/font" />
85         <property name="help.dir" value="${src.dir}/help" />
86         <property name="extensions.dir" value="${src.dir}/extensions" />
87         <property name="layout.dir" value="${src.dir}/resource/layout" />
88         <property name="lib.dir" value="lib" />
89         <property name="tests.dir" value="${src.dir}/tests" />
90
91         <property name="nsis.executable" value="makensis.exe"/>
92         <property name="nsis.executable.linux" value="makensis"/>
93
94         <!-- Load user dependent properties -->
95         <!-- For instance to redefine the NSIS-compiler write 
96                 nsis.executable="d:\prog\dev\NSIS\makensis.exe"
97           -->
98         <property file="user.properties" />
99
100         <!-- win.installer can only be build under Windows if the nsis.executable is found -->
101         <condition property="is.windows">
102           <and>
103             <isset property="nsis.executable" />
104             <os family="windows" />
105           </and>
106         </condition>
107
108         <fileset id="jarsFileset" dir="${lib.dir}">
109                 <include name="antlr.jar" />
110                 <include name="antlr-3.0b5.jar" />
111                 <include name="looks-2.3.1.jar" />
112                 <include name="forms-1.1.0.jar" />
113                 <include name="spin.jar" />
114                 <include name="glazedlists-1.7.0_java15.jar" />
115                 <include name="microba.jar" />
116                 <include name="PDFBox-0.7.3-dev-reduced.jar" />
117                 <include name="JempBox-0.2.0.jar" />
118                 <include name="zoom-java.jar" />
119         <include name="mysql-connector-java-5.0.7-bin.jar" />
120         <!--<include name="substance-4.1.jar" />-->
121         <!-- Plugin runtime dependencies -->
122                 <include name="plugin/JPFCodeGenerator-rt.jar" />
123                 <include name="plugin/jpf.jar" />
124                 <include name="plugin/jpf-boot.jar" />
125                 <include name="plugin/commons-logging.jar" />
126         </fileset>
127
128         <!-- Build classpath -->
129         <path id="classpath">
130                 <pathelement path="${build.classes}" />
131                 <pathelement path="${build.dir}" />
132                 <fileset refid="jarsFileset" />
133         </path>
134
135         <!-- Classpath for running the code generator -->
136         <path id="codegenerator">
137                 <pathelement location="${lib.dir}/plugin/JPFCodeGenerator.jar" />
138                 <pathelement location="${lib.dir}/plugin/jpf.jar" />
139                 <pathelement location="${lib.dir}/plugin/jpf-boot.jar" />
140                 <pathelement location="${lib.dir}/plugin/velocity-dep-1.5.jar" />
141         </path>
142
143         <!-- Classpath for tests -->
144         <path id="classpathTest">
145                 <path refid="classpath" />
146                 <pathelement location="${lib.dir}/junit.jar" />
147         </path>
148
149         <target name="run" depends="build">
150                 <java classname="net.sf.jabref.JabRefMain" fork="true">
151                         <classpath refid="classpath" />
152                 </java>
153         </target>
154
155         <!-- Runs project -->
156         <target name="runFromJar">
157                 <java dir="${build.lib}" classname="net.sf.jabref.JabRefMain" fork="true">
158                         <classpath>
159                                 <pathelement location="${build.lib}/${build.jar}" />
160                         </classpath>
161                 </java>
162         </target>
163
164         <!-- Only rerun the code generator if plug-in xml or jars are newer than generated java file. -->
165         <uptodate property="needsNoRegenerate" targetfile="${java.dir}/net/sf/jabref/plugin/core/generated/_JabRefPlugin.java">
166                 <srcfiles dir=".">
167                         <include name="${plugin.dir}/**/plugin.xml" />
168                         <include name="${lib.dir}/plugin/*.jar" />
169                 </srcfiles>
170         </uptodate>
171
172         <!-- Run the JPF Code Generator -->
173         <target name="generate" unless="needsNoRegenerate">
174                 <java classname="net.sf.jabref.plugin.util.CodeGenerator" fork="true">
175                         <arg value="${plugin.dir}" />
176                         <classpath refid="codegenerator" />
177                 </java>
178         </target>
179
180         <!-- Compiles project excluding tests -->
181         <target name="compile" depends="generate">
182                 <mkdir dir="${build.classes}" />
183                 <javac debug="on" deprecation="on" destdir="${build.classes}" source="1.5" target="1.5">
184                         <src path="${java.dir}" />
185                         <exclude name="tests/**" />
186                         <exclude name="**/JabRefMain.java" />
187                         <classpath refid="classpath" />
188                 </javac>
189                 <javac debug="off" deprecation="on" destdir="${build.classes}" source="1.4" target="1.4">
190                         <src path="${java.dir}" />
191                         <include name="**/JabRefMain.java" />
192                 </javac>
193         </target>
194
195         <!-- Compiles project including tests -->
196         <target name="compiletest">
197                 <mkdir dir="${build.classes}" />
198                 <javac debug="on" destdir="${build.classes}" source="1.5" target="1.5">
199                         <src path="${java.dir}" />
200                         <include name="tests/**" />
201                         <classpath refid="classpathTest" />
202                 </javac>
203         </target>
204
205         <!-- Builds the OSXAdapter -->
206         <target name="osx">
207                 <mkdir dir="${build.classes}" />
208
209                 <javac srcdir="${osx.dir}" debug="off" destdir="${build.classes}" target="1.5">
210                 </javac>
211         </target>
212
213         <!-- Copies in the OSXAdapter class, which is compilable only on Mac  -->
214         <target name="non_osx">
215                 <mkdir dir="${build.osx}" />
216                 <copy file="${lib.dir}/OSXAdapter.class" todir="${build.osx}" />
217         </target>
218
219         <!-- Jars up project -->
220         <target name="jars" depends="build, unjarlib">
221                 <mkdir dir="${build.lib}" />
222                 <mkdir dir="${build.tmp}" />
223                 <jar destfile="${build.lib}/${build.jar}">
224
225                         <fileset dir="${build.classes}" />
226                         <fileset dir="${build.tmp}" />
227                         <fileset dir="${build.dir}">
228                                 <include name="images/**" />
229                                 <include name="help/**" />
230                                 <include name="help/de/**" />
231                                 <include name="help/no/**" />
232                                 <include name="resource/**" />
233                         </fileset>
234
235                         <!-- Add Plugins -->
236                         <fileset dir="${src.dir}">
237                                 <include name="plugins/**" />
238                         </fileset>
239
240                         <fileset dir="${lib.dir}">
241                                 <include name="EndNote.zip" />
242                         </fileset>
243                         <fileset dir="${txt.dir}">
244                                 <include name="gpl.txt" />
245                                 <include name="lesser.txt" />
246                                 <include name="jgoodies.txt" />
247                                 <include name="README" />
248                         </fileset>
249                         <manifest>
250                                 <attribute name="Main-Class" value="net.sf.jabref.JabRefMain" />
251                 <attribute name="Class-Path" value="." />
252                         </manifest>
253                 </jar>
254
255         </target>
256
257         <!-- copy all necessary files and insert version informations -->
258         <target name="build" depends="compile, buildinfos" description="Build project">
259
260                 <mkdir dir="${build.resource}" />
261
262                 <copy todir="${build.resource}">
263                         <fileset dir="${resource.dir}">
264                                 <include name="**" />
265                         </fileset>
266                 </copy>
267                 <mkdir dir="${build.images}" />
268                 <copy todir="${build.images}">
269                         <fileset dir="${images.dir}">
270                                 <include name="**" />
271                         </fileset>
272                 </copy>
273
274                 <mkdir dir="${build.help}" />
275                 <copy todir="${build.help}">
276                         <fileset dir="${help.dir}" />
277                 </copy>
278
279                 <!-- Insert version informations -->
280                 <replace dir="${build.help}" token="${jabref.placeholder.version}" value="${jabref.version}">
281                         <include name="**/About.html" />
282                 </replace>
283                 <replace dir="${build.openoffice.meta}" token="${jabref.placeholder.version}" value="${jabref.version}">
284                         <include name="meta.xml" />
285                 </replace>
286
287         </target>
288
289         <!-- Prepare for testing -->
290         <target name="buildtest" depends="build, compiletest" description="Build project for testing">
291
292                 <mkdir dir="${build.tests}" />
293                 <copy todir="${build.tests}">
294                         <fileset dir="${tests.dir}">
295                                 <include name="**" />
296                         </fileset>
297                 </copy>
298         </target>
299
300         <!-- generate and save some build infos !!! necessary for dynamic build infos !!! -->
301         <!-- todo : replace it by the replace task :-),
302           src/resource/build.properties = template
303           build/resource/build.properties = real info file
304         -->
305         <target name="buildinfos">
306                 <tstamp />
307                 <!-- get date -->
308                 <buildnumber />
309                 <!-- generate new build number -> build.number -->
310                 <echo message="build number = ${build.number}" />
311                 <!-- write the file, please do not edit this lines -->
312                 <echo file="${resource.dir}/build.properties">builddate=${TODAY}
313 build=${build.number}
314 version=${jabref.version}</echo>
315         </target>
316
317
318         <!-- Creates all docs -->
319         <target name="docs" depends="javadocs" description="Generates all the documentation" />
320
321         <!-- Creates javadocs -->
322         <target name="javadocs" depends="compile" description="Generates the javadocs">
323                 <mkdir dir="${build.javadocs}" />
324                 <javadoc sourcepath="${java.dir}" destdir="${build.javadocs}" author="true" version="true" windowtitle="JabRef API" link="http://java.sun.com/j2se/1.4.1/docs/api/">
325
326                         <fileset dir="${java.dir}" defaultexcludes="yes">
327                                 <include name="**/*.java" />
328                         </fileset>
329
330                         <classpath refid="classpath" />
331                 </javadoc>
332         </target>
333
334         <!-- Creates javadocs for the extensions -->
335         <target name="extension-javadocs" depends="build" description="Generates the javadocs for the extensions archive">
336                 <mkdir dir="${build.extension-javadocs}" />
337                 <copy todir="${build.extension-javadocs}">
338                         <fileset dir="${help.dir}" defaultexcludes="yes">
339                                 <include name="CustomExports.html" />
340                                 <include name="CustomImports.html" />
341                         </fileset>
342                 </copy>
343
344                 <javadoc sourcepath="${java.dir}" destdir="${build.extension-javadocs}" author="true" version="true" windowtitle="JabRef-Extensions API" link="http://java.sun.com/j2se/1.4.1/docs/api/" Overview="${extensions.dir}/API/overview.html" access="protected">
345                         <!-- 
346                  create javadoc only selectively for classes that 
347                  users extending JabRef are likely to use
348               -->
349                         <fileset dir="${java.dir}" defaultexcludes="yes">
350                                 <include name="net/sf/jabref/imports/ImportFormat.java" />
351                                 <include name="net/sf/jabref/imports/ImportFormatReader.java" />
352                                 <include name="net/sf/jabref/BibtexEntry.java" />
353                                 <include name="net/sf/jabref/BibtexEntryType.java" />
354                                 <include name="net/sf/jabref/AuthorList.java" />
355                                 <include name="net/sf/jabref/AuthorList.java" />
356                                 <include name="net/sf/jabref/export/layout/LayoutFormatter.java" />
357                         </fileset>
358
359                         <classpath refid="classpath" />
360                 </javadoc>
361         </target>
362
363         <!-- Creates javadocs for the extensions -->
364         <target name="extensions" depends="extension-javadocs" description="Generates the extensions archive">
365                 <!-- copy examples -->
366                 <copy todir="${build.extensions}">
367                         <fileset dir="${java.dir}">
368                                 <include name="net/sf/jabref/export/layout/format/CurrentDate.java" />
369                                 <include name="net/sf/jabref/export/layout/format/ToLowerCase.java" />
370                                 <include name="net/sf/jabref/export/layout/format/HTMLChars.java" />
371                                 <include name="net/sf/jabref/imports/*Importer.java" />
372                         </fileset>
373                 </copy>
374                 <mkdir dir="${build.extension-layout}" />
375                 <copy todir="${build.extension-layout}">
376                         <fileset dir="${layout.dir}" />
377                 </copy>
378                 <copy todir="${build.extensions}">
379                         <fileset dir="${extensions.dir}" />
380                         <filterset>
381                                 <filter token="version" value="${jabref.version}" />
382                         </filterset>
383                 </copy>
384                 <!-- create extensions-zip file -->
385                 <zip destfile="${build.dir}/jabref-extensions.zip">
386                         <zipfileset dir="${build.extensions}" prefix="jabref-extensions" />
387                 </zip>
388         </target>
389
390         <target name="clean" depends="win.installer.clean" description="Clean project">
391                 <delete dir="${build.dir}" />
392         </target>
393
394         <!-- Unpacks jar needed jar files from lib directory into temp directory. -->
395         <target name="unjarlib" description="Unpacks jars from library">
396                 <mkdir dir="${build.tmp}" />
397                 <unjar dest="${build.tmp}">
398                         <fileset refid="jarsFileset" />
399                 </unjar>
400                 <delete dir="${build.tmp}/META-INF" />
401                 <!-- rename the microba license file -->
402                 <move file="${build.tmp}/license.txt" tofile="${build.tmp}/microba-license.txt" />
403         </target>
404
405
406         <target name="osxjar">
407                 <jarbundler dir="${build.lib}"
408                     name="JabRef"
409                     mainclass="net.sf.jabref.JabRef"
410                     jars="${build.lib}/${build.jar}"
411                     icon="${images.dir}/JabRef-Logo.icns"
412                     version="${jabref.version}"
413                     jvmversion="1.4+"
414                     stubfile="${lib.dir}/JavaApplicationStub"
415                     signature="JABr">
416             <documenttype name="BibTeX file" extensions="bib" role="Editor"
417                           iconFile="${images.dir}/JabRef-Logo.icns"/>
418         </jarbundler>
419         </target>
420
421
422         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
423         <!-- Build Windows Installer                                                    -->
424         <!--                                                                            -->
425         <!-- Don't forget to set nsis.executable property                               -->
426         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
427
428         <target name="win.installer.clean" description="Delete Installer and Exe-Wrapper + Temp-files">
429                 <delete failonerror="false" dir="${win.installer.dir}/dist" />
430                 <delete file="${win.installer.dir}/JabRefSetup.exe" />
431         </target>
432
433         <target name="win.installer" description="Copy files in place to be used by the installer" depends="jars">
434
435                 <fail unless="is.windows" message="Not running on windows or NSIS not found. Please make sure that user.properties exists" />
436
437                 <!-- Gather everything that will go into the installer in dist -->
438                 <mkdir dir="${win.installer.dir}/dist" />
439
440                 <copy file="${build.lib}/${build.jar}" todir="${win.installer.dir}/dist" />
441
442                 <available property="win.installer.jar.available" file="${win.installer.dir}/dist/${build.jar}" />
443
444                 <fail unless="win.installer.jar.available" message="Did not find jar: ${build.jar}" />
445
446                 <copy todir="${win.installer.dir}/dist">
447                         <fileset dir="${txt.dir}">
448                                 <include name="gpl.txt" />
449                                 <include name="lesser.txt" />
450                                 <include name="README" />
451                         </fileset>
452                 </copy>
453
454                 <!-- "Create Exe-Wrapper" -->
455                 <exec dir="." executable="${nsis.executable}" failonerror="true">
456                   <arg line="'/DJARFILE=${build.jar}' '/DVERSION=${jabref.version}' '/DAPPICON=../../../${images.dir}/JabRef.ico' ${win.installer.dir}/launcher.nsi" />
457                 </exec>
458
459                 <!-- Finally create Windows-Installer -->
460                 <exec dir="." executable="${nsis.executable}" failonerror="true">
461                         <arg line="'/DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
462                 </exec>
463
464                 <delete dir="${win.installer.dir}/dist" />
465
466         </target>
467
468         <target name="win.installer.linux" description="Copy files in place to be used by the installer" depends="jars">
469
470                 <!-- Gather everything that will go into the installer in dist -->
471                 <mkdir dir="${win.installer.dir}/dist" />
472
473                 <copy file="${build.lib}/${build.jar}" todir="${win.installer.dir}/dist" />
474
475                 <available property="win.installer.jar.available" file="${win.installer.dir}/dist/${build.jar}" />
476
477                 <fail unless="win.installer.jar.available" message="Did not find jar: ${build.jar}" />
478
479                 <copy todir="${win.installer.dir}/dist">
480                         <fileset dir="${txt.dir}">
481                                 <include name="gpl.txt" />
482                                 <include name="lesser.txt" />
483                                 <include name="README" />
484                         </fileset>
485                 </copy>
486
487                 <!-- "Create Exe-Wrapper" -->
488                 <exec dir="." executable="${nsis.executable.linux}" failonerror="true">
489                   <arg line="'-DJARFILE=${build.jar}' '-DVERSION=${jabref.version}' '-DAPPICON=../../../${images.dir}/JabRef.ico' ${win.installer.dir}/launcher.nsi" />
490                 </exec>
491
492                 <!-- Finally create Windows-Installer -->
493                 <exec dir="." executable="${nsis.executable.linux}" failonerror="true">
494                         <arg line="'-DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
495                 </exec>
496
497                 <delete dir="${win.installer.dir}/dist" />
498
499         </target>
500
501         <target name="test" depends="buildtest" description="Runs all unit tests">
502                 <java fork="yes" classname="junit.textui.TestRunner" failonerror="true">
503                         <arg value="tests.net.sf.jabref.AllTests" />
504                         <classpath refid="classpathTest" />
505                 </java>
506         </target>
507
508
509         <!--+++++++++++++++++++++++++++++++++++++++++++++++++
510            Auxiliary targets
511           +++++++++++++++++++++++++++++++++++++++++++++++++-->
512
513         <target name="profile" depends="jars" description="Profile JabRef">
514                 <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
515
516                 <nbprofiledirect>
517                         <classpath refid="classpath" />
518                 </nbprofiledirect>
519
520                 <property environment="env" />
521                 <java fork="true" classname="net.sf.jabref.JabRef" dir="${build.dir}" jvm="${profiler.info.jvm}">
522                         <jvmarg value="${profiler.info.jvmargs.agent}" />
523                         <jvmarg line="${profiler.info.jvmargs}" />
524                         <env key="LD_LIBRARY_PATH" path="${profiler.info.agentpath}:${env.LD_LIBRARY_PATH}" />
525                         <classpath refid="classpath" />
526                 </java>
527         </target>
528
529         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
530         What's about the software design ?!;-)
531     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
532
533         <target name="pmd" description="SOFTWAREDESIGN: Project Mess Detector !;-)">
534                 <echo>Checking Project Mess Detection (PMD) rulesets.</echo>
535                 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
536                         <classpath>
537                                 <pathelement path="${classpath}" />
538                                 <fileset dir="${lib.dir}">
539                                         <include name="*.jar" />
540                                 </fileset>
541                         </classpath>
542                 </taskdef>
543                 <!-- allowed Pretty Much Done rulsets -->
544                 <!-- rulesets/basic.xml -->
545                 <!-- rulesets/braces.xml -->
546                 <!-- rulesets/codesize.xml-->
547                 <!-- rulesets/controversial.xml-->
548                 <!-- rulesets/coupling.xml-->
549                 <!-- rulesets/design.xml -->
550                 <!-- rulesets/experimental.xml -->
551                 <!-- rulesets/favorites.xml -->
552                 <!-- rulesets/imports.xml -->
553                 <!-- rulesets/naming.xml -->
554                 <!-- rulesets/javabean.xml -->
555                 <!-- rulesets/junit.xml -->
556                 <!-- rulesets/scratchpad.xml -->
557                 <!-- rulesets/strictexception.xml -->
558                 <!-- rulesets/strings.xml -->
559                 <!-- rulesets/unusedcode.xml -->
560
561                 <pmd rulesetfiles="rulesets/unusedcode.xml,rulesets/basic.xml" failonerror="no">
562                         <formatter type="html" toFile="${build.dir}/pmd_report.html" />
563                         <fileset dir="${src.dir}">
564                                 <include name="**/*.java" />
565                         </fileset>
566                 </pmd>
567
568                 <!-- check for duplicated code -->
569                 <echo>WARNING: use environment variable: ANT_OPTS=-Xmx512m or this task will fail.</echo>
570                 <echo>Checking for duplicated code using the Copy/Paste Detector (CPD).</echo>
571                 <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask">
572                         <classpath>
573                                 <pathelement path="${classpath}" />
574                                 <fileset dir="${lib.dir}">
575                                         <include name="*.jar" />
576                                 </fileset>
577                         </classpath>
578                 </taskdef>
579                 <cpd format="text" minimumTokenCount="100" outputFile="${build.dir}/duplicated_code_report.txt">
580                         <fileset dir="${src.dir}">
581                                 <include name="**/*.java" />
582                         </fileset>
583                 </cpd>
584         </target>
585
586
587         <target name="javancss" description="SOFTWAREDESIGN: Determining the NCSS and CCN code metrics for JOELib.">
588                 <taskdef name="javancss" classname="javancss.JavancssAntTask">
589                         <classpath>
590                                 <pathelement path="${classpath}" />
591                                 <fileset dir="${lib.dir}">
592                                         <include name="*.jar" />
593                                 </fileset>
594                         </classpath>
595                 </taskdef>
596                 <echo>Cyclomatic
597 Complexity             Ease of       Risk
598 Number (CCN)           maintenance
599 (McCabe metric)
600 ---------------------------------------------
601 1-10, simple           easy          minimum
602 11-20, complex         moderate      moderate
603 21-50, more complex    hard          high
604 >50, unstable          very hard     very high
605
606 </echo>
607                 <javancss srcdir="${src.dir}" includes="**/*.java" excludes="jama/**/*.java, jmat/**/*.java, cformat/**/*.java" abortOnFail="false" ccnPerFuncMax="30" generateReport="true" outputfile="${build.dir}/javancss_report.plain" format="plain" packageMetrics="true" classMetrics="false" functionMetrics="false" />
608         </target>
609
610         <target name="jalopy" description="SOFTWAREDESIGN: source code formatter using the JOELib convention.">
611                 <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
612                         <classpath>
613                                 <pathelement path="${classpath}" />
614                                 <fileset dir="${lib.dir}">
615                                         <include name="*.jar" />
616                                 </fileset>
617                         </classpath>
618                 </taskdef>
619                 <jalopy fileformat="unix" convention="${src.dir}/java/jalopy.format.convention.xml" history="file" historymethod="adler32" loglevel="error" threads="2" classpathref="classpath" backup="bak">
620                         <fileset dir="${src.dir}">
621                                 <include name="java/net/sf/jabref/**/*.java" />
622                         </fileset>
623                 </jalopy>
624         </target>
625
626         <taskdef name="jarbundler" classpath="${lib.dir}/jarbundler-2.1.0.jar" classname="net.sourceforge.jarbundler.JarBundler" />
627
628 </project>