source: josm/trunk/build.xml @ 7351

Last change on this file since 7351 was 7351, checked in by Don-vip, 9 years ago

fix #10325 - WMS not working if JOSM compiled with dist-optimized:

  • fix build
  • update to Proguard 4.11
  • disable "Sun internal API" warnings introduced recently
File size: 25.8 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!-- ** build.xml - main ant file for JOSM
3**
4** To build run
5**    ant clean
6**    ant dist
7** This will create 'josm-custom.jar' in directory 'dist'. See also
8**   https://josm.openstreetmap.de/wiki/DevelopersGuide/CreateBuild
9**
10-->
11<project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
12    <property name="test.dir" location="test"/>
13    <property name="src.dir" location="src"/>
14    <property name="build.dir" location="build"/>
15    <property name="javacc.home" location="tools"/>
16    <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
17    <property name="imagerytypes.dir" location="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
18    <!-- build parameter: compression level (ant -Dclevel=N)
19             N ranges from 0 (no compression) to 9 (maximum compression)
20             default: 9 -->
21    <condition property="clevel" value="${clevel}" else="9">
22        <isset property="clevel"/>
23    </condition>
24    <!-- For Windows-specific stuff -->
25    <condition property="isWindows">
26        <os family="Windows"/>
27    </condition>
28    <!-- Java classpath addition (all jar files to compile tests with this) -->
29    <path id="classpath">
30        <fileset dir="lib">
31            <include name="**/*.jar"/>
32        </fileset>
33    </path>
34
35    <!--
36      ** Used by Eclipse ant builder for updating
37      ** the REVISION file used by JOSM
38    -->
39    <target name="create-revision-eclipse">
40        <property name="revision.dir" value="bin"/>
41        <antcall target="create-revision"/>
42    </target>
43    <!--
44      ** Initializes the REVISION.XML file from SVN information
45    -->
46    <target name="init-svn-revision-xml">
47        <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false" resultproperty="svn.info.result">
48            <env key="LANG" value="C"/>
49            <arg value="info"/>
50            <arg value="--xml"/>
51            <arg value="."/>
52        </exec>
53        <condition property="svn.info.success">
54            <equals arg1="${svn.info.result}" arg2="0" />
55        </condition>
56    </target>
57    <!--
58      ** Initializes the REVISION.XML file from git information
59    -->
60    <target name="init-git-revision-xml" unless="svn.info.success">
61        <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false">
62            <arg value="log"/>
63            <arg value="-1"/>
64            <arg value="--grep=git-svn-id"/>
65            <!--
66            %B:  raw body (unwrapped subject and body)
67            %n:  new line
68            %ai: author date, ISO 8601 format
69            -->
70            <arg value="--pretty=format:%B%n%ai"/>
71            <arg value="HEAD"/>
72        </exec>
73        <replaceregexp file="REVISION.XML" flags="s"
74                       match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
75                       replace="&lt;info&gt;&lt;entry&gt;&lt;commit revision=&quot;\1&quot;&gt;&lt;date&gt;\2&lt;/date&gt;&lt;/commit&gt;&lt;/entry&gt;&lt;/info&gt;"/>
76    </target>
77    <!--
78      ** Creates the REVISION file to be included in the distribution
79    -->
80    <target name="create-revision" depends="init-svn-revision-xml, init-git-revision-xml">
81        <property name="revision.dir" value="${build.dir}"/>
82        <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
83        <delete file="REVISION.XML"/>
84        <tstamp>
85            <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
86        </tstamp>
87        <property name="version.entry.commit.revision" value="UNKNOWN"/>
88        <property name="version.entry.commit.date" value="UNKNOWN"/>
89        <mkdir dir="${revision.dir}"/>
90        <!-- add Build-Name: ... when making special builds, e.g. DEBIAN -->
91        <echo file="${revision.dir}/REVISION">
92# automatically generated by JOSM build.xml - do not edit
93Revision: ${version.entry.commit.revision}
94Is-Local-Build: true
95Build-Date: ${build.tstamp}
96</echo>
97    </target>
98    <!--
99      ** Check internal XML files against their XSD
100    -->
101    <target name="check-schemas" unless="check-schemas.notRequired">
102        <schemavalidate file="data/defaultpresets.xml" >
103            <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="data/tagging-preset.xsd" />
104        </schemavalidate>
105    </target>
106    <!--
107      ** Main target that builds JOSM and checks XML against schemas
108    -->
109    <target name="dist" depends="compile,create-revision,check-schemas">
110        <echo>Revision ${version.entry.commit.revision}</echo>
111        <copy file="CONTRIBUTION" todir="build"/>
112        <copy file="README" todir="build"/>
113        <copy file="LICENSE" todir="build"/>
114        <!-- create josm-custom.jar -->
115        <delete file="dist/josm-custom.jar"/>
116        <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
117            <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
118            <manifest>
119                <attribute name="Main-class" value="JOSM"/>
120                <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
121                <attribute name="Main-Date" value="${version.entry.commit.date}"/>
122                <attribute name="Permissions" value="all-permissions"/>
123                <attribute name="Codebase" value="josm.openstreetmap.de"/>
124                <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
125            </manifest>
126            <zipfileset dir="images" prefix="images"/>
127            <zipfileset dir="data" prefix="data"/>
128            <zipfileset dir="styles" prefix="styles"/>
129            <zipfileset dir="${src.dir}/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
130            <!-- All jar files necessary to run only JOSM (no tests) -->
131            <!-- <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar"/>  -->
132            <!-- <zipfileset src="lib/signpost-core-1.2.1.1.jar"/> -->
133        </jar>
134    </target>
135    <!-- Mac OS X target -->
136    <target name="mac">
137        <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
138        <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="tools/appbundler-1.0ea.jar"/>
139        <!-- create MacOS X application bundle -->
140        <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
141                   mainclassname="org.openstreetmap.josm.gui.MainApplication"
142                   copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
143                   applicationCategory="public.app-category.utilities"
144                   shortversion="${version.entry.commit.revision} SVN"
145                   version="${version.entry.commit.revision} SVN"
146                   icon="macosx/JOSM.app/Contents/Resources/JOSM.icns"
147                   highResolutionCapable="true">
148
149            <arch name="x86_64"/>
150            <arch name="i386"/>
151
152            <classpath file="${bundle.jar}"/>
153
154            <option value="-Xmx1024m"/>
155
156            <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
157            <option value="-Xdock:name=JOSM"/>
158
159            <!-- OSX specific options, optional -->
160            <option value="-Dapple.laf.useScreenMenuBar=true"/>
161            <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
162            <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
163            <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
164            <option value="-Dcom.apple.smallTabs=true"/>
165        </bundleapp>
166       
167        <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
168        <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/>
169       
170        <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
171                <!-- remove empty CFBundleDocumentTypes definition -->
172                <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/>
173            <!-- insert our own keys -->
174            <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" />
175        </xmltask>
176       
177        <!-- create ZIP file with MacOS X application bundle -->
178        <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
179            <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
180            <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
181        </zip>
182    </target>
183    <target name="distmac" depends="dist">
184        <antcall target="mac">
185            <param name="bundle.outdir" value="dist"/>
186            <param name="bundle.jar" value="dist/josm-custom.jar"/>
187        </antcall>
188    </target>
189    <target name="javacc" depends="init" unless="javacc.notRequired">
190        <mkdir dir="${mapcss.dir}/parsergen"/>
191        <exec append="false" executable="java" failifexecutionfails="true">
192            <arg value="-cp"/>
193            <arg value="${javacc.home}/javacc.jar"/>
194            <arg value="javacc"/>
195            <arg value="-DEBUG_PARSER=false"/>
196            <arg value="-DEBUG_TOKEN_MANAGER=false"/>
197            <arg value="-JDK_VERSION=1.7"/>
198            <arg value="-GRAMMAR_ENCODING=UTF-8"/>
199            <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
200            <arg value="${mapcss.dir}/MapCSSParser.jj"/>
201        </exec>
202    </target>
203    <target name="-jaxb_win" if="isWindows">
204        <property name="xjc" value="${java.home}\..\bin\xjc.exe" />
205    </target>
206    <target name="-jaxb_nix" unless="isWindows">
207        <property name="xjc" value="${java.home}/../bin/xjc" />
208    </target>
209    <target name="jaxb" depends="init, -jaxb_win, -jaxb_nix" unless="jaxb.notRequired">
210        <exec executable="${xjc}" failonerror="true">
211            <arg value="-d"/>
212            <arg value="${src.dir}"/>
213            <arg value="-encoding"/>
214            <arg value="UTF-8"/>
215            <arg value="data_nodist/wms-cache.xsd"/>
216        </exec>
217    </target>
218    <target name="compile" depends="init,javacc,jaxb">
219        <!-- COTS -->
220        <javac srcdir="${src.dir}" includes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**" nowarn="on"
221            destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="iso-8859-1">
222            <!-- get rid of "internal proprietary API" warning -->
223            <compilerarg value="-XDignore.symbol.file"/>
224        </javac>
225        <!-- JMapViewer/JOSM -->
226        <javac srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java" 
227            destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
228            <compilerarg value="-Xlint:cast"/>
229            <compilerarg value="-Xlint:deprecation"/>
230            <compilerarg value="-Xlint:dep-ann"/>
231            <compilerarg value="-Xlint:divzero"/>
232            <compilerarg value="-Xlint:empty"/>
233            <compilerarg value="-Xlint:finally"/>
234            <compilerarg value="-Xlint:overrides"/>
235            <!--<compilerarg value="-Xlint:rawtypes"/>-->
236            <compilerarg value="-Xlint:static"/>
237            <compilerarg value="-Xlint:try"/>
238            <compilerarg value="-Xlint:unchecked"/>
239                <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
240            <compilerarg value="-XDignore.symbol.file"/>
241        </javac>
242        <copy todir="build" failonerror="no" includeemptydirs="no">
243            <fileset dir="resources"/>
244        </copy>
245    </target>
246    <target name="init">
247        <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
248            <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
249        </uptodate>
250        <uptodate property="jaxb.notRequired" targetfile="${src.dir}/org/openstreetmap/josm/data/imagery/types/package-info.java" >
251            <srcfiles dir="data_nodist" includes="wms-cache.xsd"/>
252        </uptodate>
253        <mkdir dir="build"/>
254        <mkdir dir="dist"/>
255    </target>
256    <target name="javadoc">
257        <javadoc destdir="javadoc" 
258                sourcepath="${src.dir}"
259                encoding="UTF-8"   
260                packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
261                windowtitle="JOSM"
262                use="true"
263                private="true"
264                linksource="true"
265                author="false">
266            <link href="http://docs.oracle.com/javase/7/docs/api"/>
267            <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
268            <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
269        </javadoc>
270    </target>
271    <target name="clean">
272        <delete dir="build"/>
273        <delete dir="dist"/>
274        <delete dir="${mapcss.dir}/parsergen"/>
275        <delete dir="${imagerytypes.dir}"/>
276    </target>
277    <path id="test.classpath">
278        <fileset dir="${test.dir}/lib">
279            <include name="**/*.jar"/>
280        </fileset>
281        <fileset dir="lib">
282            <include name="**/*.jar"/>
283        </fileset>
284        <pathelement path="dist/josm-custom.jar"/>
285        <pathelement path="tools/groovy-all-2.3.4.jar"/>
286    </path>
287    <macrodef name="init-test-preferences">
288        <attribute name="testfamily"/>
289        <sequential>
290            <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
291            <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
292            <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
293        </sequential>
294    </macrodef>
295    <target name="test-init">
296        <mkdir dir="${test.dir}/build"/>
297        <mkdir dir="${test.dir}/build/unit"/>
298        <mkdir dir="${test.dir}/build/functional"/>
299        <mkdir dir="${test.dir}/build/performance"/>
300        <mkdir dir="${test.dir}/report"/>
301        <init-test-preferences testfamily="unit"/>
302        <init-test-preferences testfamily="functional"/>
303        <init-test-preferences testfamily="performance"/>
304    </target>
305    <target name="test-clean">
306        <delete dir="${test.dir}/build"/>
307        <delete dir="${test.dir}/report"/>
308        <delete file="${test.dir}/jacoco.exec" />
309        <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
310        <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
311        <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
312        <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
313        <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
314        <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
315    </target>
316    <macrodef name="call-groovyc">
317        <attribute name="testfamily"/>
318        <element name="cp-elements"/>
319        <sequential>
320            <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
321                <classpath>
322                    <cp-elements/>
323                </classpath>
324                <javac target="1.7" source="1.7" debug="on">
325                    <compilerarg value="-Xlint:all"/>
326                    <compilerarg value="-Xlint:-serial"/>
327                </javac>
328            </groovyc>
329        </sequential>
330    </macrodef>
331    <target name="test-compile" depends="test-init,dist">
332        <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.3.4.jar"/>
333        <call-groovyc testfamily="unit">
334            <cp-elements>
335                <path refid="test.classpath"/>
336            </cp-elements>
337        </call-groovyc>
338        <call-groovyc testfamily="functional">
339            <cp-elements>
340                <path refid="test.classpath"/>
341                <pathelement path="${test.dir}/build/unit"/>
342            </cp-elements>
343        </call-groovyc>
344        <call-groovyc testfamily="performance">
345            <cp-elements>
346                <path refid="test.classpath"/>
347                <pathelement path="${test.dir}/build/unit"/>
348            </cp-elements>
349        </call-groovyc>
350    </target>
351    <macrodef name="call-junit">
352        <attribute name="testfamily"/>
353        <sequential>
354            <echo message="Running @{testfamily} tests with JUnit"/>
355            <jacoco:coverage destfile="${test.dir}/jacoco.exec">
356                <junit printsummary="yes" fork="true" forkmode="once">
357                    <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
358                    <sysproperty key="josm.test.data" value="${test.dir}/data"/>
359                    <sysproperty key="java.awt.headless" value="true"/>
360                    <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
361                    <classpath>
362                        <path refid="test.classpath"/>
363                        <pathelement path="${test.dir}/build/unit"/>
364                        <pathelement path="${test.dir}/build/@{testfamily}"/>
365                        <pathelement path="${test.dir}/config"/>
366                    </classpath>
367                    <formatter type="plain"/>
368                    <formatter type="xml"/>
369                    <batchtest fork="yes" todir="${test.dir}/report">
370                        <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
371                    </batchtest>
372                </junit>
373            </jacoco:coverage>
374        </sequential>
375    </macrodef>
376    <target name="test" depends="test-compile" 
377        description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
378        <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
379        <call-junit testfamily="unit"/>
380        <call-junit testfamily="functional"/>
381        <call-junit testfamily="performance"/>
382    </target>
383    <target name="test-html" depends="test" description="Generate HTML test reports">
384        <!-- May require additional ant dependencies like ant-trax package -->
385        <junitreport todir="${test.dir}/report">
386            <fileset dir="${test.dir}/report">
387                <include name="TEST-*.xml"/>
388            </fileset>
389            <report todir="${test.dir}/report/html"/>
390        </junitreport>
391        <jacoco:report>
392            <executiondata>
393                <file file="${test.dir}/jacoco.exec"/>
394            </executiondata>
395            <structure name="JOSM Test Coverage">
396                <classfiles>
397                    <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
398                </classfiles>
399                <sourcefiles encoding="UTF-8">
400                    <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
401                </sourcefiles>
402            </structure>
403            <html destdir="${test.dir}/report/jacoco"/>
404        </jacoco:report>
405    </target>
406    <target name="dist-optimized" depends="dist">
407        <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
408        <proguard>
409                -injars dist/josm-custom.jar
410                -outjars dist/josm-custom-optimized.jar
411
412                -libraryjars ${java.home}/lib/rt.jar
413                -libraryjars ${java.home}/lib/jce.jar
414
415                -dontoptimize
416                -dontobfuscate
417
418                # These options probably are not necessary (and make processing a bit slower)
419                -dontskipnonpubliclibraryclasses
420                -dontskipnonpubliclibraryclassmembers
421
422                -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
423                    public static void main(java.lang.String[]);
424                }
425                -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
426
427                -keep class JOSM
428                -keep class * extends org.openstreetmap.josm.io.FileImporter
429                -keep class * extends org.openstreetmap.josm.io.FileExporter
430                -keep class org.w3._2001.xmlschema.Adapter1
431                -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
432
433                -keepclassmembers enum  * {
434                    public static **[] values();
435                    public static ** valueOf(java.lang.String);
436                }
437
438                # Keep unused public methods (can be useful for plugins)
439                -keepclassmembers class * {
440                    public protected *;
441                }
442
443                # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
444                # This note should not be a problem as we don't use obfuscation
445                -dontnote
446        </proguard>
447    </target>
448    <target name="check-plugins" depends="dist-optimized">
449        <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
450        <local name="dir"/>
451        <local name="plugins"/>
452        <property name="dir" value="plugin-check"/>
453        <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
454            <classpath path="tools/animal-sniffer-ant-tasks-1.8.jar"/>
455        </typedef>
456        <mkdir dir="${dir}"/>
457        <!-- List of deprecated plugins -->
458        <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
459            <filterchain>
460                <linecontains>
461                    <contains value="new DeprecatedPlugin("/>
462                </linecontains>
463                <tokenfilter>
464                    <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
465                </tokenfilter>
466                <striplinebreaks/>
467                <tokenfilter>
468                    <replaceregex pattern="\|$" replace="" flags="gi"/>
469                </tokenfilter>
470            </filterchain>
471        </loadfile>
472        <!-- Download list of plugins -->
473        <loadresource property="plugins">
474            <url url="https://josm.openstreetmap.de/plugin"/>
475            <filterchain>
476                <linecontainsregexp negate="true">
477                    <regexp pattern="^\t.*"/>
478                </linecontainsregexp>
479                <linecontainsregexp negate="true">
480                    <regexp pattern="${deprecated-plugins}"/>
481                </linecontainsregexp>
482                <tokenfilter>
483                    <replaceregex pattern="^.*;" replace="" flags="gi"/>
484                </tokenfilter>
485            </filterchain>
486        </loadresource>
487        <!-- Delete files that are not in plugin list (like old plugins) -->
488        <loadresource property="file-list">
489            <propertyresource name="plugins"/>
490            <filterchain>
491                <tokenfilter>
492                    <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
493                </tokenfilter>
494                <striplinebreaks/>
495                <tokenfilter>
496                    <replaceregex pattern="\|$" replace="" flags="gi"/>
497                </tokenfilter>   
498            </filterchain>
499        </loadresource>
500        <delete>
501            <restrict>
502                <fileset dir="${dir}"/>
503                <not>
504                    <name regex="${file-list}"/>
505                </not>
506            </restrict>
507        </delete>
508        <!-- Download plugins -->
509        <copy todir="${dir}" flatten="true">
510            <resourcelist>
511                <string value="${plugins}"/>
512            </resourcelist>
513        </copy>
514        <!-- Check plugins -->
515        <as:build-signatures destfile="${dir}/api.sig">
516            <path>
517                <fileset file="dist/josm-custom-optimized.jar"/>
518                <fileset file="${java.home}/lib/rt.jar"/>
519                <fileset file="${java.home}/lib/jce.jar"/>
520            </path>
521        </as:build-signatures>
522        <as:check-signature signature="${dir}/api.sig">
523            <ignore classname="org.jgraph.*"/>
524            <ignore classname="com.touchgraph.*"/>
525            <ignore classname="com.sun.xml.fastinfoset.*"/>
526            <ignore classname="javax.jms.*"/>
527            <ignore classname="org.jvnet.staxex.*"/>
528            <ignore classname="javax.mail.*"/>
529            <ignore classname="com.sun.jdmk.*"/>
530            <ignore classname="org.apache.avalon.framework.logger.Logger"/>
531            <ignore classname="org.apache.log.*"/>
532            <ignore classname="junit.*"/>
533            <path path="${dir}"/>
534        </as:check-signature>
535    </target>
536
537    <target name="findbugs" depends="dist">
538        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
539        <path id="findbugs-classpath">
540            <fileset dir="tools/findbugs/">
541                <include name="*.jar"/>
542            </fileset>
543        </path>
544        <property name="findbugs-classpath" refid="findbugs-classpath"/>
545        <findbugs output="xml"
546                outputFile="findbugs-josm.xml"
547                classpath="${findbugs-classpath}"
548                pluginList=""
549                excludeFilter="tools/findbugs/josm-filter.xml"
550                effort="max"
551                >
552            <sourcePath path="${basedir}/src" />
553            <class location="${basedir}/dist/josm-custom.jar" />
554        </findbugs>
555    </target>
556    <target name="run" depends="dist">
557        <java jar="dist/josm-custom.jar" fork="true">
558            <arg value="--set=expert=true"/>
559            <arg value="--set=remotecontrol.enabled=true"/>
560            <arg value="--set=debug.edt-checker.enable=false"/>
561            <jvmarg value="-Djosm.home=/tmp/.josm/"/>
562        </java>
563    </target>
564
565</project>
Note: See TracBrowser for help on using the repository browser.