source: josm/trunk/build.xml @ 8526

Last change on this file since 8526 was 8526, checked in by wiktorn, 4 years ago

Introduce WMS layer based on TMS. (closes: #11255)

HEADS UP: After this patch you need to manually remove JAX-B generated file/class: org/w3/_2001/xmlschema/Adapter1.java to compile the tree again.

  • create AbstractTileSourceLayer based on TMSLayer as a base for TMS, WMS and (future) WMTS layers, (addresses #11459)
  • WMS layer now uses JCS Caching (closes: #7363)
  • introduce new conversion methods in TileSource, that convert both X and Y (lat and lon) in one call. This is necessary for other than PseudoMercator projections
    • introduce TileXY class that represents X and Y indexes of tile in tile matrix/space
    • mark old conversion methods as deprecated
    • refactor JMapViewer and JOSM to new methods
    • change use of Coordinate class to ICoordinate where appropiate
  • extract CachedAttributionBingAerialTileSource to separate file
  • create TemplatedWMSTileSource that provides the WMS Layer with square (according to current projection) tiles (closes: #11572, closes: #7682, addresses: #5454)
  • implemented precaching imagery along GPX track for AbstractTileSourceLayer, so now it work for both - WMS and TMS (closes: #9154)
  • implemented common righ-click menu on map view, as well on layer list (closes #3591)
  • create separate build commands for JMapViewer classes to easily spot, when josm classes are used within JMapViewer
  • remove unnecessary classes of previous WMS implementation - GeorefImage, wms-cache.xsd (and JAXB task from build), WMSCache, WMSRequest, WMSGrabber, HTMLGrabber, WMSException
File size: 29.3 KB
RevLine 
[4166]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
[7133]7** This will create 'josm-custom.jar' in directory 'dist'. See also
[7183]8**   https://josm.openstreetmap.de/wiki/DevelopersGuide/CreateBuild
[4166]9**
10-->
[6133]11<project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
[4252]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"/>
[7133]17    <property name="imagerytypes.dir" location="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
[4166]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>
[7209]24    <!-- For Windows-specific stuff -->
25    <condition property="isWindows">
26        <os family="Windows"/>
27    </condition>
[4252]28
[4166]29    <!--
[6133]30      ** Used by Eclipse ant builder for updating
31      ** the REVISION file used by JOSM
32    -->
[4166]33    <target name="create-revision-eclipse">
34        <property name="revision.dir" value="bin"/>
35        <antcall target="create-revision"/>
36    </target>
37    <!--
[6540]38      ** Initializes the REVISION.XML file from SVN information
[6133]39    -->
[6545]40    <target name="init-svn-revision-xml">
[6585]41        <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false" resultproperty="svn.info.result">
[4166]42            <env key="LANG" value="C"/>
43            <arg value="info"/>
44            <arg value="--xml"/>
45            <arg value="."/>
46        </exec>
[6585]47        <condition property="svn.info.success">
48            <equals arg1="${svn.info.result}" arg2="0" />
49        </condition>
[6540]50    </target>
51    <!--
52      ** Initializes the REVISION.XML file from git information
53    -->
[6585]54    <target name="init-git-revision-xml" unless="svn.info.success">
[6545]55        <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false">
[6540]56            <arg value="log"/>
57            <arg value="-1"/>
58            <arg value="--grep=git-svn-id"/>
[6545]59            <!--
60            %B:  raw body (unwrapped subject and body)
61            %n:  new line
62            %ai: author date, ISO 8601 format
63            -->
64            <arg value="--pretty=format:%B%n%ai"/>
[6540]65            <arg value="HEAD"/>
66        </exec>
[6545]67        <replaceregexp file="REVISION.XML" flags="s"
68                       match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
69                       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;"/>
[6540]70    </target>
71    <!--
72      ** Creates the REVISION file to be included in the distribution
73    -->
74    <target name="create-revision" depends="init-svn-revision-xml, init-git-revision-xml">
75        <property name="revision.dir" value="${build.dir}"/>
[4166]76        <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
77        <delete file="REVISION.XML"/>
78        <tstamp>
79            <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
80        </tstamp>
81        <property name="version.entry.commit.revision" value="UNKNOWN"/>
[6540]82        <property name="version.entry.commit.date" value="UNKNOWN"/>
[4166]83        <mkdir dir="${revision.dir}"/>
[5362]84        <!-- add Build-Name: ... when making special builds, e.g. DEBIAN -->
[4166]85        <echo file="${revision.dir}/REVISION">
86# automatically generated by JOSM build.xml - do not edit
87Revision: ${version.entry.commit.revision}
88Is-Local-Build: true
89Build-Date: ${build.tstamp}
90</echo>
91    </target>
[6540]92    <!--
93      ** Check internal XML files against their XSD
94    -->
[7209]95    <target name="check-schemas" unless="check-schemas.notRequired">
[6208]96        <schemavalidate file="data/defaultpresets.xml" >
97            <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="data/tagging-preset.xsd" />
98        </schemavalidate>
99    </target>
[6540]100    <!--
101      ** Main target that builds JOSM and checks XML against schemas
102    -->
[6208]103    <target name="dist" depends="compile,create-revision,check-schemas">
[4166]104        <echo>Revision ${version.entry.commit.revision}</echo>
105        <copy file="CONTRIBUTION" todir="build"/>
106        <copy file="README" todir="build"/>
107        <copy file="LICENSE" todir="build"/>
108        <!-- create josm-custom.jar -->
109        <delete file="dist/josm-custom.jar"/>
110        <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
111            <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
112            <manifest>
113                <attribute name="Main-class" value="JOSM"/>
114                <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
115                <attribute name="Main-Date" value="${version.entry.commit.date}"/>
[6341]116                <attribute name="Permissions" value="all-permissions"/>
117                <attribute name="Codebase" value="josm.openstreetmap.de"/>
118                <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
[4166]119            </manifest>
120            <zipfileset dir="images" prefix="images"/>
121            <zipfileset dir="data" prefix="data"/>
122            <zipfileset dir="styles" prefix="styles"/>
[7133]123            <zipfileset dir="${src.dir}/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
[4166]124        </jar>
125    </target>
[7001]126    <!-- Mac OS X target -->
127    <target name="mac">
[6217]128        <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
129        <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="tools/appbundler-1.0ea.jar"/>
130        <!-- create MacOS X application bundle -->
[6945]131        <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
[6216]132                   mainclassname="org.openstreetmap.josm.gui.MainApplication"
[6217]133                   copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
[6216]134                   applicationCategory="public.app-category.utilities"
135                   shortversion="${version.entry.commit.revision} SVN"
136                   version="${version.entry.commit.revision} SVN"
137                   icon="macosx/JOSM.app/Contents/Resources/JOSM.icns"
[6217]138                   highResolutionCapable="true">
[6216]139
140            <arch name="x86_64"/>
141            <arch name="i386"/>
142
[6945]143            <classpath file="${bundle.jar}"/>
[6216]144
[7287]145            <option value="-Xmx1024m"/>
[6216]146
147            <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
148            <option value="-Xdock:name=JOSM"/>
149
150            <!-- OSX specific options, optional -->
151            <option value="-Dapple.laf.useScreenMenuBar=true"/>
152            <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
153            <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
154            <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
155            <option value="-Dcom.apple.smallTabs=true"/>
156        </bundleapp>
[6217]157       
158        <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
159        <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/>
160       
[6945]161        <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
[7367]162            <!-- remove empty CFBundleDocumentTypes definition -->
163            <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/>
[7287]164            <!-- insert our own keys -->
165            <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" />
[6217]166        </xmltask>
167       
[6216]168        <!-- create ZIP file with MacOS X application bundle -->
[7001]169        <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
[6945]170            <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
171            <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
[6216]172        </zip>
[6217]173    </target>
[7001]174    <target name="distmac" depends="dist">
175        <antcall target="mac">
[6945]176            <param name="bundle.outdir" value="dist"/>
177            <param name="bundle.jar" value="dist/josm-custom.jar"/>
178        </antcall>
179    </target>
[7839]180    <!-- Windows target -->
181    <target name="distwin" depends="dist">
[7842]182        <exec dir="windows" executable="./josm-setup-unix.sh">
[7839]183            <arg value="${version.entry.commit.revision}"/>
184            <arg value="../dist/josm-custom.jar"/>
185        </exec>
186    </target>
[5392]187    <target name="javacc" depends="init" unless="javacc.notRequired">
[4252]188        <mkdir dir="${mapcss.dir}/parsergen"/>
[4257]189        <exec append="false" executable="java" failifexecutionfails="true">
190            <arg value="-cp"/>
191            <arg value="${javacc.home}/javacc.jar"/>
192            <arg value="javacc"/>
[7043]193            <arg value="-DEBUG_PARSER=false"/>
194            <arg value="-DEBUG_TOKEN_MANAGER=false"/>
[7001]195            <arg value="-JDK_VERSION=1.7"/>
[6446]196            <arg value="-GRAMMAR_ENCODING=UTF-8"/>
[4257]197            <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
198            <arg value="${mapcss.dir}/MapCSSParser.jj"/>
199        </exec>
[4252]200    </target>
[8526]201    <target name="compile" depends="init,javacc">
[7068]202        <!-- COTS -->
[8173]203        <javac srcdir="${src.dir}" includes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**" nowarn="on" encoding="iso-8859-1"
204            destdir="build" target="1.7" source="1.7" debug="on" includeAntRuntime="false" createMissingPackageInfoClass="false">
[7019]205            <!-- get rid of "internal proprietary API" warning -->
[7068]206            <compilerarg value="-XDignore.symbol.file"/>
[8173]207            <exclude name="org/apache/commons/compress/compressors/lzma/**"/>
208            <exclude name="org/apache/commons/compress/compressors/xz/**"/>
209            <exclude name="org/apache/commons/compress/compressors/CompressorStreamFactory.java"/>
210            <exclude name="org/apache/commons/compress/compressors/deflate/**"/>
211            <exclude name="org/apache/commons/compress/compressors/gzip/**"/>
212            <exclude name="org/apache/commons/compress/compressors/lzw/**"/>
213            <exclude name="org/apache/commons/compress/compressors/pack200/**"/>
214            <exclude name="org/apache/commons/compress/compressors/snappy/**"/>
215            <exclude name="org/apache/commons/compress/compressors/z/**"/>
216            <exclude name="org/apache/commons/jcs/admin/**"/>
217            <exclude name="org/apache/commons/jcs/auxiliary/disk/jdbc/**"/>
218            <exclude name="org/apache/commons/jcs/auxiliary/remote/**"/>
219            <exclude name="org/apache/commons/jcs/utils/servlet/**"/>
220            <exclude name="org/apache/commons/logging/impl/AvalonLogger.java"/>
221            <exclude name="org/apache/commons/logging/impl/Jdk13LumberjackLogger.java"/>
222            <exclude name="org/apache/commons/logging/impl/Log4JLogger.java"/>
223            <exclude name="org/apache/commons/logging/impl/LogKitLogger.java"/>
224            <exclude name="org/apache/commons/logging/impl/ServletContextCleaner.java"/>
[7019]225        </javac>
[8526]226        <!-- JMapViewer -->
227        <javac sourcepath="" srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java,org/openstreetmap/josm/**,JOSM.java,gnu/**" 
[7068]228            destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
[7021]229            <compilerarg value="-Xlint:cast"/>
[4166]230            <compilerarg value="-Xlint:deprecation"/>
[7022]231            <compilerarg value="-Xlint:dep-ann"/>
232            <compilerarg value="-Xlint:divzero"/>
233            <compilerarg value="-Xlint:empty"/>
234            <compilerarg value="-Xlint:finally"/>
235            <compilerarg value="-Xlint:overrides"/>
236            <!--<compilerarg value="-Xlint:rawtypes"/>-->
237            <compilerarg value="-Xlint:static"/>
238            <compilerarg value="-Xlint:try"/>
[4166]239            <compilerarg value="-Xlint:unchecked"/>
[7367]240            <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
[7351]241            <compilerarg value="-XDignore.symbol.file"/>
[4166]242        </javac>
[8526]243
244        <!-- JOSM -->
245        <javac sourcepath="" srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java" 
246            destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
247            <compilerarg value="-Xlint:cast"/>
248            <compilerarg value="-Xlint:deprecation"/>
249            <compilerarg value="-Xlint:dep-ann"/>
250            <compilerarg value="-Xlint:divzero"/>
251            <compilerarg value="-Xlint:empty"/>
252            <compilerarg value="-Xlint:finally"/>
253            <compilerarg value="-Xlint:overrides"/>
254            <!--<compilerarg value="-Xlint:rawtypes"/>-->
255            <compilerarg value="-Xlint:static"/>
256            <compilerarg value="-Xlint:try"/>
257            <compilerarg value="-Xlint:unchecked"/>
258            <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
259            <compilerarg value="-XDignore.symbol.file"/>
260        </javac>
261
262
[6756]263        <copy todir="build" failonerror="no" includeemptydirs="no">
264            <fileset dir="resources"/>
265        </copy>
[4166]266    </target>
267    <target name="init">
[5392]268        <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
269            <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
270        </uptodate>
[7215]271        <uptodate property="jaxb.notRequired" targetfile="${src.dir}/org/openstreetmap/josm/data/imagery/types/package-info.java" >
272            <srcfiles dir="data_nodist" includes="wms-cache.xsd"/>
273        </uptodate>
[4166]274        <mkdir dir="build"/>
275        <mkdir dir="dist"/>
276    </target>
[5263]277    <target name="javadoc">
278        <javadoc destdir="javadoc" 
[7133]279                sourcepath="${src.dir}"
[6830]280                encoding="UTF-8"   
[5263]281                packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
282                windowtitle="JOSM"
283                use="true"
[5481]284                private="true"
[5263]285                linksource="true"
286                author="false">
[7001]287            <link href="http://docs.oracle.com/javase/7/docs/api"/>
[5263]288            <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
[6955]289            <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
[5263]290        </javadoc>
291    </target>
[4166]292    <target name="clean">
293        <delete dir="build"/>
294        <delete dir="dist"/>
[4252]295        <delete dir="${mapcss.dir}/parsergen"/>
[7133]296        <delete dir="${imagerytypes.dir}"/>
[4166]297    </target>
298    <path id="test.classpath">
299        <fileset dir="${test.dir}/lib">
300            <include name="**/*.jar"/>
301        </fileset>
302        <pathelement path="dist/josm-custom.jar"/>
[8157]303        <pathelement path="tools/groovy-all-2.4.3.jar"/>
[4166]304    </path>
[7068]305    <macrodef name="init-test-preferences">
306        <attribute name="testfamily"/>
307        <sequential>
308            <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
309            <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
310            <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
311        </sequential>
312    </macrodef>
[4166]313    <target name="test-init">
[6121]314        <mkdir dir="${test.dir}/build"/>
[7068]315        <mkdir dir="${test.dir}/build/unit"/>
316        <mkdir dir="${test.dir}/build/functional"/>
317        <mkdir dir="${test.dir}/build/performance"/>
[4166]318        <mkdir dir="${test.dir}/report"/>
[7068]319        <init-test-preferences testfamily="unit"/>
320        <init-test-preferences testfamily="functional"/>
321        <init-test-preferences testfamily="performance"/>
[4166]322    </target>
323    <target name="test-clean">
[6121]324        <delete dir="${test.dir}/build"/>
[4166]325        <delete dir="${test.dir}/report"/>
[6133]326        <delete file="${test.dir}/jacoco.exec" />
[7068]327        <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
328        <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
329        <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
330        <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
331        <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
332        <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
[4166]333    </target>
[7068]334    <macrodef name="call-groovyc">
335        <attribute name="testfamily"/>
336        <element name="cp-elements"/>
337        <sequential>
338            <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
339                <classpath>
340                    <cp-elements/>
341                </classpath>
[7367]342                <javac target="1.7" source="1.7" debug="on" encoding="UTF-8">
[7068]343                    <compilerarg value="-Xlint:all"/>
344                    <compilerarg value="-Xlint:-serial"/>
345                </javac>
346            </groovyc>
347        </sequential>
348    </macrodef>
[4166]349    <target name="test-compile" depends="test-init,dist">
[8156]350        <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.4.3.jar"/>
[7068]351        <call-groovyc testfamily="unit">
352            <cp-elements>
353                <path refid="test.classpath"/>
354            </cp-elements>
355        </call-groovyc>
356        <call-groovyc testfamily="functional">
357            <cp-elements>
358                <path refid="test.classpath"/>
359                <pathelement path="${test.dir}/build/unit"/>
360            </cp-elements>
361        </call-groovyc>
362        <call-groovyc testfamily="performance">
363            <cp-elements>
364                <path refid="test.classpath"/>
365                <pathelement path="${test.dir}/build/unit"/>
366            </cp-elements>
367        </call-groovyc>
[4166]368    </target>
[7068]369    <macrodef name="call-junit">
370        <attribute name="testfamily"/>
371        <sequential>
372            <echo message="Running @{testfamily} tests with JUnit"/>
373            <jacoco:coverage destfile="${test.dir}/jacoco.exec">
374                <junit printsummary="yes" fork="true" forkmode="once">
[7367]375                    <jvmarg value="-Dfile.encoding=UTF-8"/>
[7068]376                    <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
377                    <sysproperty key="josm.test.data" value="${test.dir}/data"/>
378                    <sysproperty key="java.awt.headless" value="true"/>
379                    <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
380                    <classpath>
381                        <path refid="test.classpath"/>
382                        <pathelement path="${test.dir}/build/unit"/>
383                        <pathelement path="${test.dir}/build/@{testfamily}"/>
384                        <pathelement path="${test.dir}/config"/>
385                    </classpath>
386                    <formatter type="plain"/>
387                    <formatter type="xml"/>
388                    <batchtest fork="yes" todir="${test.dir}/report">
389                        <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
390                    </batchtest>
391                </junit>
392            </jacoco:coverage>
393        </sequential>
394    </macrodef>
395    <target name="test" depends="test-compile" 
[7133]396        description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
[6133]397        <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
[7068]398        <call-junit testfamily="unit"/>
399        <call-junit testfamily="functional"/>
400        <call-junit testfamily="performance"/>
[4166]401    </target>
402    <target name="test-html" depends="test" description="Generate HTML test reports">
403        <!-- May require additional ant dependencies like ant-trax package -->
404        <junitreport todir="${test.dir}/report">
405            <fileset dir="${test.dir}/report">
406                <include name="TEST-*.xml"/>
407            </fileset>
408            <report todir="${test.dir}/report/html"/>
409        </junitreport>
[6133]410        <jacoco:report>
411            <executiondata>
412                <file file="${test.dir}/jacoco.exec"/>
413            </executiondata>
414            <structure name="JOSM Test Coverage">
415                <classfiles>
416                    <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
417                </classfiles>
418                <sourcefiles encoding="UTF-8">
419                    <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
420                </sourcefiles>
421            </structure>
[6134]422            <html destdir="${test.dir}/report/jacoco"/>
[6133]423        </jacoco:report>
[4166]424    </target>
425    <target name="dist-optimized" depends="dist">
426        <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
427        <proguard>
[7367]428        -injars dist/josm-custom.jar
429        -outjars dist/josm-custom-optimized.jar
[4166]430
[7367]431        -libraryjars ${java.home}/lib/rt.jar
432        -libraryjars ${java.home}/lib/jce.jar
[4166]433
[7367]434        -dontoptimize
435        -dontobfuscate
[4166]436
[7367]437        # These options probably are not necessary (and make processing a bit slower)
438        -dontskipnonpubliclibraryclasses
439        -dontskipnonpubliclibraryclassmembers
[4166]440
[7367]441        -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
442            public static void main(java.lang.String[]);
443        }
444        -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
[4166]445
[7367]446        -keep class JOSM
447        -keep class * extends org.openstreetmap.josm.io.FileImporter
448        -keep class * extends org.openstreetmap.josm.io.FileExporter
449        -keep class org.w3._2001.xmlschema.Adapter1
450        -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
[8172]451        -keep class org.apache.commons.logging.impl.*
[4166]452
[7367]453        -keepclassmembers enum  * {
454            public static **[] values();
455            public static ** valueOf(java.lang.String);
456        }
[4166]457
[7367]458        # Keep unused public methods (can be useful for plugins)
459        -keepclassmembers class * {
460            public protected *;
461        }
[4838]462
[7367]463        # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
464        # This note should not be a problem as we don't use obfuscation
465        -dontnote
[6133]466        </proguard>
[4166]467    </target>
468    <target name="check-plugins" depends="dist-optimized">
469        <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
470        <local name="dir"/>
471        <local name="plugins"/>
472        <property name="dir" value="plugin-check"/>
473        <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
[8156]474            <classpath path="tools/animal-sniffer-ant-tasks-1.14.jar"/>
[4166]475        </typedef>
476        <mkdir dir="${dir}"/>
477        <!-- List of deprecated plugins -->
[7133]478        <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
[4166]479            <filterchain>
480                <linecontains>
481                    <contains value="new DeprecatedPlugin("/>
482                </linecontains>
483                <tokenfilter>
484                    <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
485                </tokenfilter>
486                <striplinebreaks/>
487                <tokenfilter>
488                    <replaceregex pattern="\|$" replace="" flags="gi"/>
489                </tokenfilter>
490            </filterchain>
491        </loadfile>
[5498]492        <!-- Download list of plugins -->
[4166]493        <loadresource property="plugins">
[6955]494            <url url="https://josm.openstreetmap.de/plugin"/>
[4166]495            <filterchain>
496                <linecontainsregexp negate="true">
497                    <regexp pattern="^\t.*"/>
498                </linecontainsregexp>
499                <linecontainsregexp negate="true">
500                    <regexp pattern="${deprecated-plugins}"/>
501                </linecontainsregexp>
502                <tokenfilter>
503                    <replaceregex pattern="^.*;" replace="" flags="gi"/>
504                </tokenfilter>
505            </filterchain>
[6133]506        </loadresource>
507        <!-- Delete files that are not in plugin list (like old plugins) -->
508        <loadresource property="file-list">
509            <propertyresource name="plugins"/>
510            <filterchain>
511                <tokenfilter>
512                    <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
513                </tokenfilter>
514                <striplinebreaks/>
515                <tokenfilter>
516                    <replaceregex pattern="\|$" replace="" flags="gi"/>
517                </tokenfilter>   
518            </filterchain>
519        </loadresource>
520        <delete>
521            <restrict>
522                <fileset dir="${dir}"/>
523                <not>
524                    <name regex="${file-list}"/>
525                </not>
526            </restrict>
527        </delete>
528        <!-- Download plugins -->
[4166]529        <copy todir="${dir}" flatten="true">
530            <resourcelist>
531                <string value="${plugins}"/>
532            </resourcelist>
533        </copy>
534        <!-- Check plugins -->
[5498]535        <as:build-signatures destfile="${dir}/api.sig">
536            <path>
537                <fileset file="dist/josm-custom-optimized.jar"/>
538                <fileset file="${java.home}/lib/rt.jar"/>
539                <fileset file="${java.home}/lib/jce.jar"/>
540            </path>
[6133]541        </as:build-signatures>
[4166]542        <as:check-signature signature="${dir}/api.sig">
[7367]543            <ignore classname="au.edu.*"/>
544            <ignore classname="au.com.*"/>
545            <ignore classname="com.*"/>
[7934]546            <ignore classname="de.miethxml.*"/>
[8090]547            <ignore classname="javafx.*"/>
[7367]548            <ignore classname="javax.*"/>
549            <ignore classname="jogamp.*"/>
550            <ignore classname="junit.*"/>
551            <ignore classname="net.sf.*"/>
552            <ignore classname="nu.xom.*"/>
553            <ignore classname="org.apache.*"/>
554            <ignore classname="org.codehaus.*"/>
555            <ignore classname="org.dom4j.*"/>
556            <ignore classname="org.hsqldb.*"/>
557            <ignore classname="org.ibex.*"/>
[7934]558            <ignore classname="org.iso_relax.*"/>
[7367]559            <ignore classname="org.jaitools.*"/>
560            <ignore classname="org.jaxen.*"/>
561            <ignore classname="org.jdom2.*"/>
[4166]562            <ignore classname="org.jgraph.*"/>
[7367]563            <ignore classname="org.joda.time.*"/>
[4166]564            <ignore classname="org.jvnet.staxex.*"/>
[7367]565            <ignore classname="org.kxml2.*"/>
[8090]566            <ignore classname="org.objectweb.*"/>
[7367]567            <ignore classname="org.python.*"/>
568            <ignore classname="org.slf4j.*"/>
[8173]569            <!-- plugins used by another ones -->
[7494]570            <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
[7934]571            <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
[7494]572            <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
573            <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
574            <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
[4166]575            <path path="${dir}"/>
576        </as:check-signature>
577    </target>
[4838]578
[8508]579    <target name="checkstyle">
580        <taskdef resource="checkstyletask.properties" classpath="tools/checkstyle/checkstyle-6.7-all.jar"/>
581        <checkstyle config="tools/checkstyle/josm_checks.xml">
[8510]582            <fileset dir="${basedir}/src/org/openstreetmap/josm" includes="**/*.java" 
583                excludes="data/imagery/types/*.java,gui/mappaint/mapcss/parsergen/*.java"/>
[8508]584            <fileset dir="${basedir}/test" includes="**/*.java"/>
585            <formatter type="xml" toFile="checkstyle-josm.xml"/>
586        </checkstyle>
587    </target>
588
[4838]589    <target name="findbugs" depends="dist">
[6133]590        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
[4838]591        <path id="findbugs-classpath">
592            <fileset dir="tools/findbugs/">
593                <include name="*.jar"/>
594            </fileset>
595        </path>
[6133]596        <property name="findbugs-classpath" refid="findbugs-classpath"/>
597        <findbugs output="xml"
[4838]598                outputFile="findbugs-josm.xml"
[6133]599                classpath="${findbugs-classpath}"
600                pluginList=""
601                excludeFilter="tools/findbugs/josm-filter.xml"
602                effort="max"
603                >
604            <sourcePath path="${basedir}/src" />
605            <class location="${basedir}/dist/josm-custom.jar" />
606        </findbugs>
[4838]607    </target>
[5323]608    <target name="run" depends="dist">
609        <java jar="dist/josm-custom.jar" fork="true">
610            <arg value="--set=expert=true"/>
611            <arg value="--set=remotecontrol.enabled=true"/>
612            <arg value="--set=debug.edt-checker.enable=false"/>
613            <jvmarg value="-Djosm.home=/tmp/.josm/"/>
614        </java>
615    </target>
[4166]616</project>
Note: See TracBrowser for help on using the repository browser.