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 | </javac>
|
---|
240 | <copy todir="build" failonerror="no" includeemptydirs="no">
|
---|
241 | <fileset dir="resources"/>
|
---|
242 | </copy>
|
---|
243 | </target>
|
---|
244 | <target name="init">
|
---|
245 | <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
|
---|
246 | <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
|
---|
247 | </uptodate>
|
---|
248 | <uptodate property="jaxb.notRequired" targetfile="${src.dir}/org/openstreetmap/josm/data/imagery/types/package-info.java" >
|
---|
249 | <srcfiles dir="data_nodist" includes="wms-cache.xsd"/>
|
---|
250 | </uptodate>
|
---|
251 | <mkdir dir="build"/>
|
---|
252 | <mkdir dir="dist"/>
|
---|
253 | </target>
|
---|
254 | <target name="javadoc">
|
---|
255 | <javadoc destdir="javadoc"
|
---|
256 | sourcepath="${src.dir}"
|
---|
257 | encoding="UTF-8"
|
---|
258 | packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
|
---|
259 | windowtitle="JOSM"
|
---|
260 | use="true"
|
---|
261 | private="true"
|
---|
262 | linksource="true"
|
---|
263 | author="false">
|
---|
264 | <link href="http://docs.oracle.com/javase/7/docs/api"/>
|
---|
265 | <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
|
---|
266 | <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
|
---|
267 | </javadoc>
|
---|
268 | </target>
|
---|
269 | <target name="clean">
|
---|
270 | <delete dir="build"/>
|
---|
271 | <delete dir="dist"/>
|
---|
272 | <delete dir="${mapcss.dir}/parsergen"/>
|
---|
273 | <delete dir="${imagerytypes.dir}"/>
|
---|
274 | </target>
|
---|
275 | <path id="test.classpath">
|
---|
276 | <fileset dir="${test.dir}/lib">
|
---|
277 | <include name="**/*.jar"/>
|
---|
278 | </fileset>
|
---|
279 | <fileset dir="lib">
|
---|
280 | <include name="**/*.jar"/>
|
---|
281 | </fileset>
|
---|
282 | <pathelement path="dist/josm-custom.jar"/>
|
---|
283 | <pathelement path="tools/groovy-all-2.3.4.jar"/>
|
---|
284 | </path>
|
---|
285 | <macrodef name="init-test-preferences">
|
---|
286 | <attribute name="testfamily"/>
|
---|
287 | <sequential>
|
---|
288 | <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
|
---|
289 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
290 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
291 | </sequential>
|
---|
292 | </macrodef>
|
---|
293 | <target name="test-init">
|
---|
294 | <mkdir dir="${test.dir}/build"/>
|
---|
295 | <mkdir dir="${test.dir}/build/unit"/>
|
---|
296 | <mkdir dir="${test.dir}/build/functional"/>
|
---|
297 | <mkdir dir="${test.dir}/build/performance"/>
|
---|
298 | <mkdir dir="${test.dir}/report"/>
|
---|
299 | <init-test-preferences testfamily="unit"/>
|
---|
300 | <init-test-preferences testfamily="functional"/>
|
---|
301 | <init-test-preferences testfamily="performance"/>
|
---|
302 | </target>
|
---|
303 | <target name="test-clean">
|
---|
304 | <delete dir="${test.dir}/build"/>
|
---|
305 | <delete dir="${test.dir}/report"/>
|
---|
306 | <delete file="${test.dir}/jacoco.exec" />
|
---|
307 | <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
|
---|
308 | <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
|
---|
309 | <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
|
---|
310 | <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
|
---|
311 | <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
|
---|
312 | <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
|
---|
313 | </target>
|
---|
314 | <macrodef name="call-groovyc">
|
---|
315 | <attribute name="testfamily"/>
|
---|
316 | <element name="cp-elements"/>
|
---|
317 | <sequential>
|
---|
318 | <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
|
---|
319 | <classpath>
|
---|
320 | <cp-elements/>
|
---|
321 | </classpath>
|
---|
322 | <javac target="1.7" source="1.7" debug="on">
|
---|
323 | <compilerarg value="-Xlint:all"/>
|
---|
324 | <compilerarg value="-Xlint:-serial"/>
|
---|
325 | </javac>
|
---|
326 | </groovyc>
|
---|
327 | </sequential>
|
---|
328 | </macrodef>
|
---|
329 | <target name="test-compile" depends="test-init,dist">
|
---|
330 | <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.3.4.jar"/>
|
---|
331 | <call-groovyc testfamily="unit">
|
---|
332 | <cp-elements>
|
---|
333 | <path refid="test.classpath"/>
|
---|
334 | </cp-elements>
|
---|
335 | </call-groovyc>
|
---|
336 | <call-groovyc testfamily="functional">
|
---|
337 | <cp-elements>
|
---|
338 | <path refid="test.classpath"/>
|
---|
339 | <pathelement path="${test.dir}/build/unit"/>
|
---|
340 | </cp-elements>
|
---|
341 | </call-groovyc>
|
---|
342 | <call-groovyc testfamily="performance">
|
---|
343 | <cp-elements>
|
---|
344 | <path refid="test.classpath"/>
|
---|
345 | <pathelement path="${test.dir}/build/unit"/>
|
---|
346 | </cp-elements>
|
---|
347 | </call-groovyc>
|
---|
348 | </target>
|
---|
349 | <macrodef name="call-junit">
|
---|
350 | <attribute name="testfamily"/>
|
---|
351 | <sequential>
|
---|
352 | <echo message="Running @{testfamily} tests with JUnit"/>
|
---|
353 | <jacoco:coverage destfile="${test.dir}/jacoco.exec">
|
---|
354 | <junit printsummary="yes" fork="true" forkmode="once">
|
---|
355 | <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
|
---|
356 | <sysproperty key="josm.test.data" value="${test.dir}/data"/>
|
---|
357 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
358 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
359 | <classpath>
|
---|
360 | <path refid="test.classpath"/>
|
---|
361 | <pathelement path="${test.dir}/build/unit"/>
|
---|
362 | <pathelement path="${test.dir}/build/@{testfamily}"/>
|
---|
363 | <pathelement path="${test.dir}/config"/>
|
---|
364 | </classpath>
|
---|
365 | <formatter type="plain"/>
|
---|
366 | <formatter type="xml"/>
|
---|
367 | <batchtest fork="yes" todir="${test.dir}/report">
|
---|
368 | <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
|
---|
369 | </batchtest>
|
---|
370 | </junit>
|
---|
371 | </jacoco:coverage>
|
---|
372 | </sequential>
|
---|
373 | </macrodef>
|
---|
374 | <target name="test" depends="test-compile"
|
---|
375 | description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
376 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
|
---|
377 | <call-junit testfamily="unit"/>
|
---|
378 | <call-junit testfamily="functional"/>
|
---|
379 | <call-junit testfamily="performance"/>
|
---|
380 | </target>
|
---|
381 | <target name="test-html" depends="test" description="Generate HTML test reports">
|
---|
382 | <!-- May require additional ant dependencies like ant-trax package -->
|
---|
383 | <junitreport todir="${test.dir}/report">
|
---|
384 | <fileset dir="${test.dir}/report">
|
---|
385 | <include name="TEST-*.xml"/>
|
---|
386 | </fileset>
|
---|
387 | <report todir="${test.dir}/report/html"/>
|
---|
388 | </junitreport>
|
---|
389 | <jacoco:report>
|
---|
390 | <executiondata>
|
---|
391 | <file file="${test.dir}/jacoco.exec"/>
|
---|
392 | </executiondata>
|
---|
393 | <structure name="JOSM Test Coverage">
|
---|
394 | <classfiles>
|
---|
395 | <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
|
---|
396 | </classfiles>
|
---|
397 | <sourcefiles encoding="UTF-8">
|
---|
398 | <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
|
---|
399 | </sourcefiles>
|
---|
400 | </structure>
|
---|
401 | <html destdir="${test.dir}/report/jacoco"/>
|
---|
402 | </jacoco:report>
|
---|
403 | </target>
|
---|
404 | <target name="dist-optimized" depends="dist">
|
---|
405 | <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
|
---|
406 | <proguard>
|
---|
407 | -injars dist/josm-custom.jar
|
---|
408 | -outjars dist/josm-custom-optimized.jar
|
---|
409 |
|
---|
410 | -libraryjars ${java.home}/lib/rt.jar
|
---|
411 | -libraryjars ${java.home}/lib/jce.jar
|
---|
412 |
|
---|
413 | -dontoptimize
|
---|
414 | -dontobfuscate
|
---|
415 |
|
---|
416 | # These options probably are not necessary (and make processing a bit slower)
|
---|
417 | -dontskipnonpubliclibraryclasses
|
---|
418 | -dontskipnonpubliclibraryclassmembers
|
---|
419 |
|
---|
420 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
421 | public static void main(java.lang.String[]);
|
---|
422 | }
|
---|
423 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
|
---|
424 |
|
---|
425 | -keep class JOSM
|
---|
426 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
427 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
428 | -keep class org.openstreetmap.josm.data.imagery.types.Adapter1
|
---|
429 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
430 |
|
---|
431 | -keepclassmembers enum * {
|
---|
432 | public static **[] values();
|
---|
433 | public static ** valueOf(java.lang.String);
|
---|
434 | }
|
---|
435 |
|
---|
436 | # Keep unused public methods (can be useful for plugins)
|
---|
437 | -keepclassmembers class * {
|
---|
438 | public protected *;
|
---|
439 | }
|
---|
440 |
|
---|
441 | # 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
|
---|
442 | -dontnote
|
---|
443 | </proguard>
|
---|
444 | </target>
|
---|
445 | <target name="check-plugins" depends="dist-optimized">
|
---|
446 | <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
|
---|
447 | <local name="dir"/>
|
---|
448 | <local name="plugins"/>
|
---|
449 | <property name="dir" value="plugin-check"/>
|
---|
450 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
|
---|
451 | <classpath path="tools/animal-sniffer-ant-tasks-1.8.jar"/>
|
---|
452 | </typedef>
|
---|
453 | <mkdir dir="${dir}"/>
|
---|
454 | <!-- List of deprecated plugins -->
|
---|
455 | <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
|
---|
456 | <filterchain>
|
---|
457 | <linecontains>
|
---|
458 | <contains value="new DeprecatedPlugin("/>
|
---|
459 | </linecontains>
|
---|
460 | <tokenfilter>
|
---|
461 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
|
---|
462 | </tokenfilter>
|
---|
463 | <striplinebreaks/>
|
---|
464 | <tokenfilter>
|
---|
465 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
466 | </tokenfilter>
|
---|
467 | </filterchain>
|
---|
468 | </loadfile>
|
---|
469 | <!-- Download list of plugins -->
|
---|
470 | <loadresource property="plugins">
|
---|
471 | <url url="https://josm.openstreetmap.de/plugin"/>
|
---|
472 | <filterchain>
|
---|
473 | <linecontainsregexp negate="true">
|
---|
474 | <regexp pattern="^\t.*"/>
|
---|
475 | </linecontainsregexp>
|
---|
476 | <linecontainsregexp negate="true">
|
---|
477 | <regexp pattern="${deprecated-plugins}"/>
|
---|
478 | </linecontainsregexp>
|
---|
479 | <tokenfilter>
|
---|
480 | <replaceregex pattern="^.*;" replace="" flags="gi"/>
|
---|
481 | </tokenfilter>
|
---|
482 | </filterchain>
|
---|
483 | </loadresource>
|
---|
484 | <!-- Delete files that are not in plugin list (like old plugins) -->
|
---|
485 | <loadresource property="file-list">
|
---|
486 | <propertyresource name="plugins"/>
|
---|
487 | <filterchain>
|
---|
488 | <tokenfilter>
|
---|
489 | <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
|
---|
490 | </tokenfilter>
|
---|
491 | <striplinebreaks/>
|
---|
492 | <tokenfilter>
|
---|
493 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
494 | </tokenfilter>
|
---|
495 | </filterchain>
|
---|
496 | </loadresource>
|
---|
497 | <delete>
|
---|
498 | <restrict>
|
---|
499 | <fileset dir="${dir}"/>
|
---|
500 | <not>
|
---|
501 | <name regex="${file-list}"/>
|
---|
502 | </not>
|
---|
503 | </restrict>
|
---|
504 | </delete>
|
---|
505 | <!-- Download plugins -->
|
---|
506 | <copy todir="${dir}" flatten="true">
|
---|
507 | <resourcelist>
|
---|
508 | <string value="${plugins}"/>
|
---|
509 | </resourcelist>
|
---|
510 | </copy>
|
---|
511 | <!-- Check plugins -->
|
---|
512 | <as:build-signatures destfile="${dir}/api.sig">
|
---|
513 | <path>
|
---|
514 | <fileset file="dist/josm-custom-optimized.jar"/>
|
---|
515 | <fileset file="${java.home}/lib/rt.jar"/>
|
---|
516 | <fileset file="${java.home}/lib/jce.jar"/>
|
---|
517 | </path>
|
---|
518 | </as:build-signatures>
|
---|
519 | <as:check-signature signature="${dir}/api.sig">
|
---|
520 | <ignore classname="org.jgraph.*"/>
|
---|
521 | <ignore classname="com.touchgraph.*"/>
|
---|
522 | <ignore classname="com.sun.xml.fastinfoset.*"/>
|
---|
523 | <ignore classname="javax.jms.*"/>
|
---|
524 | <ignore classname="org.jvnet.staxex.*"/>
|
---|
525 | <ignore classname="javax.mail.*"/>
|
---|
526 | <ignore classname="com.sun.jdmk.*"/>
|
---|
527 | <ignore classname="org.apache.avalon.framework.logger.Logger"/>
|
---|
528 | <ignore classname="org.apache.log.*"/>
|
---|
529 | <ignore classname="junit.*"/>
|
---|
530 | <path path="${dir}"/>
|
---|
531 | </as:check-signature>
|
---|
532 | </target>
|
---|
533 |
|
---|
534 | <target name="findbugs" depends="dist">
|
---|
535 | <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
|
---|
536 | <path id="findbugs-classpath">
|
---|
537 | <fileset dir="tools/findbugs/">
|
---|
538 | <include name="*.jar"/>
|
---|
539 | </fileset>
|
---|
540 | </path>
|
---|
541 | <property name="findbugs-classpath" refid="findbugs-classpath"/>
|
---|
542 | <findbugs output="xml"
|
---|
543 | outputFile="findbugs-josm.xml"
|
---|
544 | classpath="${findbugs-classpath}"
|
---|
545 | pluginList=""
|
---|
546 | excludeFilter="tools/findbugs/josm-filter.xml"
|
---|
547 | effort="max"
|
---|
548 | >
|
---|
549 | <sourcePath path="${basedir}/src" />
|
---|
550 | <class location="${basedir}/dist/josm-custom.jar" />
|
---|
551 | </findbugs>
|
---|
552 | </target>
|
---|
553 | <target name="run" depends="dist">
|
---|
554 | <java jar="dist/josm-custom.jar" fork="true">
|
---|
555 | <arg value="--set=expert=true"/>
|
---|
556 | <arg value="--set=remotecontrol.enabled=true"/>
|
---|
557 | <arg value="--set=debug.edt-checker.enable=false"/>
|
---|
558 | <jvmarg value="-Djosm.home=/tmp/.josm/"/>
|
---|
559 | </java>
|
---|
560 | </target>
|
---|
561 |
|
---|
562 | </project>
|
---|