source: josm/trunk/build.xml@ 8664

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

update CheckStyle to 6.9

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