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 | </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.6.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" encoding="UTF-8">
|
---|
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.6.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 | <jvmarg value="-Dfile.encoding=UTF-8"/>
|
---|
358 | <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
|
---|
359 | <sysproperty key="josm.test.data" value="${test.dir}/data"/>
|
---|
360 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
361 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
362 | <classpath>
|
---|
363 | <path refid="test.classpath"/>
|
---|
364 | <pathelement path="${test.dir}/build/unit"/>
|
---|
365 | <pathelement path="${test.dir}/build/@{testfamily}"/>
|
---|
366 | <pathelement path="${test.dir}/config"/>
|
---|
367 | </classpath>
|
---|
368 | <formatter type="plain"/>
|
---|
369 | <formatter type="xml"/>
|
---|
370 | <batchtest fork="yes" todir="${test.dir}/report">
|
---|
371 | <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
|
---|
372 | </batchtest>
|
---|
373 | </junit>
|
---|
374 | </jacoco:coverage>
|
---|
375 | </sequential>
|
---|
376 | </macrodef>
|
---|
377 | <target name="test" depends="test-compile"
|
---|
378 | description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
379 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
|
---|
380 | <call-junit testfamily="unit"/>
|
---|
381 | <call-junit testfamily="functional"/>
|
---|
382 | <call-junit testfamily="performance"/>
|
---|
383 | </target>
|
---|
384 | <target name="test-html" depends="test" description="Generate HTML test reports">
|
---|
385 | <!-- May require additional ant dependencies like ant-trax package -->
|
---|
386 | <junitreport todir="${test.dir}/report">
|
---|
387 | <fileset dir="${test.dir}/report">
|
---|
388 | <include name="TEST-*.xml"/>
|
---|
389 | </fileset>
|
---|
390 | <report todir="${test.dir}/report/html"/>
|
---|
391 | </junitreport>
|
---|
392 | <jacoco:report>
|
---|
393 | <executiondata>
|
---|
394 | <file file="${test.dir}/jacoco.exec"/>
|
---|
395 | </executiondata>
|
---|
396 | <structure name="JOSM Test Coverage">
|
---|
397 | <classfiles>
|
---|
398 | <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
|
---|
399 | </classfiles>
|
---|
400 | <sourcefiles encoding="UTF-8">
|
---|
401 | <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
|
---|
402 | </sourcefiles>
|
---|
403 | </structure>
|
---|
404 | <html destdir="${test.dir}/report/jacoco"/>
|
---|
405 | </jacoco:report>
|
---|
406 | </target>
|
---|
407 | <target name="dist-optimized" depends="dist">
|
---|
408 | <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
|
---|
409 | <proguard>
|
---|
410 | -injars dist/josm-custom.jar
|
---|
411 | -outjars dist/josm-custom-optimized.jar
|
---|
412 |
|
---|
413 | -libraryjars ${java.home}/lib/rt.jar
|
---|
414 | -libraryjars ${java.home}/lib/jce.jar
|
---|
415 |
|
---|
416 | -dontoptimize
|
---|
417 | -dontobfuscate
|
---|
418 |
|
---|
419 | # These options probably are not necessary (and make processing a bit slower)
|
---|
420 | -dontskipnonpubliclibraryclasses
|
---|
421 | -dontskipnonpubliclibraryclassmembers
|
---|
422 |
|
---|
423 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
424 | public static void main(java.lang.String[]);
|
---|
425 | }
|
---|
426 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
|
---|
427 |
|
---|
428 | -keep class JOSM
|
---|
429 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
430 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
431 | -keep class org.w3._2001.xmlschema.Adapter1
|
---|
432 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
433 |
|
---|
434 | -keepclassmembers enum * {
|
---|
435 | public static **[] values();
|
---|
436 | public static ** valueOf(java.lang.String);
|
---|
437 | }
|
---|
438 |
|
---|
439 | # Keep unused public methods (can be useful for plugins)
|
---|
440 | -keepclassmembers class * {
|
---|
441 | public protected *;
|
---|
442 | }
|
---|
443 |
|
---|
444 | # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
|
---|
445 | # This note should not be a problem as we don't use obfuscation
|
---|
446 | -dontnote
|
---|
447 | </proguard>
|
---|
448 | </target>
|
---|
449 | <target name="check-plugins" depends="dist-optimized">
|
---|
450 | <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
|
---|
451 | <local name="dir"/>
|
---|
452 | <local name="plugins"/>
|
---|
453 | <property name="dir" value="plugin-check"/>
|
---|
454 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
|
---|
455 | <classpath path="tools/animal-sniffer-ant-tasks-1.11.jar"/>
|
---|
456 | </typedef>
|
---|
457 | <mkdir dir="${dir}"/>
|
---|
458 | <!-- List of deprecated plugins -->
|
---|
459 | <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
|
---|
460 | <filterchain>
|
---|
461 | <linecontains>
|
---|
462 | <contains value="new DeprecatedPlugin("/>
|
---|
463 | </linecontains>
|
---|
464 | <tokenfilter>
|
---|
465 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
|
---|
466 | </tokenfilter>
|
---|
467 | <striplinebreaks/>
|
---|
468 | <tokenfilter>
|
---|
469 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
470 | </tokenfilter>
|
---|
471 | </filterchain>
|
---|
472 | </loadfile>
|
---|
473 | <!-- Download list of plugins -->
|
---|
474 | <loadresource property="plugins">
|
---|
475 | <url url="https://josm.openstreetmap.de/plugin"/>
|
---|
476 | <filterchain>
|
---|
477 | <linecontainsregexp negate="true">
|
---|
478 | <regexp pattern="^\t.*"/>
|
---|
479 | </linecontainsregexp>
|
---|
480 | <linecontainsregexp negate="true">
|
---|
481 | <regexp pattern="${deprecated-plugins}"/>
|
---|
482 | </linecontainsregexp>
|
---|
483 | <tokenfilter>
|
---|
484 | <replaceregex pattern="^.*;" replace="" flags="gi"/>
|
---|
485 | </tokenfilter>
|
---|
486 | </filterchain>
|
---|
487 | </loadresource>
|
---|
488 | <!-- Delete files that are not in plugin list (like old plugins) -->
|
---|
489 | <loadresource property="file-list">
|
---|
490 | <propertyresource name="plugins"/>
|
---|
491 | <filterchain>
|
---|
492 | <tokenfilter>
|
---|
493 | <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
|
---|
494 | </tokenfilter>
|
---|
495 | <striplinebreaks/>
|
---|
496 | <tokenfilter>
|
---|
497 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
498 | </tokenfilter>
|
---|
499 | </filterchain>
|
---|
500 | </loadresource>
|
---|
501 | <delete>
|
---|
502 | <restrict>
|
---|
503 | <fileset dir="${dir}"/>
|
---|
504 | <not>
|
---|
505 | <name regex="${file-list}"/>
|
---|
506 | </not>
|
---|
507 | </restrict>
|
---|
508 | </delete>
|
---|
509 | <!-- Download plugins -->
|
---|
510 | <copy todir="${dir}" flatten="true">
|
---|
511 | <resourcelist>
|
---|
512 | <string value="${plugins}"/>
|
---|
513 | </resourcelist>
|
---|
514 | </copy>
|
---|
515 | <!-- Check plugins -->
|
---|
516 | <as:build-signatures destfile="${dir}/api.sig">
|
---|
517 | <path>
|
---|
518 | <fileset file="dist/josm-custom-optimized.jar"/>
|
---|
519 | <fileset file="${java.home}/lib/rt.jar"/>
|
---|
520 | <fileset file="${java.home}/lib/jce.jar"/>
|
---|
521 | </path>
|
---|
522 | </as:build-signatures>
|
---|
523 | <as:check-signature signature="${dir}/api.sig">
|
---|
524 | <ignore classname="au.edu.*"/>
|
---|
525 | <ignore classname="au.com.*"/>
|
---|
526 | <ignore classname="com.*"/>
|
---|
527 | <ignore classname="javax.*"/>
|
---|
528 | <ignore classname="jogamp.*"/>
|
---|
529 | <ignore classname="junit.*"/>
|
---|
530 | <ignore classname="net.sf.*"/>
|
---|
531 | <ignore classname="nu.xom.*"/>
|
---|
532 | <ignore classname="org.apache.*"/>
|
---|
533 | <ignore classname="org.codehaus.*"/>
|
---|
534 | <ignore classname="org.dom4j.*"/>
|
---|
535 | <ignore classname="org.hsqldb.*"/>
|
---|
536 | <ignore classname="org.ibex.*"/>
|
---|
537 | <ignore classname="org.jaitools.*"/>
|
---|
538 | <ignore classname="org.jaxen.*"/>
|
---|
539 | <ignore classname="org.jdom2.*"/>
|
---|
540 | <ignore classname="org.jgraph.*"/>
|
---|
541 | <ignore classname="org.joda.time.*"/>
|
---|
542 | <ignore classname="org.jvnet.staxex.*"/>
|
---|
543 | <ignore classname="org.kxml2.*"/>
|
---|
544 | <ignore classname="org.python.*"/>
|
---|
545 | <ignore classname="org.slf4j.*"/>
|
---|
546 | <path path="${dir}"/>
|
---|
547 | </as:check-signature>
|
---|
548 | </target>
|
---|
549 |
|
---|
550 | <target name="findbugs" depends="dist">
|
---|
551 | <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
|
---|
552 | <path id="findbugs-classpath">
|
---|
553 | <fileset dir="tools/findbugs/">
|
---|
554 | <include name="*.jar"/>
|
---|
555 | </fileset>
|
---|
556 | </path>
|
---|
557 | <property name="findbugs-classpath" refid="findbugs-classpath"/>
|
---|
558 | <findbugs output="xml"
|
---|
559 | outputFile="findbugs-josm.xml"
|
---|
560 | classpath="${findbugs-classpath}"
|
---|
561 | pluginList=""
|
---|
562 | excludeFilter="tools/findbugs/josm-filter.xml"
|
---|
563 | effort="max"
|
---|
564 | >
|
---|
565 | <sourcePath path="${basedir}/src" />
|
---|
566 | <class location="${basedir}/dist/josm-custom.jar" />
|
---|
567 | </findbugs>
|
---|
568 | </target>
|
---|
569 | <target name="run" depends="dist">
|
---|
570 | <java jar="dist/josm-custom.jar" fork="true">
|
---|
571 | <arg value="--set=expert=true"/>
|
---|
572 | <arg value="--set=remotecontrol.enabled=true"/>
|
---|
573 | <arg value="--set=debug.edt-checker.enable=false"/>
|
---|
574 | <jvmarg value="-Djosm.home=/tmp/.josm/"/>
|
---|
575 | </java>
|
---|
576 | </target>
|
---|
577 |
|
---|
578 | </project>
|
---|