source: josm/trunk/build.xml@ 9330

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

see #11924 - update to Groovy 2.4.6-SNAPSHOT (rev 23ad731c49dceda51e5ff324d1cfed48d7d65c49 - 2016-01-05) downloaded from CI server, to get fixes for:


There's no schedule about 2.4.6 official release, and authors say they "have only very little time these days to actually do the change", see https://issues.apache.org/jira/browse/GROOVY-7291?focusedCommentId=15083011&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15083011

The jar has been downloaded from http://ci.groovy-lang.org/repository/download/Groovy_Jdk7Build/30993:id/target/distributions/apache-groovy-binary-2.4.6-SNAPSHOT.zip%21/groovy-2.4.6-SNAPSHOT/embeddable/groovy-all-2.4.6-SNAPSHOT.jar

File size: 31.6 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.6-SNAPSHOT.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 excludepackagenames="org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.*"
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="build2"/>
292 <delete dir="dist"/>
293 <delete dir="${mapcss.dir}/parsergen"/>
294 <delete file="${src.dir}/org/w3/_2001/xmlschema/Adapter1.java"/>
295 <delete dir="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
296 <delete file="${epsg.output}"/>
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 <pathelement path="tools/findbugs/annotations.jar"/>
305 </path>
306 <macrodef name="init-test-preferences">
307 <attribute name="testfamily"/>
308 <sequential>
309 <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
310 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
311 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
312 </sequential>
313 </macrodef>
314 <target name="test-init">
315 <mkdir dir="${test.dir}/build"/>
316 <mkdir dir="${test.dir}/build/unit"/>
317 <mkdir dir="${test.dir}/build/functional"/>
318 <mkdir dir="${test.dir}/build/performance"/>
319 <mkdir dir="${test.dir}/report"/>
320 <init-test-preferences testfamily="unit"/>
321 <init-test-preferences testfamily="functional"/>
322 <init-test-preferences testfamily="performance"/>
323 </target>
324 <target name="test-clean">
325 <delete dir="${test.dir}/build"/>
326 <delete dir="${test.dir}/report"/>
327 <delete file="${test.dir}/jacoco.exec" />
328 <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
329 <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
330 <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
331 <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
332 <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
333 <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
334 </target>
335 <macrodef name="call-groovyc">
336 <attribute name="testfamily"/>
337 <element name="cp-elements"/>
338 <sequential>
339 <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
340 <classpath>
341 <cp-elements/>
342 </classpath>
343 <javac target="1.7" source="1.7" debug="on" encoding="UTF-8">
344 <compilerarg value="-Xlint:all"/>
345 <compilerarg value="-Xlint:-serial"/>
346 </javac>
347 </groovyc>
348 </sequential>
349 </macrodef>
350 <target name="test-compile" depends="test-init,dist">
351 <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="${groovy.jar}"/>
352 <call-groovyc testfamily="unit">
353 <cp-elements>
354 <path refid="test.classpath"/>
355 </cp-elements>
356 </call-groovyc>
357 <call-groovyc testfamily="functional">
358 <cp-elements>
359 <path refid="test.classpath"/>
360 <pathelement path="${test.dir}/build/unit"/>
361 </cp-elements>
362 </call-groovyc>
363 <call-groovyc testfamily="performance">
364 <cp-elements>
365 <path refid="test.classpath"/>
366 <pathelement path="${test.dir}/build/unit"/>
367 </cp-elements>
368 </call-groovyc>
369 </target>
370 <macrodef name="call-junit">
371 <attribute name="testfamily"/>
372 <sequential>
373 <echo message="Running @{testfamily} tests with JUnit"/>
374 <jacoco:coverage destfile="${test.dir}/jacoco.exec">
375 <junit printsummary="yes" fork="true" forkmode="once">
376 <jvmarg value="-Dfile.encoding=UTF-8"/>
377 <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
378 <sysproperty key="josm.test.data" value="${test.dir}/data"/>
379 <sysproperty key="java.awt.headless" value="true"/>
380 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
381 <classpath>
382 <path refid="test.classpath"/>
383 <pathelement path="${test.dir}/build/unit"/>
384 <pathelement path="${test.dir}/build/@{testfamily}"/>
385 <pathelement path="${test.dir}/config"/>
386 </classpath>
387 <formatter type="plain"/>
388 <formatter type="xml"/>
389 <batchtest fork="yes" todir="${test.dir}/report">
390 <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
391 </batchtest>
392 </junit>
393 </jacoco:coverage>
394 </sequential>
395 </macrodef>
396 <target name="test" depends="test-compile"
397 description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
398 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
399 <call-junit testfamily="unit"/>
400 <call-junit testfamily="functional"/>
401 <call-junit testfamily="performance"/>
402 </target>
403 <target name="test-html" depends="test" description="Generate HTML test reports">
404 <!-- May require additional ant dependencies like ant-trax package -->
405 <junitreport todir="${test.dir}/report">
406 <fileset dir="${test.dir}/report">
407 <include name="TEST-*.xml"/>
408 </fileset>
409 <report todir="${test.dir}/report/html"/>
410 </junitreport>
411 <jacoco:report>
412 <executiondata>
413 <file file="${test.dir}/jacoco.exec"/>
414 </executiondata>
415 <structure name="JOSM Test Coverage">
416 <classfiles>
417 <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
418 </classfiles>
419 <sourcefiles encoding="UTF-8">
420 <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
421 </sourcefiles>
422 </structure>
423 <html destdir="${test.dir}/report/jacoco"/>
424 </jacoco:report>
425 </target>
426 <!-- Proguard does not support Java 9 : http://sourceforge.net/p/proguard/bugs/551/ -->
427 <target name="dist-optimized" depends="dist" unless="isJava9">
428 <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
429 <proguard>
430 -injars dist/josm-custom.jar
431 -outjars dist/josm-custom-optimized.jar
432
433 -libraryjars ${java.home}/lib/rt.jar
434 -libraryjars ${java.home}/lib/jce.jar
435
436 -dontoptimize
437 -dontobfuscate
438
439 # These options probably are not necessary (and make processing a bit slower)
440 -dontskipnonpubliclibraryclasses
441 -dontskipnonpubliclibraryclassmembers
442
443 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
444 public static void main(java.lang.String[]);
445 }
446
447 -keep class JOSM
448 -keep class * extends org.openstreetmap.josm.io.FileImporter
449 -keep class * extends org.openstreetmap.josm.io.FileExporter
450 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
451 -keep class org.openstreetmap.josm.gui.mappaint.mapcss.Condition$PseudoClasses {
452 static boolean *(org.openstreetmap.josm.gui.mappaint.Environment);
453 }
454 -keep class org.apache.commons.logging.impl.*
455
456 -keepclassmembers enum * {
457 public static **[] values();
458 public static ** valueOf(java.lang.String);
459 }
460
461 # Keep unused public methods (can be useful for plugins)
462 -keepclassmembers class * {
463 public protected *;
464 }
465
466 # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
467 # This note should not be a problem as we don't use obfuscation
468 -dontnote
469 </proguard>
470 </target>
471 <target name="check-plugins" depends="dist-optimized">
472 <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
473 <local name="dir"/>
474 <local name="plugins"/>
475 <property name="dir" value="plugin-check"/>
476 <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
477 <classpath path="tools/animal-sniffer-ant-tasks-1.14.jar"/>
478 </typedef>
479 <mkdir dir="${dir}"/>
480 <!-- List of deprecated plugins -->
481 <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
482 <filterchain>
483 <linecontains>
484 <contains value="new DeprecatedPlugin("/>
485 </linecontains>
486 <tokenfilter>
487 <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
488 </tokenfilter>
489 <striplinebreaks/>
490 <tokenfilter>
491 <replaceregex pattern="\|$" replace="" flags="gi"/>
492 </tokenfilter>
493 </filterchain>
494 </loadfile>
495 <!-- Download list of plugins -->
496 <loadresource property="plugins">
497 <url url="https://josm.openstreetmap.de/plugin"/>
498 <filterchain>
499 <linecontainsregexp negate="true">
500 <regexp pattern="^\t.*"/>
501 </linecontainsregexp>
502 <linecontainsregexp negate="true">
503 <regexp pattern="${deprecated-plugins}"/>
504 </linecontainsregexp>
505 <tokenfilter>
506 <replaceregex pattern="^.*;" replace="" flags="gi"/>
507 </tokenfilter>
508 </filterchain>
509 </loadresource>
510 <!-- Delete files that are not in plugin list (like old plugins) -->
511 <loadresource property="file-list">
512 <propertyresource name="plugins"/>
513 <filterchain>
514 <tokenfilter>
515 <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
516 </tokenfilter>
517 <striplinebreaks/>
518 <tokenfilter>
519 <replaceregex pattern="\|$" replace="" flags="gi"/>
520 </tokenfilter>
521 </filterchain>
522 </loadresource>
523 <delete>
524 <restrict>
525 <fileset dir="${dir}"/>
526 <not>
527 <name regex="${file-list}"/>
528 </not>
529 </restrict>
530 </delete>
531 <!-- Download plugins -->
532 <copy todir="${dir}" flatten="true">
533 <resourcelist>
534 <string value="${plugins}"/>
535 </resourcelist>
536 </copy>
537 <!-- Check plugins -->
538 <as:build-signatures destfile="${dir}/api.sig">
539 <path>
540 <fileset file="dist/josm-custom-optimized.jar"/>
541 <fileset file="${java.home}/lib/rt.jar"/>
542 <fileset file="${java.home}/lib/jce.jar"/>
543 </path>
544 </as:build-signatures>
545 <as:check-signature signature="${dir}/api.sig">
546 <ignore classname="au.edu.*"/>
547 <ignore classname="au.com.*"/>
548 <ignore classname="com.*"/>
549 <ignore classname="de.miethxml.*"/>
550 <ignore classname="javafx.*"/>
551 <ignore classname="javax.*"/>
552 <ignore classname="jogamp.*"/>
553 <ignore classname="junit.*"/>
554 <ignore classname="net.sf.*"/>
555 <ignore classname="nu.xom.*"/>
556 <ignore classname="org.apache.*"/>
557 <ignore classname="org.codehaus.*"/>
558 <ignore classname="org.dom4j.*"/>
559 <ignore classname="org.hsqldb.*"/>
560 <ignore classname="org.ibex.*"/>
561 <ignore classname="org.iso_relax.*"/>
562 <ignore classname="org.jaitools.*"/>
563 <ignore classname="org.jaxen.*"/>
564 <ignore classname="org.jdom2.*"/>
565 <ignore classname="org.jgraph.*"/>
566 <ignore classname="org.joda.time.*"/>
567 <ignore classname="org.jvnet.staxex.*"/>
568 <ignore classname="org.kxml2.*"/>
569 <ignore classname="org.objectweb.*"/>
570 <ignore classname="org.python.*"/>
571 <ignore classname="org.slf4j.*"/>
572 <!-- plugins used by another ones -->
573 <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
574 <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
575 <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
576 <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
577 <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
578 <path path="${dir}"/>
579 </as:check-signature>
580 </target>
581
582 <macrodef name="_taginfo">
583 <attribute name="type"/>
584 <attribute name="output"/>
585 <sequential>
586 <echo message="Generating Taginfo for type @{type} to @{output}"/>
587 <groovy src="${taginfoextract}" classpath="dist/josm-custom.jar">
588 <arg value="-t"/>
589 <arg value="@{type}"/>
590 <arg value="--noexit"/>
591 <arg value="--svnweb"/>
592 <arg value="--imgurlprefix"/>
593 <arg value="${imgurlprefix}"/>
594 <arg value="-o"/>
595 <arg value="@{output}"/>
596 </groovy>
597 </sequential>
598 </macrodef>
599
600 <target name="taginfo" depends="dist">
601 <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${groovy.jar};tools/commons-cli-1.3.1.jar"/>
602 <property name="taginfoextract" value="scripts/taginfoextract.groovy"/>
603 <property name="imgurlprefix" value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/>
604 <_taginfo type="mappaint" output="taginfo_style.json"/>
605 <_taginfo type="presets" output="taginfo_presets.json"/>
606 <_taginfo type="external_presets" output="taginfo_external_presets.json"/>
607 </target>
608
609 <target name="checkstyle">
610 <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
611 classpath="tools/checkstyle/checkstyle-6.14.1-all.jar"/>
612 <checkstyle config="tools/checkstyle/josm_checks.xml">
613 <fileset dir="${basedir}/src/org/openstreetmap/josm" includes="**/*.java"
614 excludes="gui/mappaint/mapcss/parsergen/*.java"/>
615 <fileset dir="${basedir}/test" includes="**/*.java"/>
616 <formatter type="xml" toFile="checkstyle-josm.xml"/>
617 </checkstyle>
618 </target>
619
620 <target name="findbugs" depends="dist">
621 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
622 <path id="findbugs-classpath">
623 <fileset dir="tools/findbugs/">
624 <include name="*.jar"/>
625 </fileset>
626 </path>
627 <property name="findbugs-classpath" refid="findbugs-classpath"/>
628 <findbugs output="xml"
629 outputFile="findbugs-josm.xml"
630 classpath="${findbugs-classpath}"
631 pluginList=""
632 excludeFilter="tools/findbugs/josm-filter.xml"
633 effort="max"
634 >
635 <sourcePath path="${basedir}/src" />
636 <class location="${basedir}/dist/josm-custom.jar" />
637 </findbugs>
638 </target>
639 <target name="run" depends="dist">
640 <java jar="dist/josm-custom.jar" fork="true">
641 <arg value="--set=expert=true"/>
642 <arg value="--set=remotecontrol.enabled=true"/>
643 <arg value="--set=debug.edt-checker.enable=false"/>
644 <jvmarg value="-Djosm.home=/tmp/.josm/"/>
645 </java>
646 </target>
647 <!-- compile build script for generating projection list -->
648 <target name="epsg-compile" depends="compile">
649 <mkdir dir="build2"/>
650 <javac sourcepath="" srcdir="scripts"
651 destdir="build2" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8" classpath="build">
652 </javac>
653 </target>
654 <!-- generate projection list -->
655 <target name="epsg" depends="epsg-compile">
656 <touch file="${epsg.output}"/>
657 <java classname="BuildProjectionDefinitions">
658 <classpath>
659 <pathelement path="."/>
660 <pathelement path="build"/>
661 <pathelement path="build2"/>
662 </classpath>
663 </java>
664 </target>
665</project>
Note: See TracBrowser for help on using the repository browser.