source: josm/trunk/build.xml@ 8778

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

disable Proguard with Java 9 until http://sourceforge.net/p/proguard/bugs/551 is fixed

File size: 30.7 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="groovy.jar" location="tools/groovy-all-2.4.4.jar"/>
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 <!-- For Java9-specific stuff -->
29 <condition property="isJava9">
30 <equals arg1="${ant.java.version}" arg2="1.9" />
31 </condition>
32
33 <!--
34 ** Used by Eclipse ant builder for updating
35 ** the REVISION file used by JOSM
36 -->
37 <target name="create-revision-eclipse">
38 <property name="revision.dir" value="bin"/>
39 <antcall target="create-revision"/>
40 </target>
41 <!--
42 ** Initializes the REVISION.XML file from SVN information
43 -->
44 <target name="init-svn-revision-xml">
45 <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false" resultproperty="svn.info.result">
46 <env key="LANG" value="C"/>
47 <arg value="info"/>
48 <arg value="--xml"/>
49 <arg value="."/>
50 </exec>
51 <condition property="svn.info.success">
52 <equals arg1="${svn.info.result}" arg2="0" />
53 </condition>
54 </target>
55 <!--
56 ** Initializes the REVISION.XML file from git information
57 -->
58 <target name="init-git-revision-xml" unless="svn.info.success">
59 <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false">
60 <arg value="log"/>
61 <arg value="-1"/>
62 <arg value="--grep=git-svn-id"/>
63 <!--
64 %B: raw body (unwrapped subject and body)
65 %n: new line
66 %ai: author date, ISO 8601 format
67 -->
68 <arg value="--pretty=format:%B%n%ai"/>
69 <arg value="HEAD"/>
70 </exec>
71 <replaceregexp file="REVISION.XML" flags="s"
72 match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
73 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;"/>
74 </target>
75 <!--
76 ** Creates the REVISION file to be included in the distribution
77 -->
78 <target name="create-revision" depends="init-svn-revision-xml, init-git-revision-xml">
79 <property name="revision.dir" value="${build.dir}"/>
80 <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
81 <delete file="REVISION.XML"/>
82 <tstamp>
83 <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
84 </tstamp>
85 <property name="version.entry.commit.revision" value="UNKNOWN"/>
86 <property name="version.entry.commit.date" value="UNKNOWN"/>
87 <mkdir dir="${revision.dir}"/>
88 <!-- add Build-Name: ... when making special builds, e.g. DEBIAN -->
89 <echo file="${revision.dir}/REVISION">
90# automatically generated by JOSM build.xml - do not edit
91Revision: ${version.entry.commit.revision}
92Is-Local-Build: true
93Build-Date: ${build.tstamp}
94</echo>
95 </target>
96 <!--
97 ** Check internal XML files against their XSD
98 -->
99 <target name="check-schemas" unless="check-schemas.notRequired">
100 <schemavalidate file="data/defaultpresets.xml" >
101 <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="data/tagging-preset.xsd" />
102 </schemavalidate>
103 </target>
104 <!--
105 ** Main target that builds JOSM and checks XML against schemas
106 -->
107 <target name="dist" depends="compile,create-revision,check-schemas">
108 <echo>Revision ${version.entry.commit.revision}</echo>
109 <copy file="CONTRIBUTION" todir="build"/>
110 <copy file="README" todir="build"/>
111 <copy file="LICENSE" todir="build"/>
112 <!-- create josm-custom.jar -->
113 <delete file="dist/josm-custom.jar"/>
114 <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
115 <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
116 <manifest>
117 <attribute name="Main-class" value="JOSM"/>
118 <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
119 <attribute name="Main-Date" value="${version.entry.commit.date}"/>
120 <attribute name="Permissions" value="all-permissions"/>
121 <attribute name="Codebase" value="josm.openstreetmap.de"/>
122 <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
123 </manifest>
124 <zipfileset dir="images" prefix="images"/>
125 <zipfileset dir="data" prefix="data"/>
126 <zipfileset dir="styles" prefix="styles"/>
127 <zipfileset dir="${src.dir}/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
128 </jar>
129 </target>
130 <!-- Mac OS X target -->
131 <target name="mac">
132 <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
133 <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="tools/appbundler-1.0ea.jar"/>
134 <!-- create MacOS X application bundle -->
135 <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
136 mainclassname="org.openstreetmap.josm.gui.MainApplication"
137 copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
138 applicationCategory="public.app-category.utilities"
139 shortversion="${version.entry.commit.revision} SVN"
140 version="${version.entry.commit.revision} SVN"
141 icon="macosx/JOSM.app/Contents/Resources/JOSM.icns"
142 highResolutionCapable="true">
143
144 <arch name="x86_64"/>
145 <arch name="i386"/>
146
147 <classpath file="${bundle.jar}"/>
148
149 <option value="-Xmx1024m"/>
150
151 <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
152 <option value="-Xdock:name=JOSM"/>
153
154 <!-- OSX specific options, optional -->
155 <option value="-Dapple.laf.useScreenMenuBar=true"/>
156 <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
157 <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
158 <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
159 <option value="-Dcom.apple.smallTabs=true"/>
160 </bundleapp>
161
162 <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
163 <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/>
164
165 <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
166 <!-- remove empty CFBundleDocumentTypes definition -->
167 <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/>
168 <!-- insert our own keys -->
169 <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" />
170 </xmltask>
171
172 <!-- create ZIP file with MacOS X application bundle -->
173 <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
174 <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
175 <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
176 </zip>
177 </target>
178 <target name="distmac" depends="dist">
179 <antcall target="mac">
180 <param name="bundle.outdir" value="dist"/>
181 <param name="bundle.jar" value="dist/josm-custom.jar"/>
182 </antcall>
183 </target>
184 <!-- Windows target -->
185 <target name="distwin" depends="dist">
186 <exec dir="windows" executable="./josm-setup-unix.sh">
187 <arg value="${version.entry.commit.revision}"/>
188 <arg value="../dist/josm-custom.jar"/>
189 </exec>
190 </target>
191 <target name="javacc" depends="init" unless="javacc.notRequired">
192 <mkdir dir="${mapcss.dir}/parsergen"/>
193 <exec append="false" executable="java" failifexecutionfails="true">
194 <arg value="-cp"/>
195 <arg value="${javacc.home}/javacc.jar"/>
196 <arg value="javacc"/>
197 <arg value="-DEBUG_PARSER=false"/>
198 <arg value="-DEBUG_TOKEN_MANAGER=false"/>
199 <arg value="-JDK_VERSION=1.7"/>
200 <arg value="-GRAMMAR_ENCODING=UTF-8"/>
201 <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
202 <arg value="${mapcss.dir}/MapCSSParser.jj"/>
203 </exec>
204 </target>
205 <target name="compile" depends="init,javacc">
206 <!-- COTS -->
207 <javac srcdir="${src.dir}" includes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**" nowarn="on" encoding="iso-8859-1"
208 destdir="build" target="1.7" source="1.7" debug="on" includeAntRuntime="false" createMissingPackageInfoClass="false">
209 <!-- get rid of "internal proprietary API" warning -->
210 <compilerarg value="-XDignore.symbol.file"/>
211 <exclude name="org/apache/commons/compress/compressors/lzma/**"/>
212 <exclude name="org/apache/commons/compress/compressors/xz/**"/>
213 <exclude name="org/apache/commons/compress/compressors/CompressorStreamFactory.java"/>
214 <exclude name="org/apache/commons/compress/compressors/deflate/**"/>
215 <exclude name="org/apache/commons/compress/compressors/gzip/**"/>
216 <exclude name="org/apache/commons/compress/compressors/lzw/**"/>
217 <exclude name="org/apache/commons/compress/compressors/pack200/**"/>
218 <exclude name="org/apache/commons/compress/compressors/snappy/**"/>
219 <exclude name="org/apache/commons/compress/compressors/z/**"/>
220 <exclude name="org/apache/commons/jcs/admin/**"/>
221 <exclude name="org/apache/commons/jcs/auxiliary/disk/jdbc/**"/>
222 <exclude name="org/apache/commons/jcs/auxiliary/remote/**"/>
223 <exclude name="org/apache/commons/jcs/utils/servlet/**"/>
224 <exclude name="org/apache/commons/logging/impl/AvalonLogger.java"/>
225 <exclude name="org/apache/commons/logging/impl/Jdk13LumberjackLogger.java"/>
226 <exclude name="org/apache/commons/logging/impl/Log4JLogger.java"/>
227 <exclude name="org/apache/commons/logging/impl/LogKitLogger.java"/>
228 <exclude name="org/apache/commons/logging/impl/ServletContextCleaner.java"/>
229 </javac>
230 <!-- JMapViewer -->
231 <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/**"
232 destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
233 <compilerarg value="-Xlint:cast"/>
234 <compilerarg value="-Xlint:deprecation"/>
235 <compilerarg value="-Xlint:dep-ann"/>
236 <compilerarg value="-Xlint:divzero"/>
237 <compilerarg value="-Xlint:empty"/>
238 <compilerarg value="-Xlint:finally"/>
239 <compilerarg value="-Xlint:overrides"/>
240 <!--<compilerarg value="-Xlint:rawtypes"/>-->
241 <compilerarg value="-Xlint:static"/>
242 <compilerarg value="-Xlint:try"/>
243 <compilerarg value="-Xlint:unchecked"/>
244 <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
245 <compilerarg value="-XDignore.symbol.file"/>
246 </javac>
247 <!-- JOSM -->
248 <javac sourcepath="" srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
249 destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
250 <compilerarg value="-Xlint:cast"/>
251 <compilerarg value="-Xlint:deprecation"/>
252 <compilerarg value="-Xlint:dep-ann"/>
253 <compilerarg value="-Xlint:divzero"/>
254 <compilerarg value="-Xlint:empty"/>
255 <compilerarg value="-Xlint:finally"/>
256 <compilerarg value="-Xlint:overrides"/>
257 <!--<compilerarg value="-Xlint:rawtypes"/>-->
258 <compilerarg value="-Xlint:static"/>
259 <compilerarg value="-Xlint:try"/>
260 <compilerarg value="-Xlint:unchecked"/>
261 <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
262 <compilerarg value="-XDignore.symbol.file"/>
263 </javac>
264
265 <copy todir="build" failonerror="no" includeemptydirs="no">
266 <fileset dir="resources"/>
267 </copy>
268 </target>
269 <target name="init">
270 <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
271 <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
272 </uptodate>
273 <mkdir dir="build"/>
274 <mkdir dir="dist"/>
275 </target>
276 <target name="javadoc">
277 <javadoc destdir="javadoc"
278 sourcepath="${src.dir}"
279 encoding="UTF-8"
280 packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
281 windowtitle="JOSM"
282 use="true"
283 private="true"
284 linksource="true"
285 author="false">
286 <link href="http://docs.oracle.com/javase/7/docs/api"/>
287 <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
288 <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
289 </javadoc>
290 </target>
291 <target name="clean">
292 <delete dir="build"/>
293 <delete dir="dist"/>
294 <delete dir="${mapcss.dir}/parsergen"/>
295 <delete file="${src.dir}/org/w3/_2001/xmlschema/Adapter1.java"/>
296 <delete dir="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
297 </target>
298 <path id="test.classpath">
299 <fileset dir="${test.dir}/lib">
300 <include name="**/*.jar"/>
301 </fileset>
302 <pathelement path="dist/josm-custom.jar"/>
303 <pathelement path="${groovy.jar}"/>
304 </path>
305 <macrodef name="init-test-preferences">
306 <attribute name="testfamily"/>
307 <sequential>
308 <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
309 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
310 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
311 </sequential>
312 </macrodef>
313 <target name="test-init">
314 <mkdir dir="${test.dir}/build"/>
315 <mkdir dir="${test.dir}/build/unit"/>
316 <mkdir dir="${test.dir}/build/functional"/>
317 <mkdir dir="${test.dir}/build/performance"/>
318 <mkdir dir="${test.dir}/report"/>
319 <init-test-preferences testfamily="unit"/>
320 <init-test-preferences testfamily="functional"/>
321 <init-test-preferences testfamily="performance"/>
322 </target>
323 <target name="test-clean">
324 <delete dir="${test.dir}/build"/>
325 <delete dir="${test.dir}/report"/>
326 <delete file="${test.dir}/jacoco.exec" />
327 <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
328 <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
329 <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
330 <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
331 <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
332 <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
333 </target>
334 <macrodef name="call-groovyc">
335 <attribute name="testfamily"/>
336 <element name="cp-elements"/>
337 <sequential>
338 <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
339 <classpath>
340 <cp-elements/>
341 </classpath>
342 <javac target="1.7" source="1.7" debug="on" encoding="UTF-8">
343 <compilerarg value="-Xlint:all"/>
344 <compilerarg value="-Xlint:-serial"/>
345 </javac>
346 </groovyc>
347 </sequential>
348 </macrodef>
349 <target name="test-compile" depends="test-init,dist">
350 <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="${groovy.jar}"/>
351 <call-groovyc testfamily="unit">
352 <cp-elements>
353 <path refid="test.classpath"/>
354 </cp-elements>
355 </call-groovyc>
356 <call-groovyc testfamily="functional">
357 <cp-elements>
358 <path refid="test.classpath"/>
359 <pathelement path="${test.dir}/build/unit"/>
360 </cp-elements>
361 </call-groovyc>
362 <call-groovyc testfamily="performance">
363 <cp-elements>
364 <path refid="test.classpath"/>
365 <pathelement path="${test.dir}/build/unit"/>
366 </cp-elements>
367 </call-groovyc>
368 </target>
369 <macrodef name="call-junit">
370 <attribute name="testfamily"/>
371 <sequential>
372 <echo message="Running @{testfamily} tests with JUnit"/>
373 <jacoco:coverage destfile="${test.dir}/jacoco.exec">
374 <junit printsummary="yes" fork="true" forkmode="once">
375 <jvmarg value="-Dfile.encoding=UTF-8"/>
376 <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
377 <sysproperty key="josm.test.data" value="${test.dir}/data"/>
378 <sysproperty key="java.awt.headless" value="true"/>
379 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
380 <classpath>
381 <path refid="test.classpath"/>
382 <pathelement path="${test.dir}/build/unit"/>
383 <pathelement path="${test.dir}/build/@{testfamily}"/>
384 <pathelement path="${test.dir}/config"/>
385 </classpath>
386 <formatter type="plain"/>
387 <formatter type="xml"/>
388 <batchtest fork="yes" todir="${test.dir}/report">
389 <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
390 </batchtest>
391 </junit>
392 </jacoco:coverage>
393 </sequential>
394 </macrodef>
395 <target name="test" depends="test-compile"
396 description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
397 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
398 <call-junit testfamily="unit"/>
399 <call-junit testfamily="functional"/>
400 <call-junit testfamily="performance"/>
401 </target>
402 <target name="test-html" depends="test" description="Generate HTML test reports">
403 <!-- May require additional ant dependencies like ant-trax package -->
404 <junitreport todir="${test.dir}/report">
405 <fileset dir="${test.dir}/report">
406 <include name="TEST-*.xml"/>
407 </fileset>
408 <report todir="${test.dir}/report/html"/>
409 </junitreport>
410 <jacoco:report>
411 <executiondata>
412 <file file="${test.dir}/jacoco.exec"/>
413 </executiondata>
414 <structure name="JOSM Test Coverage">
415 <classfiles>
416 <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
417 </classfiles>
418 <sourcefiles encoding="UTF-8">
419 <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
420 </sourcefiles>
421 </structure>
422 <html destdir="${test.dir}/report/jacoco"/>
423 </jacoco:report>
424 </target>
425 <!-- Proguard does not support Java 9 : http://sourceforge.net/p/proguard/bugs/551/ -->
426 <target name="dist-optimized" depends="dist" unless="isJava9">
427 <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
428 <proguard>
429 -injars dist/josm-custom.jar
430 -outjars dist/josm-custom-optimized.jar
431
432 -libraryjars ${java.home}/lib/rt.jar
433 -libraryjars ${java.home}/lib/jce.jar
434
435 -dontoptimize
436 -dontobfuscate
437
438 # These options probably are not necessary (and make processing a bit slower)
439 -dontskipnonpubliclibraryclasses
440 -dontskipnonpubliclibraryclassmembers
441
442 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
443 public static void main(java.lang.String[]);
444 }
445
446 -keep class JOSM
447 -keep class * extends org.openstreetmap.josm.io.FileImporter
448 -keep class * extends org.openstreetmap.josm.io.FileExporter
449 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
450 -keep class org.openstreetmap.josm.gui.mappaint.mapcss.Condition$PseudoClasses {
451 static boolean *(org.openstreetmap.josm.gui.mappaint.Environment);
452 }
453 -keep class org.apache.commons.logging.impl.*
454
455 -keepclassmembers enum * {
456 public static **[] values();
457 public static ** valueOf(java.lang.String);
458 }
459
460 # Keep unused public methods (can be useful for plugins)
461 -keepclassmembers class * {
462 public protected *;
463 }
464
465 # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
466 # This note should not be a problem as we don't use obfuscation
467 -dontnote
468 </proguard>
469 </target>
470 <target name="check-plugins" depends="dist-optimized">
471 <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
472 <local name="dir"/>
473 <local name="plugins"/>
474 <property name="dir" value="plugin-check"/>
475 <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
476 <classpath path="tools/animal-sniffer-ant-tasks-1.14.jar"/>
477 </typedef>
478 <mkdir dir="${dir}"/>
479 <!-- List of deprecated plugins -->
480 <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
481 <filterchain>
482 <linecontains>
483 <contains value="new DeprecatedPlugin("/>
484 </linecontains>
485 <tokenfilter>
486 <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
487 </tokenfilter>
488 <striplinebreaks/>
489 <tokenfilter>
490 <replaceregex pattern="\|$" replace="" flags="gi"/>
491 </tokenfilter>
492 </filterchain>
493 </loadfile>
494 <!-- Download list of plugins -->
495 <loadresource property="plugins">
496 <url url="https://josm.openstreetmap.de/plugin"/>
497 <filterchain>
498 <linecontainsregexp negate="true">
499 <regexp pattern="^\t.*"/>
500 </linecontainsregexp>
501 <linecontainsregexp negate="true">
502 <regexp pattern="${deprecated-plugins}"/>
503 </linecontainsregexp>
504 <tokenfilter>
505 <replaceregex pattern="^.*;" replace="" flags="gi"/>
506 </tokenfilter>
507 </filterchain>
508 </loadresource>
509 <!-- Delete files that are not in plugin list (like old plugins) -->
510 <loadresource property="file-list">
511 <propertyresource name="plugins"/>
512 <filterchain>
513 <tokenfilter>
514 <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
515 </tokenfilter>
516 <striplinebreaks/>
517 <tokenfilter>
518 <replaceregex pattern="\|$" replace="" flags="gi"/>
519 </tokenfilter>
520 </filterchain>
521 </loadresource>
522 <delete>
523 <restrict>
524 <fileset dir="${dir}"/>
525 <not>
526 <name regex="${file-list}"/>
527 </not>
528 </restrict>
529 </delete>
530 <!-- Download plugins -->
531 <copy todir="${dir}" flatten="true">
532 <resourcelist>
533 <string value="${plugins}"/>
534 </resourcelist>
535 </copy>
536 <!-- Check plugins -->
537 <as:build-signatures destfile="${dir}/api.sig">
538 <path>
539 <fileset file="dist/josm-custom-optimized.jar"/>
540 <fileset file="${java.home}/lib/rt.jar"/>
541 <fileset file="${java.home}/lib/jce.jar"/>
542 </path>
543 </as:build-signatures>
544 <as:check-signature signature="${dir}/api.sig">
545 <ignore classname="au.edu.*"/>
546 <ignore classname="au.com.*"/>
547 <ignore classname="com.*"/>
548 <ignore classname="de.miethxml.*"/>
549 <ignore classname="javafx.*"/>
550 <ignore classname="javax.*"/>
551 <ignore classname="jogamp.*"/>
552 <ignore classname="junit.*"/>
553 <ignore classname="net.sf.*"/>
554 <ignore classname="nu.xom.*"/>
555 <ignore classname="org.apache.*"/>
556 <ignore classname="org.codehaus.*"/>
557 <ignore classname="org.dom4j.*"/>
558 <ignore classname="org.hsqldb.*"/>
559 <ignore classname="org.ibex.*"/>
560 <ignore classname="org.iso_relax.*"/>
561 <ignore classname="org.jaitools.*"/>
562 <ignore classname="org.jaxen.*"/>
563 <ignore classname="org.jdom2.*"/>
564 <ignore classname="org.jgraph.*"/>
565 <ignore classname="org.joda.time.*"/>
566 <ignore classname="org.jvnet.staxex.*"/>
567 <ignore classname="org.kxml2.*"/>
568 <ignore classname="org.objectweb.*"/>
569 <ignore classname="org.python.*"/>
570 <ignore classname="org.slf4j.*"/>
571 <!-- plugins used by another ones -->
572 <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
573 <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
574 <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
575 <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
576 <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
577 <path path="${dir}"/>
578 </as:check-signature>
579 </target>
580
581 <macrodef name="_taginfo">
582 <attribute name="type"/>
583 <attribute name="output"/>
584 <sequential>
585 <echo message="Generating Taginfo for type @{type} to @{output}"/>
586 <groovy src="${taginfoextract}" classpath="dist/josm-custom.jar">
587 <arg value="-t"/>
588 <arg value="@{type}"/>
589 <arg value="--noexit"/>
590 <arg value="--svnweb"/>
591 <arg value="--imgurlprefix"/>
592 <arg value="${imgurlprefix}"/>
593 <arg value="-o"/>
594 <arg value="@{output}"/>
595 </groovy>
596 </sequential>
597 </macrodef>
598
599 <target name="taginfo" depends="dist">
600 <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${groovy.jar};tools/commons-cli-1.3.1.jar"/>
601 <property name="taginfoextract" value="scripts/taginfoextract.groovy"/>
602 <property name="imgurlprefix" value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/>
603 <_taginfo type="mappaint" output="taginfo_style.json"/>
604 <_taginfo type="presets" output="taginfo_presets.json"/>
605 <_taginfo type="external_presets" output="taginfo_external_presets.json"/>
606 </target>
607
608 <target name="checkstyle">
609 <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
610 classpath="tools/checkstyle/checkstyle-6.10.1-all.jar"/>
611 <checkstyle config="tools/checkstyle/josm_checks.xml">
612 <fileset dir="${basedir}/src/org/openstreetmap/josm" includes="**/*.java"
613 excludes="gui/mappaint/mapcss/parsergen/*.java"/>
614 <fileset dir="${basedir}/test" includes="**/*.java"/>
615 <formatter type="xml" toFile="checkstyle-josm.xml"/>
616 </checkstyle>
617 </target>
618
619 <target name="findbugs" depends="dist">
620 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
621 <path id="findbugs-classpath">
622 <fileset dir="tools/findbugs/">
623 <include name="*.jar"/>
624 </fileset>
625 </path>
626 <property name="findbugs-classpath" refid="findbugs-classpath"/>
627 <findbugs output="xml"
628 outputFile="findbugs-josm.xml"
629 classpath="${findbugs-classpath}"
630 pluginList=""
631 excludeFilter="tools/findbugs/josm-filter.xml"
632 effort="max"
633 >
634 <sourcePath path="${basedir}/src" />
635 <class location="${basedir}/dist/josm-custom.jar" />
636 </findbugs>
637 </target>
638 <target name="run" depends="dist">
639 <java jar="dist/josm-custom.jar" fork="true">
640 <arg value="--set=expert=true"/>
641 <arg value="--set=remotecontrol.enabled=true"/>
642 <arg value="--set=debug.edt-checker.enable=false"/>
643 <jvmarg value="-Djosm.home=/tmp/.josm/"/>
644 </java>
645 </target>
646</project>
Note: See TracBrowser for help on using the repository browser.