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 | </jar>
|
---|
131 | </target>
|
---|
132 | <!-- Mac OS X target -->
|
---|
133 | <target name="mac">
|
---|
134 | <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
|
---|
135 | <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="tools/appbundler-1.0ea.jar"/>
|
---|
136 | <!-- create MacOS X application bundle -->
|
---|
137 | <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
|
---|
138 | mainclassname="org.openstreetmap.josm.gui.MainApplication"
|
---|
139 | copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
|
---|
140 | applicationCategory="public.app-category.utilities"
|
---|
141 | shortversion="${version.entry.commit.revision} SVN"
|
---|
142 | version="${version.entry.commit.revision} SVN"
|
---|
143 | icon="macosx/JOSM.app/Contents/Resources/JOSM.icns"
|
---|
144 | highResolutionCapable="true">
|
---|
145 |
|
---|
146 | <arch name="x86_64"/>
|
---|
147 | <arch name="i386"/>
|
---|
148 |
|
---|
149 | <classpath file="${bundle.jar}"/>
|
---|
150 |
|
---|
151 | <option value="-Xmx1024m"/>
|
---|
152 |
|
---|
153 | <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
|
---|
154 | <option value="-Xdock:name=JOSM"/>
|
---|
155 |
|
---|
156 | <!-- OSX specific options, optional -->
|
---|
157 | <option value="-Dapple.laf.useScreenMenuBar=true"/>
|
---|
158 | <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
|
---|
159 | <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
|
---|
160 | <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
|
---|
161 | <option value="-Dcom.apple.smallTabs=true"/>
|
---|
162 | </bundleapp>
|
---|
163 |
|
---|
164 | <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
|
---|
165 | <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/>
|
---|
166 |
|
---|
167 | <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
|
---|
168 | <!-- remove empty CFBundleDocumentTypes definition -->
|
---|
169 | <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/>
|
---|
170 | <!-- insert our own keys -->
|
---|
171 | <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" />
|
---|
172 | </xmltask>
|
---|
173 |
|
---|
174 | <!-- create ZIP file with MacOS X application bundle -->
|
---|
175 | <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
|
---|
176 | <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
|
---|
177 | <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
|
---|
178 | </zip>
|
---|
179 | </target>
|
---|
180 | <target name="distmac" depends="dist">
|
---|
181 | <antcall target="mac">
|
---|
182 | <param name="bundle.outdir" value="dist"/>
|
---|
183 | <param name="bundle.jar" value="dist/josm-custom.jar"/>
|
---|
184 | </antcall>
|
---|
185 | </target>
|
---|
186 | <target name="javacc" depends="init" unless="javacc.notRequired">
|
---|
187 | <mkdir dir="${mapcss.dir}/parsergen"/>
|
---|
188 | <exec append="false" executable="java" failifexecutionfails="true">
|
---|
189 | <arg value="-cp"/>
|
---|
190 | <arg value="${javacc.home}/javacc.jar"/>
|
---|
191 | <arg value="javacc"/>
|
---|
192 | <arg value="-DEBUG_PARSER=false"/>
|
---|
193 | <arg value="-DEBUG_TOKEN_MANAGER=false"/>
|
---|
194 | <arg value="-JDK_VERSION=1.7"/>
|
---|
195 | <arg value="-GRAMMAR_ENCODING=UTF-8"/>
|
---|
196 | <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
|
---|
197 | <arg value="${mapcss.dir}/MapCSSParser.jj"/>
|
---|
198 | </exec>
|
---|
199 | </target>
|
---|
200 | <target name="-jaxb_win" if="isWindows">
|
---|
201 | <property name="xjc" value="${java.home}\..\bin\xjc.exe" />
|
---|
202 | </target>
|
---|
203 | <target name="-jaxb_nix" unless="isWindows">
|
---|
204 | <property name="xjc" value="${java.home}/../bin/xjc" />
|
---|
205 | </target>
|
---|
206 | <target name="jaxb" depends="init, -jaxb_win, -jaxb_nix" unless="jaxb.notRequired">
|
---|
207 | <exec executable="${xjc}" failonerror="true">
|
---|
208 | <arg value="-d"/>
|
---|
209 | <arg value="${src.dir}"/>
|
---|
210 | <arg value="-encoding"/>
|
---|
211 | <arg value="UTF-8"/>
|
---|
212 | <arg value="data_nodist/wms-cache.xsd"/>
|
---|
213 | </exec>
|
---|
214 | </target>
|
---|
215 | <target name="compile" depends="init,javacc,jaxb">
|
---|
216 | <!-- COTS -->
|
---|
217 | <javac srcdir="${src.dir}" includes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**" nowarn="on"
|
---|
218 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="iso-8859-1">
|
---|
219 | <!-- get rid of "internal proprietary API" warning -->
|
---|
220 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
221 | </javac>
|
---|
222 | <!-- JMapViewer/JOSM -->
|
---|
223 | <javac srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
|
---|
224 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
|
---|
225 | <compilerarg value="-Xlint:cast"/>
|
---|
226 | <compilerarg value="-Xlint:deprecation"/>
|
---|
227 | <compilerarg value="-Xlint:dep-ann"/>
|
---|
228 | <compilerarg value="-Xlint:divzero"/>
|
---|
229 | <compilerarg value="-Xlint:empty"/>
|
---|
230 | <compilerarg value="-Xlint:finally"/>
|
---|
231 | <compilerarg value="-Xlint:overrides"/>
|
---|
232 | <!--<compilerarg value="-Xlint:rawtypes"/>-->
|
---|
233 | <compilerarg value="-Xlint:static"/>
|
---|
234 | <compilerarg value="-Xlint:try"/>
|
---|
235 | <compilerarg value="-Xlint:unchecked"/>
|
---|
236 | <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
|
---|
237 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
238 | </javac>
|
---|
239 | <copy todir="build" failonerror="no" includeemptydirs="no">
|
---|
240 | <fileset dir="resources"/>
|
---|
241 | </copy>
|
---|
242 | </target>
|
---|
243 | <target name="init">
|
---|
244 | <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
|
---|
245 | <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
|
---|
246 | </uptodate>
|
---|
247 | <uptodate property="jaxb.notRequired" targetfile="${src.dir}/org/openstreetmap/josm/data/imagery/types/package-info.java" >
|
---|
248 | <srcfiles dir="data_nodist" includes="wms-cache.xsd"/>
|
---|
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.6.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" encoding="UTF-8">
|
---|
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.6.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 | <jvmarg value="-Dfile.encoding=UTF-8"/>
|
---|
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.w3._2001.xmlschema.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 '...'.
|
---|
442 | # This note should not be a problem as we don't use obfuscation
|
---|
443 | -dontnote
|
---|
444 | </proguard>
|
---|
445 | </target>
|
---|
446 | <target name="check-plugins" depends="dist-optimized">
|
---|
447 | <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
|
---|
448 | <local name="dir"/>
|
---|
449 | <local name="plugins"/>
|
---|
450 | <property name="dir" value="plugin-check"/>
|
---|
451 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
|
---|
452 | <classpath path="tools/animal-sniffer-ant-tasks-1.11.jar"/>
|
---|
453 | </typedef>
|
---|
454 | <mkdir dir="${dir}"/>
|
---|
455 | <!-- List of deprecated plugins -->
|
---|
456 | <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
|
---|
457 | <filterchain>
|
---|
458 | <linecontains>
|
---|
459 | <contains value="new DeprecatedPlugin("/>
|
---|
460 | </linecontains>
|
---|
461 | <tokenfilter>
|
---|
462 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
|
---|
463 | </tokenfilter>
|
---|
464 | <striplinebreaks/>
|
---|
465 | <tokenfilter>
|
---|
466 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
467 | </tokenfilter>
|
---|
468 | </filterchain>
|
---|
469 | </loadfile>
|
---|
470 | <!-- Download list of plugins -->
|
---|
471 | <loadresource property="plugins">
|
---|
472 | <url url="https://josm.openstreetmap.de/plugin"/>
|
---|
473 | <filterchain>
|
---|
474 | <linecontainsregexp negate="true">
|
---|
475 | <regexp pattern="^\t.*"/>
|
---|
476 | </linecontainsregexp>
|
---|
477 | <linecontainsregexp negate="true">
|
---|
478 | <regexp pattern="${deprecated-plugins}"/>
|
---|
479 | </linecontainsregexp>
|
---|
480 | <tokenfilter>
|
---|
481 | <replaceregex pattern="^.*;" replace="" flags="gi"/>
|
---|
482 | </tokenfilter>
|
---|
483 | </filterchain>
|
---|
484 | </loadresource>
|
---|
485 | <!-- Delete files that are not in plugin list (like old plugins) -->
|
---|
486 | <loadresource property="file-list">
|
---|
487 | <propertyresource name="plugins"/>
|
---|
488 | <filterchain>
|
---|
489 | <tokenfilter>
|
---|
490 | <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
|
---|
491 | </tokenfilter>
|
---|
492 | <striplinebreaks/>
|
---|
493 | <tokenfilter>
|
---|
494 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
495 | </tokenfilter>
|
---|
496 | </filterchain>
|
---|
497 | </loadresource>
|
---|
498 | <delete>
|
---|
499 | <restrict>
|
---|
500 | <fileset dir="${dir}"/>
|
---|
501 | <not>
|
---|
502 | <name regex="${file-list}"/>
|
---|
503 | </not>
|
---|
504 | </restrict>
|
---|
505 | </delete>
|
---|
506 | <!-- Download plugins -->
|
---|
507 | <copy todir="${dir}" flatten="true">
|
---|
508 | <resourcelist>
|
---|
509 | <string value="${plugins}"/>
|
---|
510 | </resourcelist>
|
---|
511 | </copy>
|
---|
512 | <!-- Check plugins -->
|
---|
513 | <as:build-signatures destfile="${dir}/api.sig">
|
---|
514 | <path>
|
---|
515 | <fileset file="dist/josm-custom-optimized.jar"/>
|
---|
516 | <fileset file="${java.home}/lib/rt.jar"/>
|
---|
517 | <fileset file="${java.home}/lib/jce.jar"/>
|
---|
518 | </path>
|
---|
519 | </as:build-signatures>
|
---|
520 | <as:check-signature signature="${dir}/api.sig">
|
---|
521 | <ignore classname="au.edu.*"/>
|
---|
522 | <ignore classname="au.com.*"/>
|
---|
523 | <ignore classname="com.*"/>
|
---|
524 | <ignore classname="javax.*"/>
|
---|
525 | <ignore classname="jogamp.*"/>
|
---|
526 | <ignore classname="junit.*"/>
|
---|
527 | <ignore classname="net.sf.*"/>
|
---|
528 | <ignore classname="nu.xom.*"/>
|
---|
529 | <ignore classname="org.apache.*"/>
|
---|
530 | <ignore classname="org.codehaus.*"/>
|
---|
531 | <ignore classname="org.dom4j.*"/>
|
---|
532 | <ignore classname="org.hsqldb.*"/>
|
---|
533 | <ignore classname="org.ibex.*"/>
|
---|
534 | <ignore classname="org.jaitools.*"/>
|
---|
535 | <ignore classname="org.jaxen.*"/>
|
---|
536 | <ignore classname="org.jdom2.*"/>
|
---|
537 | <ignore classname="org.jgraph.*"/>
|
---|
538 | <ignore classname="org.joda.time.*"/>
|
---|
539 | <ignore classname="org.jvnet.staxex.*"/>
|
---|
540 | <ignore classname="org.kxml2.*"/>
|
---|
541 | <ignore classname="org.python.*"/>
|
---|
542 | <ignore classname="org.slf4j.*"/>
|
---|
543 | <path path="${dir}"/>
|
---|
544 | </as:check-signature>
|
---|
545 | </target>
|
---|
546 |
|
---|
547 | <target name="findbugs" depends="dist">
|
---|
548 | <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
|
---|
549 | <path id="findbugs-classpath">
|
---|
550 | <fileset dir="tools/findbugs/">
|
---|
551 | <include name="*.jar"/>
|
---|
552 | </fileset>
|
---|
553 | </path>
|
---|
554 | <property name="findbugs-classpath" refid="findbugs-classpath"/>
|
---|
555 | <findbugs output="xml"
|
---|
556 | outputFile="findbugs-josm.xml"
|
---|
557 | classpath="${findbugs-classpath}"
|
---|
558 | pluginList=""
|
---|
559 | excludeFilter="tools/findbugs/josm-filter.xml"
|
---|
560 | effort="max"
|
---|
561 | >
|
---|
562 | <sourcePath path="${basedir}/src" />
|
---|
563 | <class location="${basedir}/dist/josm-custom.jar" />
|
---|
564 | </findbugs>
|
---|
565 | </target>
|
---|
566 | <target name="run" depends="dist">
|
---|
567 | <java jar="dist/josm-custom.jar" fork="true">
|
---|
568 | <arg value="--set=expert=true"/>
|
---|
569 | <arg value="--set=remotecontrol.enabled=true"/>
|
---|
570 | <arg value="--set=debug.edt-checker.enable=false"/>
|
---|
571 | <jvmarg value="-Djosm.home=/tmp/.josm/"/>
|
---|
572 | </java>
|
---|
573 | </target>
|
---|
574 |
|
---|
575 | </project>
|
---|