source: josm/trunk/build.xml@ 8527

Last change on this file since 8527 was 8527, checked in by Don-vip, 9 years ago

see #11255 - remove JAXB parameter unused since r8526

File size: 29.1 KB
Line 
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="&lt;info&gt;&lt;entry&gt;&lt;commit revision=&quot;\1&quot;&gt;&lt;date&gt;\2&lt;/date&gt;&lt;/commit&gt;&lt;/entry&gt;&lt;/info&gt;"/>
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
87Revision: ${version.entry.commit.revision}
88Is-Local-Build: true
89Build-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="compile" depends="init,javacc">
202 <!-- COTS -->
203 <javac srcdir="${src.dir}" includes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**" nowarn="on" encoding="iso-8859-1"
204 destdir="build" target="1.7" source="1.7" debug="on" includeAntRuntime="false" createMissingPackageInfoClass="false">
205 <!-- get rid of "internal proprietary API" warning -->
206 <compilerarg value="-XDignore.symbol.file"/>
207 <exclude name="org/apache/commons/compress/compressors/lzma/**"/>
208 <exclude name="org/apache/commons/compress/compressors/xz/**"/>
209 <exclude name="org/apache/commons/compress/compressors/CompressorStreamFactory.java"/>
210 <exclude name="org/apache/commons/compress/compressors/deflate/**"/>
211 <exclude name="org/apache/commons/compress/compressors/gzip/**"/>
212 <exclude name="org/apache/commons/compress/compressors/lzw/**"/>
213 <exclude name="org/apache/commons/compress/compressors/pack200/**"/>
214 <exclude name="org/apache/commons/compress/compressors/snappy/**"/>
215 <exclude name="org/apache/commons/compress/compressors/z/**"/>
216 <exclude name="org/apache/commons/jcs/admin/**"/>
217 <exclude name="org/apache/commons/jcs/auxiliary/disk/jdbc/**"/>
218 <exclude name="org/apache/commons/jcs/auxiliary/remote/**"/>
219 <exclude name="org/apache/commons/jcs/utils/servlet/**"/>
220 <exclude name="org/apache/commons/logging/impl/AvalonLogger.java"/>
221 <exclude name="org/apache/commons/logging/impl/Jdk13LumberjackLogger.java"/>
222 <exclude name="org/apache/commons/logging/impl/Log4JLogger.java"/>
223 <exclude name="org/apache/commons/logging/impl/LogKitLogger.java"/>
224 <exclude name="org/apache/commons/logging/impl/ServletContextCleaner.java"/>
225 </javac>
226 <!-- JMapViewer -->
227 <javac sourcepath="" srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java,org/openstreetmap/josm/**,JOSM.java,gnu/**"
228 destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
229 <compilerarg value="-Xlint:cast"/>
230 <compilerarg value="-Xlint:deprecation"/>
231 <compilerarg value="-Xlint:dep-ann"/>
232 <compilerarg value="-Xlint:divzero"/>
233 <compilerarg value="-Xlint:empty"/>
234 <compilerarg value="-Xlint:finally"/>
235 <compilerarg value="-Xlint:overrides"/>
236 <!--<compilerarg value="-Xlint:rawtypes"/>-->
237 <compilerarg value="-Xlint:static"/>
238 <compilerarg value="-Xlint:try"/>
239 <compilerarg value="-Xlint:unchecked"/>
240 <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
241 <compilerarg value="-XDignore.symbol.file"/>
242 </javac>
243
244 <!-- JOSM -->
245 <javac sourcepath="" srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
246 destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
247 <compilerarg value="-Xlint:cast"/>
248 <compilerarg value="-Xlint:deprecation"/>
249 <compilerarg value="-Xlint:dep-ann"/>
250 <compilerarg value="-Xlint:divzero"/>
251 <compilerarg value="-Xlint:empty"/>
252 <compilerarg value="-Xlint:finally"/>
253 <compilerarg value="-Xlint:overrides"/>
254 <!--<compilerarg value="-Xlint:rawtypes"/>-->
255 <compilerarg value="-Xlint:static"/>
256 <compilerarg value="-Xlint:try"/>
257 <compilerarg value="-Xlint:unchecked"/>
258 <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
259 <compilerarg value="-XDignore.symbol.file"/>
260 </javac>
261
262
263 <copy todir="build" failonerror="no" includeemptydirs="no">
264 <fileset dir="resources"/>
265 </copy>
266 </target>
267 <target name="init">
268 <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
269 <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
270 </uptodate>
271 <mkdir dir="build"/>
272 <mkdir dir="dist"/>
273 </target>
274 <target name="javadoc">
275 <javadoc destdir="javadoc"
276 sourcepath="${src.dir}"
277 encoding="UTF-8"
278 packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
279 windowtitle="JOSM"
280 use="true"
281 private="true"
282 linksource="true"
283 author="false">
284 <link href="http://docs.oracle.com/javase/7/docs/api"/>
285 <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
286 <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
287 </javadoc>
288 </target>
289 <target name="clean">
290 <delete dir="build"/>
291 <delete dir="dist"/>
292 <delete dir="${mapcss.dir}/parsergen"/>
293 <delete dir="${imagerytypes.dir}"/>
294 </target>
295 <path id="test.classpath">
296 <fileset dir="${test.dir}/lib">
297 <include name="**/*.jar"/>
298 </fileset>
299 <pathelement path="dist/josm-custom.jar"/>
300 <pathelement path="tools/groovy-all-2.4.3.jar"/>
301 </path>
302 <macrodef name="init-test-preferences">
303 <attribute name="testfamily"/>
304 <sequential>
305 <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
306 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
307 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
308 </sequential>
309 </macrodef>
310 <target name="test-init">
311 <mkdir dir="${test.dir}/build"/>
312 <mkdir dir="${test.dir}/build/unit"/>
313 <mkdir dir="${test.dir}/build/functional"/>
314 <mkdir dir="${test.dir}/build/performance"/>
315 <mkdir dir="${test.dir}/report"/>
316 <init-test-preferences testfamily="unit"/>
317 <init-test-preferences testfamily="functional"/>
318 <init-test-preferences testfamily="performance"/>
319 </target>
320 <target name="test-clean">
321 <delete dir="${test.dir}/build"/>
322 <delete dir="${test.dir}/report"/>
323 <delete file="${test.dir}/jacoco.exec" />
324 <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
325 <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
326 <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
327 <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
328 <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
329 <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
330 </target>
331 <macrodef name="call-groovyc">
332 <attribute name="testfamily"/>
333 <element name="cp-elements"/>
334 <sequential>
335 <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
336 <classpath>
337 <cp-elements/>
338 </classpath>
339 <javac target="1.7" source="1.7" debug="on" encoding="UTF-8">
340 <compilerarg value="-Xlint:all"/>
341 <compilerarg value="-Xlint:-serial"/>
342 </javac>
343 </groovyc>
344 </sequential>
345 </macrodef>
346 <target name="test-compile" depends="test-init,dist">
347 <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.4.3.jar"/>
348 <call-groovyc testfamily="unit">
349 <cp-elements>
350 <path refid="test.classpath"/>
351 </cp-elements>
352 </call-groovyc>
353 <call-groovyc testfamily="functional">
354 <cp-elements>
355 <path refid="test.classpath"/>
356 <pathelement path="${test.dir}/build/unit"/>
357 </cp-elements>
358 </call-groovyc>
359 <call-groovyc testfamily="performance">
360 <cp-elements>
361 <path refid="test.classpath"/>
362 <pathelement path="${test.dir}/build/unit"/>
363 </cp-elements>
364 </call-groovyc>
365 </target>
366 <macrodef name="call-junit">
367 <attribute name="testfamily"/>
368 <sequential>
369 <echo message="Running @{testfamily} tests with JUnit"/>
370 <jacoco:coverage destfile="${test.dir}/jacoco.exec">
371 <junit printsummary="yes" fork="true" forkmode="once">
372 <jvmarg value="-Dfile.encoding=UTF-8"/>
373 <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
374 <sysproperty key="josm.test.data" value="${test.dir}/data"/>
375 <sysproperty key="java.awt.headless" value="true"/>
376 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
377 <classpath>
378 <path refid="test.classpath"/>
379 <pathelement path="${test.dir}/build/unit"/>
380 <pathelement path="${test.dir}/build/@{testfamily}"/>
381 <pathelement path="${test.dir}/config"/>
382 </classpath>
383 <formatter type="plain"/>
384 <formatter type="xml"/>
385 <batchtest fork="yes" todir="${test.dir}/report">
386 <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
387 </batchtest>
388 </junit>
389 </jacoco:coverage>
390 </sequential>
391 </macrodef>
392 <target name="test" depends="test-compile"
393 description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
394 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
395 <call-junit testfamily="unit"/>
396 <call-junit testfamily="functional"/>
397 <call-junit testfamily="performance"/>
398 </target>
399 <target name="test-html" depends="test" description="Generate HTML test reports">
400 <!-- May require additional ant dependencies like ant-trax package -->
401 <junitreport todir="${test.dir}/report">
402 <fileset dir="${test.dir}/report">
403 <include name="TEST-*.xml"/>
404 </fileset>
405 <report todir="${test.dir}/report/html"/>
406 </junitreport>
407 <jacoco:report>
408 <executiondata>
409 <file file="${test.dir}/jacoco.exec"/>
410 </executiondata>
411 <structure name="JOSM Test Coverage">
412 <classfiles>
413 <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
414 </classfiles>
415 <sourcefiles encoding="UTF-8">
416 <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
417 </sourcefiles>
418 </structure>
419 <html destdir="${test.dir}/report/jacoco"/>
420 </jacoco:report>
421 </target>
422 <target name="dist-optimized" depends="dist">
423 <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
424 <proguard>
425 -injars dist/josm-custom.jar
426 -outjars dist/josm-custom-optimized.jar
427
428 -libraryjars ${java.home}/lib/rt.jar
429 -libraryjars ${java.home}/lib/jce.jar
430
431 -dontoptimize
432 -dontobfuscate
433
434 # These options probably are not necessary (and make processing a bit slower)
435 -dontskipnonpubliclibraryclasses
436 -dontskipnonpubliclibraryclassmembers
437
438 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
439 public static void main(java.lang.String[]);
440 }
441 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
442
443 -keep class JOSM
444 -keep class * extends org.openstreetmap.josm.io.FileImporter
445 -keep class * extends org.openstreetmap.josm.io.FileExporter
446 -keep class org.w3._2001.xmlschema.Adapter1
447 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
448 -keep class org.apache.commons.logging.impl.*
449
450 -keepclassmembers enum * {
451 public static **[] values();
452 public static ** valueOf(java.lang.String);
453 }
454
455 # Keep unused public methods (can be useful for plugins)
456 -keepclassmembers class * {
457 public protected *;
458 }
459
460 # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
461 # This note should not be a problem as we don't use obfuscation
462 -dontnote
463 </proguard>
464 </target>
465 <target name="check-plugins" depends="dist-optimized">
466 <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
467 <local name="dir"/>
468 <local name="plugins"/>
469 <property name="dir" value="plugin-check"/>
470 <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
471 <classpath path="tools/animal-sniffer-ant-tasks-1.14.jar"/>
472 </typedef>
473 <mkdir dir="${dir}"/>
474 <!-- List of deprecated plugins -->
475 <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
476 <filterchain>
477 <linecontains>
478 <contains value="new DeprecatedPlugin("/>
479 </linecontains>
480 <tokenfilter>
481 <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
482 </tokenfilter>
483 <striplinebreaks/>
484 <tokenfilter>
485 <replaceregex pattern="\|$" replace="" flags="gi"/>
486 </tokenfilter>
487 </filterchain>
488 </loadfile>
489 <!-- Download list of plugins -->
490 <loadresource property="plugins">
491 <url url="https://josm.openstreetmap.de/plugin"/>
492 <filterchain>
493 <linecontainsregexp negate="true">
494 <regexp pattern="^\t.*"/>
495 </linecontainsregexp>
496 <linecontainsregexp negate="true">
497 <regexp pattern="${deprecated-plugins}"/>
498 </linecontainsregexp>
499 <tokenfilter>
500 <replaceregex pattern="^.*;" replace="" flags="gi"/>
501 </tokenfilter>
502 </filterchain>
503 </loadresource>
504 <!-- Delete files that are not in plugin list (like old plugins) -->
505 <loadresource property="file-list">
506 <propertyresource name="plugins"/>
507 <filterchain>
508 <tokenfilter>
509 <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
510 </tokenfilter>
511 <striplinebreaks/>
512 <tokenfilter>
513 <replaceregex pattern="\|$" replace="" flags="gi"/>
514 </tokenfilter>
515 </filterchain>
516 </loadresource>
517 <delete>
518 <restrict>
519 <fileset dir="${dir}"/>
520 <not>
521 <name regex="${file-list}"/>
522 </not>
523 </restrict>
524 </delete>
525 <!-- Download plugins -->
526 <copy todir="${dir}" flatten="true">
527 <resourcelist>
528 <string value="${plugins}"/>
529 </resourcelist>
530 </copy>
531 <!-- Check plugins -->
532 <as:build-signatures destfile="${dir}/api.sig">
533 <path>
534 <fileset file="dist/josm-custom-optimized.jar"/>
535 <fileset file="${java.home}/lib/rt.jar"/>
536 <fileset file="${java.home}/lib/jce.jar"/>
537 </path>
538 </as:build-signatures>
539 <as:check-signature signature="${dir}/api.sig">
540 <ignore classname="au.edu.*"/>
541 <ignore classname="au.com.*"/>
542 <ignore classname="com.*"/>
543 <ignore classname="de.miethxml.*"/>
544 <ignore classname="javafx.*"/>
545 <ignore classname="javax.*"/>
546 <ignore classname="jogamp.*"/>
547 <ignore classname="junit.*"/>
548 <ignore classname="net.sf.*"/>
549 <ignore classname="nu.xom.*"/>
550 <ignore classname="org.apache.*"/>
551 <ignore classname="org.codehaus.*"/>
552 <ignore classname="org.dom4j.*"/>
553 <ignore classname="org.hsqldb.*"/>
554 <ignore classname="org.ibex.*"/>
555 <ignore classname="org.iso_relax.*"/>
556 <ignore classname="org.jaitools.*"/>
557 <ignore classname="org.jaxen.*"/>
558 <ignore classname="org.jdom2.*"/>
559 <ignore classname="org.jgraph.*"/>
560 <ignore classname="org.joda.time.*"/>
561 <ignore classname="org.jvnet.staxex.*"/>
562 <ignore classname="org.kxml2.*"/>
563 <ignore classname="org.objectweb.*"/>
564 <ignore classname="org.python.*"/>
565 <ignore classname="org.slf4j.*"/>
566 <!-- plugins used by another ones -->
567 <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
568 <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
569 <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
570 <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
571 <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
572 <path path="${dir}"/>
573 </as:check-signature>
574 </target>
575
576 <target name="checkstyle">
577 <taskdef resource="checkstyletask.properties" classpath="tools/checkstyle/checkstyle-6.7-all.jar"/>
578 <checkstyle config="tools/checkstyle/josm_checks.xml">
579 <fileset dir="${basedir}/src/org/openstreetmap/josm" includes="**/*.java"
580 excludes="data/imagery/types/*.java,gui/mappaint/mapcss/parsergen/*.java"/>
581 <fileset dir="${basedir}/test" includes="**/*.java"/>
582 <formatter type="xml" toFile="checkstyle-josm.xml"/>
583 </checkstyle>
584 </target>
585
586 <target name="findbugs" depends="dist">
587 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
588 <path id="findbugs-classpath">
589 <fileset dir="tools/findbugs/">
590 <include name="*.jar"/>
591 </fileset>
592 </path>
593 <property name="findbugs-classpath" refid="findbugs-classpath"/>
594 <findbugs output="xml"
595 outputFile="findbugs-josm.xml"
596 classpath="${findbugs-classpath}"
597 pluginList=""
598 excludeFilter="tools/findbugs/josm-filter.xml"
599 effort="max"
600 >
601 <sourcePath path="${basedir}/src" />
602 <class location="${basedir}/dist/josm-custom.jar" />
603 </findbugs>
604 </target>
605 <target name="run" depends="dist">
606 <java jar="dist/josm-custom.jar" fork="true">
607 <arg value="--set=expert=true"/>
608 <arg value="--set=remotecontrol.enabled=true"/>
609 <arg value="--set=debug.edt-checker.enable=false"/>
610 <jvmarg value="-Djosm.home=/tmp/.josm/"/>
611 </java>
612 </target>
613</project>
Note: See TracBrowser for help on using the repository browser.