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="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
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
|
---|
93 | Revision: ${version.entry.commit.revision}
|
---|
94 | Is-Local-Build: true
|
---|
95 | Build-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 | <schemavalidate file="styles/standard/elemstyles.xml" >
|
---|
106 | <schema namespace="http://josm.openstreetmap.de/mappaint-style-1.0" file="data/mappaint-style.xsd" />
|
---|
107 | </schemavalidate>
|
---|
108 | </target>
|
---|
109 | <!--
|
---|
110 | ** Main target that builds JOSM and checks XML against schemas
|
---|
111 | -->
|
---|
112 | <target name="dist" depends="compile,create-revision,check-schemas">
|
---|
113 | <echo>Revision ${version.entry.commit.revision}</echo>
|
---|
114 | <copy file="CONTRIBUTION" todir="build"/>
|
---|
115 | <copy file="README" todir="build"/>
|
---|
116 | <copy file="LICENSE" todir="build"/>
|
---|
117 | <!-- create josm-custom.jar -->
|
---|
118 | <delete file="dist/josm-custom.jar"/>
|
---|
119 | <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
|
---|
120 | <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
|
---|
121 | <manifest>
|
---|
122 | <attribute name="Main-class" value="JOSM"/>
|
---|
123 | <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
|
---|
124 | <attribute name="Main-Date" value="${version.entry.commit.date}"/>
|
---|
125 | <attribute name="Permissions" value="all-permissions"/>
|
---|
126 | <attribute name="Codebase" value="josm.openstreetmap.de"/>
|
---|
127 | <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
|
---|
128 | </manifest>
|
---|
129 | <zipfileset dir="images" prefix="images"/>
|
---|
130 | <zipfileset dir="data" prefix="data"/>
|
---|
131 | <zipfileset dir="styles" prefix="styles"/>
|
---|
132 | <zipfileset dir="${src.dir}/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
|
---|
133 | <!-- All jar files necessary to run only JOSM (no tests) -->
|
---|
134 | <!-- <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar"/> -->
|
---|
135 | <!-- <zipfileset src="lib/signpost-core-1.2.1.1.jar"/> -->
|
---|
136 | </jar>
|
---|
137 | </target>
|
---|
138 | <!-- Mac OS X target -->
|
---|
139 | <target name="mac">
|
---|
140 | <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
|
---|
141 | <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="tools/appbundler-1.0ea.jar"/>
|
---|
142 | <!-- create MacOS X application bundle -->
|
---|
143 | <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
|
---|
144 | mainclassname="org.openstreetmap.josm.gui.MainApplication"
|
---|
145 | copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
|
---|
146 | applicationCategory="public.app-category.utilities"
|
---|
147 | shortversion="${version.entry.commit.revision} SVN"
|
---|
148 | version="${version.entry.commit.revision} SVN"
|
---|
149 | icon="macosx/JOSM.app/Contents/Resources/JOSM.icns"
|
---|
150 | highResolutionCapable="true">
|
---|
151 |
|
---|
152 | <arch name="x86_64"/>
|
---|
153 | <arch name="i386"/>
|
---|
154 |
|
---|
155 | <classpath file="${bundle.jar}"/>
|
---|
156 |
|
---|
157 | <option value="-Xmx512m"/>
|
---|
158 |
|
---|
159 | <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
|
---|
160 | <option value="-Xdock:name=JOSM"/>
|
---|
161 |
|
---|
162 | <!-- OSX specific options, optional -->
|
---|
163 | <option value="-Dapple.laf.useScreenMenuBar=true"/>
|
---|
164 | <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
|
---|
165 | <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
|
---|
166 | <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
|
---|
167 | <option value="-Dcom.apple.smallTabs=true"/>
|
---|
168 | </bundleapp>
|
---|
169 |
|
---|
170 | <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
|
---|
171 | <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/>
|
---|
172 |
|
---|
173 | <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
|
---|
174 | <insert position="before" path="/plist/dict/key[1]"><![CDATA[<key>CFBundleAllowMixedLocalizations</key>
|
---|
175 | <string>true</string>
|
---|
176 | ]]></insert>
|
---|
177 | </xmltask>
|
---|
178 |
|
---|
179 | <!-- create ZIP file with MacOS X application bundle -->
|
---|
180 | <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
|
---|
181 | <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
|
---|
182 | <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
|
---|
183 | </zip>
|
---|
184 | </target>
|
---|
185 | <target name="distmac" depends="dist">
|
---|
186 | <antcall target="mac">
|
---|
187 | <param name="bundle.outdir" value="dist"/>
|
---|
188 | <param name="bundle.jar" value="dist/josm-custom.jar"/>
|
---|
189 | </antcall>
|
---|
190 | </target>
|
---|
191 | <target name="javacc" depends="init" unless="javacc.notRequired">
|
---|
192 | <mkdir dir="${mapcss.dir}/parsergen"/>
|
---|
193 | <exec append="false" executable="java" failifexecutionfails="true">
|
---|
194 | <arg value="-cp"/>
|
---|
195 | <arg value="${javacc.home}/javacc.jar"/>
|
---|
196 | <arg value="javacc"/>
|
---|
197 | <arg value="-DEBUG_PARSER=false"/>
|
---|
198 | <arg value="-DEBUG_TOKEN_MANAGER=false"/>
|
---|
199 | <arg value="-JDK_VERSION=1.7"/>
|
---|
200 | <arg value="-GRAMMAR_ENCODING=UTF-8"/>
|
---|
201 | <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
|
---|
202 | <arg value="${mapcss.dir}/MapCSSParser.jj"/>
|
---|
203 | </exec>
|
---|
204 | </target>
|
---|
205 | <target name="-jaxb_win" if="isWindows">
|
---|
206 | <property name="xjc" value="${java.home}\..\bin\xjc.exe" />
|
---|
207 | </target>
|
---|
208 | <target name="-jaxb_nix" unless="isWindows">
|
---|
209 | <property name="xjc" value="${java.home}/../bin/xjc" />
|
---|
210 | </target>
|
---|
211 | <target name="jaxb" depends="init, -jaxb_win, -jaxb_nix" unless="jaxb.notRequired">
|
---|
212 | <exec executable="${xjc}" failonerror="true">
|
---|
213 | <arg value="-d"/>
|
---|
214 | <arg value="${src.dir}"/>
|
---|
215 | <arg value="-encoding"/>
|
---|
216 | <arg value="UTF-8"/>
|
---|
217 | <arg value="data_nodist/wms-cache.xsd"/>
|
---|
218 | </exec>
|
---|
219 | </target>
|
---|
220 | <target name="compile" depends="init,javacc,jaxb">
|
---|
221 | <!-- COTS -->
|
---|
222 | <javac srcdir="${src.dir}" includes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**" nowarn="on"
|
---|
223 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="iso-8859-1">
|
---|
224 | <!-- get rid of "internal proprietary API" warning -->
|
---|
225 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
226 | </javac>
|
---|
227 | <!-- JMapViewer/JOSM -->
|
---|
228 | <javac srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
|
---|
229 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
|
---|
230 | <compilerarg value="-Xlint:cast"/>
|
---|
231 | <compilerarg value="-Xlint:deprecation"/>
|
---|
232 | <compilerarg value="-Xlint:dep-ann"/>
|
---|
233 | <compilerarg value="-Xlint:divzero"/>
|
---|
234 | <compilerarg value="-Xlint:empty"/>
|
---|
235 | <compilerarg value="-Xlint:finally"/>
|
---|
236 | <compilerarg value="-Xlint:overrides"/>
|
---|
237 | <!--<compilerarg value="-Xlint:rawtypes"/>-->
|
---|
238 | <compilerarg value="-Xlint:static"/>
|
---|
239 | <compilerarg value="-Xlint:try"/>
|
---|
240 | <compilerarg value="-Xlint:unchecked"/>
|
---|
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 | <mkdir dir="build"/>
|
---|
251 | <mkdir dir="dist"/>
|
---|
252 | </target>
|
---|
253 | <target name="javadoc">
|
---|
254 | <javadoc destdir="javadoc"
|
---|
255 | sourcepath="${src.dir}"
|
---|
256 | encoding="UTF-8"
|
---|
257 | packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
|
---|
258 | windowtitle="JOSM"
|
---|
259 | use="true"
|
---|
260 | private="true"
|
---|
261 | linksource="true"
|
---|
262 | author="false">
|
---|
263 | <link href="http://docs.oracle.com/javase/7/docs/api"/>
|
---|
264 | <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
|
---|
265 | <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
|
---|
266 | </javadoc>
|
---|
267 | </target>
|
---|
268 | <target name="clean">
|
---|
269 | <delete dir="build"/>
|
---|
270 | <delete dir="dist"/>
|
---|
271 | <delete dir="${mapcss.dir}/parsergen"/>
|
---|
272 | <delete dir="${imagerytypes.dir}"/>
|
---|
273 | </target>
|
---|
274 | <path id="test.classpath">
|
---|
275 | <fileset dir="${test.dir}/lib">
|
---|
276 | <include name="**/*.jar"/>
|
---|
277 | </fileset>
|
---|
278 | <fileset dir="lib">
|
---|
279 | <include name="**/*.jar"/>
|
---|
280 | </fileset>
|
---|
281 | <pathelement path="dist/josm-custom.jar"/>
|
---|
282 | <pathelement path="tools/groovy-all-2.3.2.jar"/>
|
---|
283 | </path>
|
---|
284 | <macrodef name="init-test-preferences">
|
---|
285 | <attribute name="testfamily"/>
|
---|
286 | <sequential>
|
---|
287 | <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
|
---|
288 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
289 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
290 | </sequential>
|
---|
291 | </macrodef>
|
---|
292 | <target name="test-init">
|
---|
293 | <mkdir dir="${test.dir}/build"/>
|
---|
294 | <mkdir dir="${test.dir}/build/unit"/>
|
---|
295 | <mkdir dir="${test.dir}/build/functional"/>
|
---|
296 | <mkdir dir="${test.dir}/build/performance"/>
|
---|
297 | <mkdir dir="${test.dir}/report"/>
|
---|
298 | <init-test-preferences testfamily="unit"/>
|
---|
299 | <init-test-preferences testfamily="functional"/>
|
---|
300 | <init-test-preferences testfamily="performance"/>
|
---|
301 | </target>
|
---|
302 | <target name="test-clean">
|
---|
303 | <delete dir="${test.dir}/build"/>
|
---|
304 | <delete dir="${test.dir}/report"/>
|
---|
305 | <delete file="${test.dir}/jacoco.exec" />
|
---|
306 | <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
|
---|
307 | <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
|
---|
308 | <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
|
---|
309 | <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
|
---|
310 | <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
|
---|
311 | <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
|
---|
312 | </target>
|
---|
313 | <macrodef name="call-groovyc">
|
---|
314 | <attribute name="testfamily"/>
|
---|
315 | <element name="cp-elements"/>
|
---|
316 | <sequential>
|
---|
317 | <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
|
---|
318 | <classpath>
|
---|
319 | <cp-elements/>
|
---|
320 | </classpath>
|
---|
321 | <javac target="1.7" source="1.7" debug="on">
|
---|
322 | <compilerarg value="-Xlint:all"/>
|
---|
323 | <compilerarg value="-Xlint:-serial"/>
|
---|
324 | </javac>
|
---|
325 | </groovyc>
|
---|
326 | </sequential>
|
---|
327 | </macrodef>
|
---|
328 | <target name="test-compile" depends="test-init,dist">
|
---|
329 | <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.3.2.jar"/>
|
---|
330 | <call-groovyc testfamily="unit">
|
---|
331 | <cp-elements>
|
---|
332 | <path refid="test.classpath"/>
|
---|
333 | </cp-elements>
|
---|
334 | </call-groovyc>
|
---|
335 | <call-groovyc testfamily="functional">
|
---|
336 | <cp-elements>
|
---|
337 | <path refid="test.classpath"/>
|
---|
338 | <pathelement path="${test.dir}/build/unit"/>
|
---|
339 | </cp-elements>
|
---|
340 | </call-groovyc>
|
---|
341 | <call-groovyc testfamily="performance">
|
---|
342 | <cp-elements>
|
---|
343 | <path refid="test.classpath"/>
|
---|
344 | <pathelement path="${test.dir}/build/unit"/>
|
---|
345 | </cp-elements>
|
---|
346 | </call-groovyc>
|
---|
347 | </target>
|
---|
348 | <macrodef name="call-junit">
|
---|
349 | <attribute name="testfamily"/>
|
---|
350 | <sequential>
|
---|
351 | <echo message="Running @{testfamily} tests with JUnit"/>
|
---|
352 | <jacoco:coverage destfile="${test.dir}/jacoco.exec">
|
---|
353 | <junit printsummary="yes" fork="true" forkmode="once">
|
---|
354 | <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
|
---|
355 | <sysproperty key="josm.test.data" value="${test.dir}/data"/>
|
---|
356 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
357 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
358 | <classpath>
|
---|
359 | <path refid="test.classpath"/>
|
---|
360 | <pathelement path="${test.dir}/build/unit"/>
|
---|
361 | <pathelement path="${test.dir}/build/@{testfamily}"/>
|
---|
362 | <pathelement path="${test.dir}/config"/>
|
---|
363 | </classpath>
|
---|
364 | <formatter type="plain"/>
|
---|
365 | <formatter type="xml"/>
|
---|
366 | <batchtest fork="yes" todir="${test.dir}/report">
|
---|
367 | <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
|
---|
368 | </batchtest>
|
---|
369 | </junit>
|
---|
370 | </jacoco:coverage>
|
---|
371 | </sequential>
|
---|
372 | </macrodef>
|
---|
373 | <target name="test" depends="test-compile"
|
---|
374 | description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
375 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
|
---|
376 | <call-junit testfamily="unit"/>
|
---|
377 | <call-junit testfamily="functional"/>
|
---|
378 | <call-junit testfamily="performance"/>
|
---|
379 | </target>
|
---|
380 | <target name="test-html" depends="test" description="Generate HTML test reports">
|
---|
381 | <!-- May require additional ant dependencies like ant-trax package -->
|
---|
382 | <junitreport todir="${test.dir}/report">
|
---|
383 | <fileset dir="${test.dir}/report">
|
---|
384 | <include name="TEST-*.xml"/>
|
---|
385 | </fileset>
|
---|
386 | <report todir="${test.dir}/report/html"/>
|
---|
387 | </junitreport>
|
---|
388 | <jacoco:report>
|
---|
389 | <executiondata>
|
---|
390 | <file file="${test.dir}/jacoco.exec"/>
|
---|
391 | </executiondata>
|
---|
392 | <structure name="JOSM Test Coverage">
|
---|
393 | <classfiles>
|
---|
394 | <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
|
---|
395 | </classfiles>
|
---|
396 | <sourcefiles encoding="UTF-8">
|
---|
397 | <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
|
---|
398 | </sourcefiles>
|
---|
399 | </structure>
|
---|
400 | <html destdir="${test.dir}/report/jacoco"/>
|
---|
401 | </jacoco:report>
|
---|
402 | </target>
|
---|
403 | <target name="dist-optimized" depends="dist">
|
---|
404 | <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
|
---|
405 | <proguard>
|
---|
406 | -injars dist/josm-custom.jar
|
---|
407 | -outjars dist/josm-custom-optimized.jar
|
---|
408 |
|
---|
409 | -libraryjars ${java.home}/lib/rt.jar
|
---|
410 | -libraryjars ${java.home}/lib/jce.jar
|
---|
411 |
|
---|
412 | -dontoptimize
|
---|
413 | -dontobfuscate
|
---|
414 |
|
---|
415 | # These options probably are not necessary (and make processing a bit slower)
|
---|
416 | -dontskipnonpubliclibraryclasses
|
---|
417 | -dontskipnonpubliclibraryclassmembers
|
---|
418 |
|
---|
419 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
420 | public static void main(java.lang.String[]);
|
---|
421 | }
|
---|
422 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
|
---|
423 |
|
---|
424 | -keep class JOSM
|
---|
425 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
426 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
427 | -keep class org.openstreetmap.josm.data.imagery.types.Adapter1
|
---|
428 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
429 |
|
---|
430 | -keepclassmembers enum * {
|
---|
431 | public static **[] values();
|
---|
432 | public static ** valueOf(java.lang.String);
|
---|
433 | }
|
---|
434 |
|
---|
435 | # Keep unused public methods (can be useful for plugins)
|
---|
436 | -keepclassmembers class * {
|
---|
437 | public protected *;
|
---|
438 | }
|
---|
439 |
|
---|
440 | # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'. This notes should not be a problem as we don't use obfuscation
|
---|
441 | -dontnote
|
---|
442 | </proguard>
|
---|
443 | </target>
|
---|
444 | <target name="check-plugins" depends="dist-optimized">
|
---|
445 | <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
|
---|
446 | <local name="dir"/>
|
---|
447 | <local name="plugins"/>
|
---|
448 | <property name="dir" value="plugin-check"/>
|
---|
449 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
|
---|
450 | <classpath path="tools/animal-sniffer-ant-tasks-1.8.jar"/>
|
---|
451 | </typedef>
|
---|
452 | <mkdir dir="${dir}"/>
|
---|
453 | <!-- List of deprecated plugins -->
|
---|
454 | <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
|
---|
455 | <filterchain>
|
---|
456 | <linecontains>
|
---|
457 | <contains value="new DeprecatedPlugin("/>
|
---|
458 | </linecontains>
|
---|
459 | <tokenfilter>
|
---|
460 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
|
---|
461 | </tokenfilter>
|
---|
462 | <striplinebreaks/>
|
---|
463 | <tokenfilter>
|
---|
464 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
465 | </tokenfilter>
|
---|
466 | </filterchain>
|
---|
467 | </loadfile>
|
---|
468 | <!-- Download list of plugins -->
|
---|
469 | <loadresource property="plugins">
|
---|
470 | <url url="https://josm.openstreetmap.de/plugin"/>
|
---|
471 | <filterchain>
|
---|
472 | <linecontainsregexp negate="true">
|
---|
473 | <regexp pattern="^\t.*"/>
|
---|
474 | </linecontainsregexp>
|
---|
475 | <linecontainsregexp negate="true">
|
---|
476 | <regexp pattern="${deprecated-plugins}"/>
|
---|
477 | </linecontainsregexp>
|
---|
478 | <tokenfilter>
|
---|
479 | <replaceregex pattern="^.*;" replace="" flags="gi"/>
|
---|
480 | </tokenfilter>
|
---|
481 | </filterchain>
|
---|
482 | </loadresource>
|
---|
483 | <!-- Delete files that are not in plugin list (like old plugins) -->
|
---|
484 | <loadresource property="file-list">
|
---|
485 | <propertyresource name="plugins"/>
|
---|
486 | <filterchain>
|
---|
487 | <tokenfilter>
|
---|
488 | <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
|
---|
489 | </tokenfilter>
|
---|
490 | <striplinebreaks/>
|
---|
491 | <tokenfilter>
|
---|
492 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
493 | </tokenfilter>
|
---|
494 | </filterchain>
|
---|
495 | </loadresource>
|
---|
496 | <delete>
|
---|
497 | <restrict>
|
---|
498 | <fileset dir="${dir}"/>
|
---|
499 | <not>
|
---|
500 | <name regex="${file-list}"/>
|
---|
501 | </not>
|
---|
502 | </restrict>
|
---|
503 | </delete>
|
---|
504 | <!-- Download plugins -->
|
---|
505 | <copy todir="${dir}" flatten="true">
|
---|
506 | <resourcelist>
|
---|
507 | <string value="${plugins}"/>
|
---|
508 | </resourcelist>
|
---|
509 | </copy>
|
---|
510 | <!-- Check plugins -->
|
---|
511 | <as:build-signatures destfile="${dir}/api.sig">
|
---|
512 | <path>
|
---|
513 | <fileset file="dist/josm-custom-optimized.jar"/>
|
---|
514 | <fileset file="${java.home}/lib/rt.jar"/>
|
---|
515 | <fileset file="${java.home}/lib/jce.jar"/>
|
---|
516 | </path>
|
---|
517 | </as:build-signatures>
|
---|
518 | <as:check-signature signature="${dir}/api.sig">
|
---|
519 | <ignore classname="org.jgraph.*"/>
|
---|
520 | <ignore classname="com.touchgraph.*"/>
|
---|
521 | <ignore classname="com.sun.xml.fastinfoset.*"/>
|
---|
522 | <ignore classname="javax.jms.*"/>
|
---|
523 | <ignore classname="org.jvnet.staxex.*"/>
|
---|
524 | <ignore classname="javax.mail.*"/>
|
---|
525 | <ignore classname="com.sun.jdmk.*"/>
|
---|
526 | <ignore classname="org.apache.avalon.framework.logger.Logger"/>
|
---|
527 | <ignore classname="org.apache.log.*"/>
|
---|
528 | <ignore classname="junit.*"/>
|
---|
529 | <path path="${dir}"/>
|
---|
530 | </as:check-signature>
|
---|
531 | </target>
|
---|
532 |
|
---|
533 | <target name="findbugs" depends="dist">
|
---|
534 | <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
|
---|
535 | <path id="findbugs-classpath">
|
---|
536 | <fileset dir="tools/findbugs/">
|
---|
537 | <include name="*.jar"/>
|
---|
538 | </fileset>
|
---|
539 | </path>
|
---|
540 | <property name="findbugs-classpath" refid="findbugs-classpath"/>
|
---|
541 | <findbugs output="xml"
|
---|
542 | outputFile="findbugs-josm.xml"
|
---|
543 | classpath="${findbugs-classpath}"
|
---|
544 | pluginList=""
|
---|
545 | excludeFilter="tools/findbugs/josm-filter.xml"
|
---|
546 | effort="max"
|
---|
547 | >
|
---|
548 | <sourcePath path="${basedir}/src" />
|
---|
549 | <class location="${basedir}/dist/josm-custom.jar" />
|
---|
550 | </findbugs>
|
---|
551 | </target>
|
---|
552 | <target name="run" depends="dist">
|
---|
553 | <java jar="dist/josm-custom.jar" fork="true">
|
---|
554 | <arg value="--set=expert=true"/>
|
---|
555 | <arg value="--set=remotecontrol.enabled=true"/>
|
---|
556 | <arg value="--set=debug.edt-checker.enable=false"/>
|
---|
557 | <jvmarg value="-Djosm.home=/tmp/.josm/"/>
|
---|
558 | </java>
|
---|
559 | </target>
|
---|
560 |
|
---|
561 | </project>
|
---|