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 | <bundledocument extensions="osm" icon="macosx/JOSM.app/Contents/Resources/JOSM.icns" name="OSM files" role="editor"/>
|
---|
156 |
|
---|
157 | <classpath file="${bundle.jar}"/>
|
---|
158 |
|
---|
159 | <option value="-Xmx512m"/>
|
---|
160 |
|
---|
161 | <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
|
---|
162 | <option value="-Xdock:name=JOSM"/>
|
---|
163 |
|
---|
164 | <!-- OSX specific options, optional -->
|
---|
165 | <option value="-Dapple.laf.useScreenMenuBar=true"/>
|
---|
166 | <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
|
---|
167 | <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
|
---|
168 | <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
|
---|
169 | <option value="-Dcom.apple.smallTabs=true"/>
|
---|
170 | </bundleapp>
|
---|
171 |
|
---|
172 | <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
|
---|
173 | <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/>
|
---|
174 |
|
---|
175 | <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
|
---|
176 | <insert position="before" path="/plist/dict/key[1]"><![CDATA[<key>CFBundleAllowMixedLocalizations</key>
|
---|
177 | <string>true</string>
|
---|
178 | ]]></insert>
|
---|
179 | </xmltask>
|
---|
180 |
|
---|
181 | <!-- create ZIP file with MacOS X application bundle -->
|
---|
182 | <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
|
---|
183 | <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
|
---|
184 | <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
|
---|
185 | </zip>
|
---|
186 | </target>
|
---|
187 | <target name="distmac" depends="dist">
|
---|
188 | <antcall target="mac">
|
---|
189 | <param name="bundle.outdir" value="dist"/>
|
---|
190 | <param name="bundle.jar" value="dist/josm-custom.jar"/>
|
---|
191 | </antcall>
|
---|
192 | </target>
|
---|
193 | <target name="javacc" depends="init" unless="javacc.notRequired">
|
---|
194 | <mkdir dir="${mapcss.dir}/parsergen"/>
|
---|
195 | <exec append="false" executable="java" failifexecutionfails="true">
|
---|
196 | <arg value="-cp"/>
|
---|
197 | <arg value="${javacc.home}/javacc.jar"/>
|
---|
198 | <arg value="javacc"/>
|
---|
199 | <arg value="-DEBUG_PARSER=false"/>
|
---|
200 | <arg value="-DEBUG_TOKEN_MANAGER=false"/>
|
---|
201 | <arg value="-JDK_VERSION=1.7"/>
|
---|
202 | <arg value="-GRAMMAR_ENCODING=UTF-8"/>
|
---|
203 | <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
|
---|
204 | <arg value="${mapcss.dir}/MapCSSParser.jj"/>
|
---|
205 | </exec>
|
---|
206 | </target>
|
---|
207 | <target name="-jaxb_win" if="isWindows">
|
---|
208 | <property name="xjc" value="${java.home}\..\bin\xjc.exe" />
|
---|
209 | </target>
|
---|
210 | <target name="-jaxb_nix" unless="isWindows">
|
---|
211 | <property name="xjc" value="${java.home}/../bin/xjc" />
|
---|
212 | </target>
|
---|
213 | <target name="jaxb" depends="init, -jaxb_win, -jaxb_nix" unless="jaxb.notRequired">
|
---|
214 | <exec executable="${xjc}" failonerror="true">
|
---|
215 | <arg value="-d"/>
|
---|
216 | <arg value="${src.dir}"/>
|
---|
217 | <arg value="-encoding"/>
|
---|
218 | <arg value="UTF-8"/>
|
---|
219 | <arg value="data_nodist/wms-cache.xsd"/>
|
---|
220 | </exec>
|
---|
221 | </target>
|
---|
222 | <target name="compile" depends="init,javacc,jaxb">
|
---|
223 | <!-- COTS -->
|
---|
224 | <javac srcdir="${src.dir}" includes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**" nowarn="on"
|
---|
225 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="iso-8859-1">
|
---|
226 | <!-- get rid of "internal proprietary API" warning -->
|
---|
227 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
228 | </javac>
|
---|
229 | <!-- JMapViewer/JOSM -->
|
---|
230 | <javac srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
|
---|
231 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
|
---|
232 | <compilerarg value="-Xlint:cast"/>
|
---|
233 | <compilerarg value="-Xlint:deprecation"/>
|
---|
234 | <compilerarg value="-Xlint:dep-ann"/>
|
---|
235 | <compilerarg value="-Xlint:divzero"/>
|
---|
236 | <compilerarg value="-Xlint:empty"/>
|
---|
237 | <compilerarg value="-Xlint:finally"/>
|
---|
238 | <compilerarg value="-Xlint:overrides"/>
|
---|
239 | <!--<compilerarg value="-Xlint:rawtypes"/>-->
|
---|
240 | <compilerarg value="-Xlint:static"/>
|
---|
241 | <compilerarg value="-Xlint:try"/>
|
---|
242 | <compilerarg value="-Xlint:unchecked"/>
|
---|
243 | </javac>
|
---|
244 | <copy todir="build" failonerror="no" includeemptydirs="no">
|
---|
245 | <fileset dir="resources"/>
|
---|
246 | </copy>
|
---|
247 | </target>
|
---|
248 | <target name="init">
|
---|
249 | <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
|
---|
250 | <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
|
---|
251 | </uptodate>
|
---|
252 | <uptodate property="jaxb.notRequired" targetfile="${src.dir}/org/openstreetmap/josm/data/imagery/types/package-info.java" >
|
---|
253 | <srcfiles dir="data_nodist" includes="wms-cache.xsd"/>
|
---|
254 | </uptodate>
|
---|
255 | <mkdir dir="build"/>
|
---|
256 | <mkdir dir="dist"/>
|
---|
257 | </target>
|
---|
258 | <target name="javadoc">
|
---|
259 | <javadoc destdir="javadoc"
|
---|
260 | sourcepath="${src.dir}"
|
---|
261 | encoding="UTF-8"
|
---|
262 | packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
|
---|
263 | windowtitle="JOSM"
|
---|
264 | use="true"
|
---|
265 | private="true"
|
---|
266 | linksource="true"
|
---|
267 | author="false">
|
---|
268 | <link href="http://docs.oracle.com/javase/7/docs/api"/>
|
---|
269 | <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
|
---|
270 | <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
|
---|
271 | </javadoc>
|
---|
272 | </target>
|
---|
273 | <target name="clean">
|
---|
274 | <delete dir="build"/>
|
---|
275 | <delete dir="dist"/>
|
---|
276 | <delete dir="${mapcss.dir}/parsergen"/>
|
---|
277 | <delete dir="${imagerytypes.dir}"/>
|
---|
278 | </target>
|
---|
279 | <path id="test.classpath">
|
---|
280 | <fileset dir="${test.dir}/lib">
|
---|
281 | <include name="**/*.jar"/>
|
---|
282 | </fileset>
|
---|
283 | <fileset dir="lib">
|
---|
284 | <include name="**/*.jar"/>
|
---|
285 | </fileset>
|
---|
286 | <pathelement path="dist/josm-custom.jar"/>
|
---|
287 | <pathelement path="tools/groovy-all-2.3.2.jar"/>
|
---|
288 | </path>
|
---|
289 | <macrodef name="init-test-preferences">
|
---|
290 | <attribute name="testfamily"/>
|
---|
291 | <sequential>
|
---|
292 | <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
|
---|
293 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
294 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
295 | </sequential>
|
---|
296 | </macrodef>
|
---|
297 | <target name="test-init">
|
---|
298 | <mkdir dir="${test.dir}/build"/>
|
---|
299 | <mkdir dir="${test.dir}/build/unit"/>
|
---|
300 | <mkdir dir="${test.dir}/build/functional"/>
|
---|
301 | <mkdir dir="${test.dir}/build/performance"/>
|
---|
302 | <mkdir dir="${test.dir}/report"/>
|
---|
303 | <init-test-preferences testfamily="unit"/>
|
---|
304 | <init-test-preferences testfamily="functional"/>
|
---|
305 | <init-test-preferences testfamily="performance"/>
|
---|
306 | </target>
|
---|
307 | <target name="test-clean">
|
---|
308 | <delete dir="${test.dir}/build"/>
|
---|
309 | <delete dir="${test.dir}/report"/>
|
---|
310 | <delete file="${test.dir}/jacoco.exec" />
|
---|
311 | <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
|
---|
312 | <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
|
---|
313 | <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
|
---|
314 | <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
|
---|
315 | <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
|
---|
316 | <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
|
---|
317 | </target>
|
---|
318 | <macrodef name="call-groovyc">
|
---|
319 | <attribute name="testfamily"/>
|
---|
320 | <element name="cp-elements"/>
|
---|
321 | <sequential>
|
---|
322 | <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
|
---|
323 | <classpath>
|
---|
324 | <cp-elements/>
|
---|
325 | </classpath>
|
---|
326 | <javac target="1.7" source="1.7" debug="on">
|
---|
327 | <compilerarg value="-Xlint:all"/>
|
---|
328 | <compilerarg value="-Xlint:-serial"/>
|
---|
329 | </javac>
|
---|
330 | </groovyc>
|
---|
331 | </sequential>
|
---|
332 | </macrodef>
|
---|
333 | <target name="test-compile" depends="test-init,dist">
|
---|
334 | <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.3.2.jar"/>
|
---|
335 | <call-groovyc testfamily="unit">
|
---|
336 | <cp-elements>
|
---|
337 | <path refid="test.classpath"/>
|
---|
338 | </cp-elements>
|
---|
339 | </call-groovyc>
|
---|
340 | <call-groovyc testfamily="functional">
|
---|
341 | <cp-elements>
|
---|
342 | <path refid="test.classpath"/>
|
---|
343 | <pathelement path="${test.dir}/build/unit"/>
|
---|
344 | </cp-elements>
|
---|
345 | </call-groovyc>
|
---|
346 | <call-groovyc testfamily="performance">
|
---|
347 | <cp-elements>
|
---|
348 | <path refid="test.classpath"/>
|
---|
349 | <pathelement path="${test.dir}/build/unit"/>
|
---|
350 | </cp-elements>
|
---|
351 | </call-groovyc>
|
---|
352 | </target>
|
---|
353 | <macrodef name="call-junit">
|
---|
354 | <attribute name="testfamily"/>
|
---|
355 | <sequential>
|
---|
356 | <echo message="Running @{testfamily} tests with JUnit"/>
|
---|
357 | <jacoco:coverage destfile="${test.dir}/jacoco.exec">
|
---|
358 | <junit printsummary="yes" fork="true" forkmode="once">
|
---|
359 | <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
|
---|
360 | <sysproperty key="josm.test.data" value="${test.dir}/data"/>
|
---|
361 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
362 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
363 | <classpath>
|
---|
364 | <path refid="test.classpath"/>
|
---|
365 | <pathelement path="${test.dir}/build/unit"/>
|
---|
366 | <pathelement path="${test.dir}/build/@{testfamily}"/>
|
---|
367 | <pathelement path="${test.dir}/config"/>
|
---|
368 | </classpath>
|
---|
369 | <formatter type="plain"/>
|
---|
370 | <formatter type="xml"/>
|
---|
371 | <batchtest fork="yes" todir="${test.dir}/report">
|
---|
372 | <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
|
---|
373 | </batchtest>
|
---|
374 | </junit>
|
---|
375 | </jacoco:coverage>
|
---|
376 | </sequential>
|
---|
377 | </macrodef>
|
---|
378 | <target name="test" depends="test-compile"
|
---|
379 | description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
380 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
|
---|
381 | <call-junit testfamily="unit"/>
|
---|
382 | <call-junit testfamily="functional"/>
|
---|
383 | <call-junit testfamily="performance"/>
|
---|
384 | </target>
|
---|
385 | <target name="test-html" depends="test" description="Generate HTML test reports">
|
---|
386 | <!-- May require additional ant dependencies like ant-trax package -->
|
---|
387 | <junitreport todir="${test.dir}/report">
|
---|
388 | <fileset dir="${test.dir}/report">
|
---|
389 | <include name="TEST-*.xml"/>
|
---|
390 | </fileset>
|
---|
391 | <report todir="${test.dir}/report/html"/>
|
---|
392 | </junitreport>
|
---|
393 | <jacoco:report>
|
---|
394 | <executiondata>
|
---|
395 | <file file="${test.dir}/jacoco.exec"/>
|
---|
396 | </executiondata>
|
---|
397 | <structure name="JOSM Test Coverage">
|
---|
398 | <classfiles>
|
---|
399 | <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
|
---|
400 | </classfiles>
|
---|
401 | <sourcefiles encoding="UTF-8">
|
---|
402 | <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
|
---|
403 | </sourcefiles>
|
---|
404 | </structure>
|
---|
405 | <html destdir="${test.dir}/report/jacoco"/>
|
---|
406 | </jacoco:report>
|
---|
407 | </target>
|
---|
408 | <target name="dist-optimized" depends="dist">
|
---|
409 | <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
|
---|
410 | <proguard>
|
---|
411 | -injars dist/josm-custom.jar
|
---|
412 | -outjars dist/josm-custom-optimized.jar
|
---|
413 |
|
---|
414 | -libraryjars ${java.home}/lib/rt.jar
|
---|
415 | -libraryjars ${java.home}/lib/jce.jar
|
---|
416 |
|
---|
417 | -dontoptimize
|
---|
418 | -dontobfuscate
|
---|
419 |
|
---|
420 | # These options probably are not necessary (and make processing a bit slower)
|
---|
421 | -dontskipnonpubliclibraryclasses
|
---|
422 | -dontskipnonpubliclibraryclassmembers
|
---|
423 |
|
---|
424 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
425 | public static void main(java.lang.String[]);
|
---|
426 | }
|
---|
427 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
|
---|
428 |
|
---|
429 | -keep class JOSM
|
---|
430 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
431 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
432 | -keep class org.openstreetmap.josm.data.imagery.types.Adapter1
|
---|
433 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
434 |
|
---|
435 | -keepclassmembers enum * {
|
---|
436 | public static **[] values();
|
---|
437 | public static ** valueOf(java.lang.String);
|
---|
438 | }
|
---|
439 |
|
---|
440 | # Keep unused public methods (can be useful for plugins)
|
---|
441 | -keepclassmembers class * {
|
---|
442 | public protected *;
|
---|
443 | }
|
---|
444 |
|
---|
445 | # 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
|
---|
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.8.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="org.jgraph.*"/>
|
---|
525 | <ignore classname="com.touchgraph.*"/>
|
---|
526 | <ignore classname="com.sun.xml.fastinfoset.*"/>
|
---|
527 | <ignore classname="javax.jms.*"/>
|
---|
528 | <ignore classname="org.jvnet.staxex.*"/>
|
---|
529 | <ignore classname="javax.mail.*"/>
|
---|
530 | <ignore classname="com.sun.jdmk.*"/>
|
---|
531 | <ignore classname="org.apache.avalon.framework.logger.Logger"/>
|
---|
532 | <ignore classname="org.apache.log.*"/>
|
---|
533 | <ignore classname="junit.*"/>
|
---|
534 | <path path="${dir}"/>
|
---|
535 | </as:check-signature>
|
---|
536 | </target>
|
---|
537 |
|
---|
538 | <target name="findbugs" depends="dist">
|
---|
539 | <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
|
---|
540 | <path id="findbugs-classpath">
|
---|
541 | <fileset dir="tools/findbugs/">
|
---|
542 | <include name="*.jar"/>
|
---|
543 | </fileset>
|
---|
544 | </path>
|
---|
545 | <property name="findbugs-classpath" refid="findbugs-classpath"/>
|
---|
546 | <findbugs output="xml"
|
---|
547 | outputFile="findbugs-josm.xml"
|
---|
548 | classpath="${findbugs-classpath}"
|
---|
549 | pluginList=""
|
---|
550 | excludeFilter="tools/findbugs/josm-filter.xml"
|
---|
551 | effort="max"
|
---|
552 | >
|
---|
553 | <sourcePath path="${basedir}/src" />
|
---|
554 | <class location="${basedir}/dist/josm-custom.jar" />
|
---|
555 | </findbugs>
|
---|
556 | </target>
|
---|
557 | <target name="run" depends="dist">
|
---|
558 | <java jar="dist/josm-custom.jar" fork="true">
|
---|
559 | <arg value="--set=expert=true"/>
|
---|
560 | <arg value="--set=remotecontrol.enabled=true"/>
|
---|
561 | <arg value="--set=debug.edt-checker.enable=false"/>
|
---|
562 | <jvmarg value="-Djosm.home=/tmp/.josm/"/>
|
---|
563 | </java>
|
---|
564 | </target>
|
---|
565 |
|
---|
566 | </project>
|
---|