source: josm/trunk/build.xml@ 9133

Last change on this file since 9133 was 9133, checked in by bastiK, 9 years ago

see #12186 - add more projections
The list of projections is now generated during the build process:
scripts/BuildEpsgList.java runs and creates data/projection/custom-epsg which is generated by combining data_nodist/projection/josm-epsg (a list maintained by the JOSM team) and data_nodist/projection/epsg (an upstream list from the proj.4 project, git: 3795cdf)
The ant task epsg cares for this.

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