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 |
|
---|
29 | <!--
|
---|
30 | ** Used by Eclipse ant builder for updating
|
---|
31 | ** the REVISION file used by JOSM
|
---|
32 | -->
|
---|
33 | <target name="create-revision-eclipse">
|
---|
34 | <property name="revision.dir" value="bin"/>
|
---|
35 | <antcall target="create-revision"/>
|
---|
36 | </target>
|
---|
37 | <!--
|
---|
38 | ** Initializes the REVISION.XML file from SVN information
|
---|
39 | -->
|
---|
40 | <target name="init-svn-revision-xml">
|
---|
41 | <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false" resultproperty="svn.info.result">
|
---|
42 | <env key="LANG" value="C"/>
|
---|
43 | <arg value="info"/>
|
---|
44 | <arg value="--xml"/>
|
---|
45 | <arg value="."/>
|
---|
46 | </exec>
|
---|
47 | <condition property="svn.info.success">
|
---|
48 | <equals arg1="${svn.info.result}" arg2="0" />
|
---|
49 | </condition>
|
---|
50 | </target>
|
---|
51 | <!--
|
---|
52 | ** Initializes the REVISION.XML file from git information
|
---|
53 | -->
|
---|
54 | <target name="init-git-revision-xml" unless="svn.info.success">
|
---|
55 | <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false">
|
---|
56 | <arg value="log"/>
|
---|
57 | <arg value="-1"/>
|
---|
58 | <arg value="--grep=git-svn-id"/>
|
---|
59 | <!--
|
---|
60 | %B: raw body (unwrapped subject and body)
|
---|
61 | %n: new line
|
---|
62 | %ai: author date, ISO 8601 format
|
---|
63 | -->
|
---|
64 | <arg value="--pretty=format:%B%n%ai"/>
|
---|
65 | <arg value="HEAD"/>
|
---|
66 | </exec>
|
---|
67 | <replaceregexp file="REVISION.XML" flags="s"
|
---|
68 | match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
|
---|
69 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
70 | </target>
|
---|
71 | <!--
|
---|
72 | ** Creates the REVISION file to be included in the distribution
|
---|
73 | -->
|
---|
74 | <target name="create-revision" depends="init-svn-revision-xml, init-git-revision-xml">
|
---|
75 | <property name="revision.dir" value="${build.dir}"/>
|
---|
76 | <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
77 | <delete file="REVISION.XML"/>
|
---|
78 | <tstamp>
|
---|
79 | <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
|
---|
80 | </tstamp>
|
---|
81 | <property name="version.entry.commit.revision" value="UNKNOWN"/>
|
---|
82 | <property name="version.entry.commit.date" value="UNKNOWN"/>
|
---|
83 | <mkdir dir="${revision.dir}"/>
|
---|
84 | <!-- add Build-Name: ... when making special builds, e.g. DEBIAN -->
|
---|
85 | <echo file="${revision.dir}/REVISION">
|
---|
86 | # automatically generated by JOSM build.xml - do not edit
|
---|
87 | Revision: ${version.entry.commit.revision}
|
---|
88 | Is-Local-Build: true
|
---|
89 | Build-Date: ${build.tstamp}
|
---|
90 | </echo>
|
---|
91 | </target>
|
---|
92 | <!--
|
---|
93 | ** Check internal XML files against their XSD
|
---|
94 | -->
|
---|
95 | <target name="check-schemas" unless="check-schemas.notRequired">
|
---|
96 | <schemavalidate file="data/defaultpresets.xml" >
|
---|
97 | <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="data/tagging-preset.xsd" />
|
---|
98 | </schemavalidate>
|
---|
99 | </target>
|
---|
100 | <!--
|
---|
101 | ** Main target that builds JOSM and checks XML against schemas
|
---|
102 | -->
|
---|
103 | <target name="dist" depends="compile,create-revision,check-schemas">
|
---|
104 | <echo>Revision ${version.entry.commit.revision}</echo>
|
---|
105 | <copy file="CONTRIBUTION" todir="build"/>
|
---|
106 | <copy file="README" todir="build"/>
|
---|
107 | <copy file="LICENSE" todir="build"/>
|
---|
108 | <!-- create josm-custom.jar -->
|
---|
109 | <delete file="dist/josm-custom.jar"/>
|
---|
110 | <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
|
---|
111 | <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
|
---|
112 | <manifest>
|
---|
113 | <attribute name="Main-class" value="JOSM"/>
|
---|
114 | <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
|
---|
115 | <attribute name="Main-Date" value="${version.entry.commit.date}"/>
|
---|
116 | <attribute name="Permissions" value="all-permissions"/>
|
---|
117 | <attribute name="Codebase" value="josm.openstreetmap.de"/>
|
---|
118 | <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
|
---|
119 | </manifest>
|
---|
120 | <zipfileset dir="images" prefix="images"/>
|
---|
121 | <zipfileset dir="data" prefix="data"/>
|
---|
122 | <zipfileset dir="styles" prefix="styles"/>
|
---|
123 | <zipfileset dir="${src.dir}/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
|
---|
124 | </jar>
|
---|
125 | </target>
|
---|
126 | <!-- Mac OS X target -->
|
---|
127 | <target name="mac">
|
---|
128 | <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
|
---|
129 | <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="tools/appbundler-1.0ea.jar"/>
|
---|
130 | <!-- create MacOS X application bundle -->
|
---|
131 | <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
|
---|
132 | mainclassname="org.openstreetmap.josm.gui.MainApplication"
|
---|
133 | copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
|
---|
134 | applicationCategory="public.app-category.utilities"
|
---|
135 | shortversion="${version.entry.commit.revision} SVN"
|
---|
136 | version="${version.entry.commit.revision} SVN"
|
---|
137 | icon="macosx/JOSM.app/Contents/Resources/JOSM.icns"
|
---|
138 | highResolutionCapable="true">
|
---|
139 |
|
---|
140 | <arch name="x86_64"/>
|
---|
141 | <arch name="i386"/>
|
---|
142 |
|
---|
143 | <classpath file="${bundle.jar}"/>
|
---|
144 |
|
---|
145 | <option value="-Xmx1024m"/>
|
---|
146 |
|
---|
147 | <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
|
---|
148 | <option value="-Xdock:name=JOSM"/>
|
---|
149 |
|
---|
150 | <!-- OSX specific options, optional -->
|
---|
151 | <option value="-Dapple.laf.useScreenMenuBar=true"/>
|
---|
152 | <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
|
---|
153 | <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
|
---|
154 | <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
|
---|
155 | <option value="-Dcom.apple.smallTabs=true"/>
|
---|
156 | </bundleapp>
|
---|
157 |
|
---|
158 | <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
|
---|
159 | <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/>
|
---|
160 |
|
---|
161 | <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
|
---|
162 | <!-- remove empty CFBundleDocumentTypes definition -->
|
---|
163 | <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/>
|
---|
164 | <!-- insert our own keys -->
|
---|
165 | <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" />
|
---|
166 | </xmltask>
|
---|
167 |
|
---|
168 | <!-- create ZIP file with MacOS X application bundle -->
|
---|
169 | <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
|
---|
170 | <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
|
---|
171 | <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
|
---|
172 | </zip>
|
---|
173 | </target>
|
---|
174 | <target name="distmac" depends="dist">
|
---|
175 | <antcall target="mac">
|
---|
176 | <param name="bundle.outdir" value="dist"/>
|
---|
177 | <param name="bundle.jar" value="dist/josm-custom.jar"/>
|
---|
178 | </antcall>
|
---|
179 | </target>
|
---|
180 | <!-- Windows target -->
|
---|
181 | <target name="distwin" depends="dist">
|
---|
182 | <exec dir="windows" executable="josm-setup-unix.sh">
|
---|
183 | <arg value="${version.entry.commit.revision}"/>
|
---|
184 | <arg value="../dist/josm-custom.jar"/>
|
---|
185 | </exec>
|
---|
186 | </target>
|
---|
187 | <target name="javacc" depends="init" unless="javacc.notRequired">
|
---|
188 | <mkdir dir="${mapcss.dir}/parsergen"/>
|
---|
189 | <exec append="false" executable="java" failifexecutionfails="true">
|
---|
190 | <arg value="-cp"/>
|
---|
191 | <arg value="${javacc.home}/javacc.jar"/>
|
---|
192 | <arg value="javacc"/>
|
---|
193 | <arg value="-DEBUG_PARSER=false"/>
|
---|
194 | <arg value="-DEBUG_TOKEN_MANAGER=false"/>
|
---|
195 | <arg value="-JDK_VERSION=1.7"/>
|
---|
196 | <arg value="-GRAMMAR_ENCODING=UTF-8"/>
|
---|
197 | <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
|
---|
198 | <arg value="${mapcss.dir}/MapCSSParser.jj"/>
|
---|
199 | </exec>
|
---|
200 | </target>
|
---|
201 | <target name="-jaxb_win" if="isWindows">
|
---|
202 | <property name="xjc" value="${java.home}\..\bin\xjc.exe" />
|
---|
203 | </target>
|
---|
204 | <target name="-jaxb_nix" unless="isWindows">
|
---|
205 | <property name="xjc" value="${java.home}/../bin/xjc" />
|
---|
206 | </target>
|
---|
207 | <target name="jaxb" depends="init, -jaxb_win, -jaxb_nix" unless="jaxb.notRequired">
|
---|
208 | <exec executable="${xjc}" failonerror="true">
|
---|
209 | <arg value="-d"/>
|
---|
210 | <arg value="${src.dir}"/>
|
---|
211 | <arg value="-encoding"/>
|
---|
212 | <arg value="UTF-8"/>
|
---|
213 | <arg value="data_nodist/wms-cache.xsd"/>
|
---|
214 | </exec>
|
---|
215 | </target>
|
---|
216 | <target name="compile" depends="init,javacc,jaxb">
|
---|
217 | <!-- COTS -->
|
---|
218 | <javac srcdir="${src.dir}" includes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**" nowarn="on"
|
---|
219 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="iso-8859-1">
|
---|
220 | <!-- get rid of "internal proprietary API" warning -->
|
---|
221 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
222 | </javac>
|
---|
223 | <!-- JMapViewer/JOSM -->
|
---|
224 | <javac srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
|
---|
225 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
|
---|
226 | <compilerarg value="-Xlint:cast"/>
|
---|
227 | <compilerarg value="-Xlint:deprecation"/>
|
---|
228 | <compilerarg value="-Xlint:dep-ann"/>
|
---|
229 | <compilerarg value="-Xlint:divzero"/>
|
---|
230 | <compilerarg value="-Xlint:empty"/>
|
---|
231 | <compilerarg value="-Xlint:finally"/>
|
---|
232 | <compilerarg value="-Xlint:overrides"/>
|
---|
233 | <!--<compilerarg value="-Xlint:rawtypes"/>-->
|
---|
234 | <compilerarg value="-Xlint:static"/>
|
---|
235 | <compilerarg value="-Xlint:try"/>
|
---|
236 | <compilerarg value="-Xlint:unchecked"/>
|
---|
237 | <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
|
---|
238 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
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 | <pathelement path="dist/josm-custom.jar"/>
|
---|
280 | <pathelement path="tools/groovy-all-2.3.9.jar"/>
|
---|
281 | </path>
|
---|
282 | <macrodef name="init-test-preferences">
|
---|
283 | <attribute name="testfamily"/>
|
---|
284 | <sequential>
|
---|
285 | <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
|
---|
286 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
287 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
288 | </sequential>
|
---|
289 | </macrodef>
|
---|
290 | <target name="test-init">
|
---|
291 | <mkdir dir="${test.dir}/build"/>
|
---|
292 | <mkdir dir="${test.dir}/build/unit"/>
|
---|
293 | <mkdir dir="${test.dir}/build/functional"/>
|
---|
294 | <mkdir dir="${test.dir}/build/performance"/>
|
---|
295 | <mkdir dir="${test.dir}/report"/>
|
---|
296 | <init-test-preferences testfamily="unit"/>
|
---|
297 | <init-test-preferences testfamily="functional"/>
|
---|
298 | <init-test-preferences testfamily="performance"/>
|
---|
299 | </target>
|
---|
300 | <target name="test-clean">
|
---|
301 | <delete dir="${test.dir}/build"/>
|
---|
302 | <delete dir="${test.dir}/report"/>
|
---|
303 | <delete file="${test.dir}/jacoco.exec" />
|
---|
304 | <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
|
---|
305 | <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
|
---|
306 | <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
|
---|
307 | <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
|
---|
308 | <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
|
---|
309 | <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
|
---|
310 | </target>
|
---|
311 | <macrodef name="call-groovyc">
|
---|
312 | <attribute name="testfamily"/>
|
---|
313 | <element name="cp-elements"/>
|
---|
314 | <sequential>
|
---|
315 | <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
|
---|
316 | <classpath>
|
---|
317 | <cp-elements/>
|
---|
318 | </classpath>
|
---|
319 | <javac target="1.7" source="1.7" debug="on" encoding="UTF-8">
|
---|
320 | <compilerarg value="-Xlint:all"/>
|
---|
321 | <compilerarg value="-Xlint:-serial"/>
|
---|
322 | </javac>
|
---|
323 | </groovyc>
|
---|
324 | </sequential>
|
---|
325 | </macrodef>
|
---|
326 | <target name="test-compile" depends="test-init,dist">
|
---|
327 | <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.3.9.jar"/>
|
---|
328 | <call-groovyc testfamily="unit">
|
---|
329 | <cp-elements>
|
---|
330 | <path refid="test.classpath"/>
|
---|
331 | </cp-elements>
|
---|
332 | </call-groovyc>
|
---|
333 | <call-groovyc testfamily="functional">
|
---|
334 | <cp-elements>
|
---|
335 | <path refid="test.classpath"/>
|
---|
336 | <pathelement path="${test.dir}/build/unit"/>
|
---|
337 | </cp-elements>
|
---|
338 | </call-groovyc>
|
---|
339 | <call-groovyc testfamily="performance">
|
---|
340 | <cp-elements>
|
---|
341 | <path refid="test.classpath"/>
|
---|
342 | <pathelement path="${test.dir}/build/unit"/>
|
---|
343 | </cp-elements>
|
---|
344 | </call-groovyc>
|
---|
345 | </target>
|
---|
346 | <macrodef name="call-junit">
|
---|
347 | <attribute name="testfamily"/>
|
---|
348 | <sequential>
|
---|
349 | <echo message="Running @{testfamily} tests with JUnit"/>
|
---|
350 | <jacoco:coverage destfile="${test.dir}/jacoco.exec">
|
---|
351 | <junit printsummary="yes" fork="true" forkmode="once">
|
---|
352 | <jvmarg value="-Dfile.encoding=UTF-8"/>
|
---|
353 | <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
|
---|
354 | <sysproperty key="josm.test.data" value="${test.dir}/data"/>
|
---|
355 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
356 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
357 | <classpath>
|
---|
358 | <path refid="test.classpath"/>
|
---|
359 | <pathelement path="${test.dir}/build/unit"/>
|
---|
360 | <pathelement path="${test.dir}/build/@{testfamily}"/>
|
---|
361 | <pathelement path="${test.dir}/config"/>
|
---|
362 | </classpath>
|
---|
363 | <formatter type="plain"/>
|
---|
364 | <formatter type="xml"/>
|
---|
365 | <batchtest fork="yes" todir="${test.dir}/report">
|
---|
366 | <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
|
---|
367 | </batchtest>
|
---|
368 | </junit>
|
---|
369 | </jacoco:coverage>
|
---|
370 | </sequential>
|
---|
371 | </macrodef>
|
---|
372 | <target name="test" depends="test-compile"
|
---|
373 | description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
374 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
|
---|
375 | <call-junit testfamily="unit"/>
|
---|
376 | <call-junit testfamily="functional"/>
|
---|
377 | <call-junit testfamily="performance"/>
|
---|
378 | </target>
|
---|
379 | <target name="test-html" depends="test" description="Generate HTML test reports">
|
---|
380 | <!-- May require additional ant dependencies like ant-trax package -->
|
---|
381 | <junitreport todir="${test.dir}/report">
|
---|
382 | <fileset dir="${test.dir}/report">
|
---|
383 | <include name="TEST-*.xml"/>
|
---|
384 | </fileset>
|
---|
385 | <report todir="${test.dir}/report/html"/>
|
---|
386 | </junitreport>
|
---|
387 | <jacoco:report>
|
---|
388 | <executiondata>
|
---|
389 | <file file="${test.dir}/jacoco.exec"/>
|
---|
390 | </executiondata>
|
---|
391 | <structure name="JOSM Test Coverage">
|
---|
392 | <classfiles>
|
---|
393 | <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
|
---|
394 | </classfiles>
|
---|
395 | <sourcefiles encoding="UTF-8">
|
---|
396 | <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
|
---|
397 | </sourcefiles>
|
---|
398 | </structure>
|
---|
399 | <html destdir="${test.dir}/report/jacoco"/>
|
---|
400 | </jacoco:report>
|
---|
401 | </target>
|
---|
402 | <target name="dist-optimized" depends="dist">
|
---|
403 | <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
|
---|
404 | <proguard>
|
---|
405 | -injars dist/josm-custom.jar
|
---|
406 | -outjars dist/josm-custom-optimized.jar
|
---|
407 |
|
---|
408 | -libraryjars ${java.home}/lib/rt.jar
|
---|
409 | -libraryjars ${java.home}/lib/jce.jar
|
---|
410 |
|
---|
411 | -dontoptimize
|
---|
412 | -dontobfuscate
|
---|
413 |
|
---|
414 | # These options probably are not necessary (and make processing a bit slower)
|
---|
415 | -dontskipnonpubliclibraryclasses
|
---|
416 | -dontskipnonpubliclibraryclassmembers
|
---|
417 |
|
---|
418 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
419 | public static void main(java.lang.String[]);
|
---|
420 | }
|
---|
421 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
|
---|
422 |
|
---|
423 | -keep class JOSM
|
---|
424 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
425 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
426 | -keep class org.w3._2001.xmlschema.Adapter1
|
---|
427 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
428 |
|
---|
429 | -keepclassmembers enum * {
|
---|
430 | public static **[] values();
|
---|
431 | public static ** valueOf(java.lang.String);
|
---|
432 | }
|
---|
433 |
|
---|
434 | # Keep unused public methods (can be useful for plugins)
|
---|
435 | -keepclassmembers class * {
|
---|
436 | public protected *;
|
---|
437 | }
|
---|
438 |
|
---|
439 | # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
|
---|
440 | # This note should not be a problem as we don't use obfuscation
|
---|
441 | -dontnote
|
---|
442 | </proguard>
|
---|
443 | </target>
|
---|
444 | <target name="check-plugins" depends="dist-optimized">
|
---|
445 | <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
|
---|
446 | <local name="dir"/>
|
---|
447 | <local name="plugins"/>
|
---|
448 | <property name="dir" value="plugin-check"/>
|
---|
449 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
|
---|
450 | <classpath path="tools/animal-sniffer-ant-tasks-1.11.jar"/>
|
---|
451 | </typedef>
|
---|
452 | <mkdir dir="${dir}"/>
|
---|
453 | <!-- List of deprecated plugins -->
|
---|
454 | <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
|
---|
455 | <filterchain>
|
---|
456 | <linecontains>
|
---|
457 | <contains value="new DeprecatedPlugin("/>
|
---|
458 | </linecontains>
|
---|
459 | <tokenfilter>
|
---|
460 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
|
---|
461 | </tokenfilter>
|
---|
462 | <striplinebreaks/>
|
---|
463 | <tokenfilter>
|
---|
464 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
465 | </tokenfilter>
|
---|
466 | </filterchain>
|
---|
467 | </loadfile>
|
---|
468 | <!-- Download list of plugins -->
|
---|
469 | <loadresource property="plugins">
|
---|
470 | <url url="https://josm.openstreetmap.de/plugin"/>
|
---|
471 | <filterchain>
|
---|
472 | <linecontainsregexp negate="true">
|
---|
473 | <regexp pattern="^\t.*"/>
|
---|
474 | </linecontainsregexp>
|
---|
475 | <linecontainsregexp negate="true">
|
---|
476 | <regexp pattern="${deprecated-plugins}"/>
|
---|
477 | </linecontainsregexp>
|
---|
478 | <tokenfilter>
|
---|
479 | <replaceregex pattern="^.*;" replace="" flags="gi"/>
|
---|
480 | </tokenfilter>
|
---|
481 | </filterchain>
|
---|
482 | </loadresource>
|
---|
483 | <!-- Delete files that are not in plugin list (like old plugins) -->
|
---|
484 | <loadresource property="file-list">
|
---|
485 | <propertyresource name="plugins"/>
|
---|
486 | <filterchain>
|
---|
487 | <tokenfilter>
|
---|
488 | <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
|
---|
489 | </tokenfilter>
|
---|
490 | <striplinebreaks/>
|
---|
491 | <tokenfilter>
|
---|
492 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
493 | </tokenfilter>
|
---|
494 | </filterchain>
|
---|
495 | </loadresource>
|
---|
496 | <delete>
|
---|
497 | <restrict>
|
---|
498 | <fileset dir="${dir}"/>
|
---|
499 | <not>
|
---|
500 | <name regex="${file-list}"/>
|
---|
501 | </not>
|
---|
502 | </restrict>
|
---|
503 | </delete>
|
---|
504 | <!-- Download plugins -->
|
---|
505 | <copy todir="${dir}" flatten="true">
|
---|
506 | <resourcelist>
|
---|
507 | <string value="${plugins}"/>
|
---|
508 | </resourcelist>
|
---|
509 | </copy>
|
---|
510 | <!-- Check plugins -->
|
---|
511 | <as:build-signatures destfile="${dir}/api.sig">
|
---|
512 | <path>
|
---|
513 | <fileset file="dist/josm-custom-optimized.jar"/>
|
---|
514 | <fileset file="${java.home}/lib/rt.jar"/>
|
---|
515 | <fileset file="${java.home}/lib/jce.jar"/>
|
---|
516 | </path>
|
---|
517 | </as:build-signatures>
|
---|
518 | <as:check-signature signature="${dir}/api.sig">
|
---|
519 | <ignore classname="au.edu.*"/>
|
---|
520 | <ignore classname="au.com.*"/>
|
---|
521 | <ignore classname="com.*"/>
|
---|
522 | <ignore classname="javax.*"/>
|
---|
523 | <ignore classname="jogamp.*"/>
|
---|
524 | <ignore classname="junit.*"/>
|
---|
525 | <ignore classname="net.sf.*"/>
|
---|
526 | <ignore classname="nu.xom.*"/>
|
---|
527 | <ignore classname="org.apache.*"/>
|
---|
528 | <ignore classname="org.codehaus.*"/>
|
---|
529 | <ignore classname="org.dom4j.*"/>
|
---|
530 | <ignore classname="org.hsqldb.*"/>
|
---|
531 | <ignore classname="org.ibex.*"/>
|
---|
532 | <ignore classname="org.jaitools.*"/>
|
---|
533 | <ignore classname="org.jaxen.*"/>
|
---|
534 | <ignore classname="org.jdom2.*"/>
|
---|
535 | <ignore classname="org.jgraph.*"/>
|
---|
536 | <ignore classname="org.joda.time.*"/>
|
---|
537 | <ignore classname="org.jvnet.staxex.*"/>
|
---|
538 | <ignore classname="org.kxml2.*"/>
|
---|
539 | <ignore classname="org.python.*"/>
|
---|
540 | <ignore classname="org.slf4j.*"/>
|
---|
541 | <!-- plugins used by another ones -->
|
---|
542 | <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
|
---|
543 | <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
|
---|
544 | <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
|
---|
545 | <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
|
---|
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 | </project>
|
---|