source: josm/trunk/build.xml@ 14782

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

replace reflections library (unmaintained) by classgraph.

This allows us to update Guava to current version (27.0.1) with its only dependency (failureaccess 1.0.1).

  • Property svn:eol-style set to native
File size: 58.9 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" xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if" xmlns:unless="ant:unless">
12 <target name="init-properties">
13 <property environment="env"/>
14 <!-- Load properties in a target and not at top level, so this build file can be
15 imported from an IDE ant file (Netbeans) without messing up IDE properties.
16 When imported from another file, ${basedir} will point to the parent directory
17 of the importing ant file. Use ${base.dir} instead, which is always the parent
18 directory of this file. -->
19 <dirname property="base.dir" file="${ant.file.josm}"/>
20 <property name="test.dir" location="${base.dir}/test"/>
21 <property name="src.dir" location="${base.dir}/src"/>
22 <condition property="noJavaFX">
23 <or>
24 <isset property="env.JOSM_NOJAVAFX"/>
25 <not>
26 <available classname="javafx.scene.media.Media"/>
27 </not>
28 </or>
29 </condition>
30 <property name="build.dir" location="${base.dir}/build"/>
31 <property name="dist.dir" location="${base.dir}/dist"/>
32 <property name="modules.dir" location="${dist.dir}/modules"/>
33 <property name="tools.dir" location="${base.dir}/tools"/>
34 <property name="pmd.dir" location="${tools.dir}/pmd"/>
35 <property name="checkstyle.dir" location="${tools.dir}/checkstyle"/>
36 <property name="spotbugs.dir" location="${tools.dir}/spotbugs"/>
37 <property name="javacc.home" location="${tools.dir}"/>
38 <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
39 <property name="proj-build.dir" location="${base.dir}/build2"/>
40 <property name="taginfo-build.dir" location="${base.dir}/build2"/>
41 <property name="checkstyle-build.dir" location="${base.dir}/build2"/>
42 <property name="epsg.output" location="${base.dir}/data/projection/custom-epsg"/>
43 <property name="error_prone_core.jar" location="${tools.dir}/error_prone_core.jar"/>
44 <property name="error_prone_javac.jar" location="${tools.dir}/error_prone_javac.jar"/>
45 <property name="failureaccess.jar" location="${tools.dir}/failureaccess.jar"/>
46 <property name="guava.jar" location="${tools.dir}/guava.jar"/>
47 <property name="jformatstring.jar" location="${spotbugs.dir}/jFormatString-3.0.0.jar"/>
48 <property name="dist.jar" location="${dist.dir}/josm-custom.jar"/>
49 <property name="dist-optimized.jar" location="${dist.dir}/josm-custom-optimized.jar"/>
50 <property name="java.lang.version" value="1.8" />
51 <property name="test.headless" value="true" />
52 <property name="jacoco.includes" value="org.openstreetmap.josm.*" />
53 <property name="jacoco.inclbootstrapclasses" value="false" />
54 <property name="jacoco.inclnolocationclasses" value="false" />
55 <property name="junit.printsummary" value="on" />
56 <!-- build parameter: compression level (ant -Dclevel=N)
57 N ranges from 0 (no compression) to 9 (maximum compression)
58 default: 9 -->
59 <condition property="clevel" value="${clevel}" else="9">
60 <isset property="clevel"/>
61 </condition>
62 <!-- For Java specific stuff by version -->
63 <condition property="isJava9"><matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" /></condition>
64 <condition property="isJava10"><matches string="${ant.java.version}" pattern="1[0-9]" /></condition>
65 <condition property="isJava11"><matches string="${ant.java.version}" pattern="1[1-9]" /></condition>
66 <condition property="isJava12"><matches string="${ant.java.version}" pattern="1[2-9]" /></condition>
67 <condition property="isJava13"><matches string="${ant.java.version}" pattern="1[3-9]" /></condition>
68 <!-- Disable jacoco on Java 13+, see https://github.com/jacoco/jacoco/pull/738 -->
69 <condition property="coverageByDefault">
70 <not>
71 <isset property="isJava13"/>
72 </not>
73 </condition>
74 <condition property="java.library.dir" value="jmods" else="lib">
75 <isset property="isJava9"/>
76 </condition>
77 <path id="groovy.classpath">
78 <fileset dir="${tools.dir}/groovy">
79 <include name="*.jar"/>
80 </fileset>
81 </path>
82 <path id="test.classpath">
83 <fileset dir="${test.dir}/lib">
84 <include name="**/*.jar"/>
85 </fileset>
86 <pathelement path="${dist.jar}"/>
87 <pathelement path="${pmd.dir}/commons-lang3-3.8.1.jar"/>
88 <pathelement path="${spotbugs.dir}/spotbugs-annotations.jar"/>
89 </path>
90 <path id="pmd.classpath">
91 <fileset dir="${pmd.dir}">
92 <include name="*.jar"/>
93 </fileset>
94 </path>
95 <path id="processor.path">
96 <pathelement location="${error_prone_core.jar}"/>
97 <pathelement location="${failureaccess.jar}"/>
98 <pathelement location="${guava.jar}"/>
99 <pathelement location="${jformatstring.jar}"/>
100 </path>
101 </target>
102
103 <!--
104 ** Used by Eclipse ant builder for updating
105 ** the REVISION file used by JOSM
106 -->
107 <target name="create-revision-eclipse">
108 <property name="revision.dir" value="bin"/>
109 <antcall target="create-revision"/>
110 <mkdir dir="bin/META-INF/services"/>
111 <echo encoding="UTF-8" file="bin/META-INF/services/java.text.spi.DecimalFormatSymbolsProvider">org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider</echo>
112 </target>
113 <!--
114 ** Initializes the REVISION.XML file from SVN information
115 -->
116 <target name="init-svn-revision-xml" depends="init-properties">
117 <exec append="false" output="${base.dir}/REVISION.XML" executable="svn" dir="${base.dir}" failifexecutionfails="false" resultproperty="svn.info.result">
118 <env key="LANG" value="C"/>
119 <arg value="info"/>
120 <arg value="--xml"/>
121 <arg value="."/>
122 </exec>
123 <condition property="svn.info.success">
124 <equals arg1="${svn.info.result}" arg2="0" />
125 </condition>
126 </target>
127 <!--
128 ** Initializes the REVISION.XML file from git information
129 -->
130 <target name="init-git-revision-xml" unless="svn.info.success" depends="init-properties">
131 <exec append="false" output="${base.dir}/REVISION.XML" executable="git" dir="${base.dir}" failifexecutionfails="false">
132 <arg value="log"/>
133 <arg value="-1"/>
134 <arg value="--grep=git-svn-id"/>
135 <!--
136 %B: raw body (unwrapped subject and body)
137 %n: new line
138 %ai: author date, ISO 8601 format
139 -->
140 <arg value="--pretty=format:%B%n%ai"/>
141 <arg value="HEAD"/>
142 </exec>
143 <replaceregexp file="${base.dir}/REVISION.XML" flags="s"
144 match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
145 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;"/>
146 </target>
147 <!--
148 ** Creates the REVISION file to be included in the distribution
149 -->
150 <target name="create-revision" depends="init-properties,init-svn-revision-xml,init-git-revision-xml">
151 <property name="revision.dir" value="${build.dir}"/>
152 <xmlproperty file="${base.dir}/REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
153 <delete file="${base.dir}/REVISION.XML"/>
154 <tstamp>
155 <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
156 </tstamp>
157 <property name="version.entry.commit.revision" value="UNKNOWN"/>
158 <property name="version.entry.commit.date" value="UNKNOWN"/>
159 <mkdir dir="${revision.dir}"/>
160 <!-- add Build-Name: ... when making special builds, e.g. DEBIAN -->
161 <echo file="${revision.dir}/REVISION">
162# automatically generated by JOSM build.xml - do not edit
163Revision: ${version.entry.commit.revision}
164Is-Local-Build: true
165Build-Date: ${build.tstamp}
166</echo>
167 </target>
168 <!--
169 ** Check internal XML files against their XSD
170 -->
171 <target name="check-schemas" unless="check-schemas.notRequired" depends="init-properties">
172 <schemavalidate file="data/defaultpresets.xml" >
173 <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="data/tagging-preset.xsd" />
174 </schemavalidate>
175 </target>
176 <!--
177 ** Main target that builds JOSM and checks XML against schemas
178 -->
179 <target name="dist" depends="compile,create-revision,check-schemas,epsg">
180 <echo>Revision ${version.entry.commit.revision}</echo>
181 <copy file="CONTRIBUTION" todir="${build.dir}"/>
182 <copy file="README" todir="${build.dir}"/>
183 <copy file="LICENSE" todir="${build.dir}"/>
184 <!-- create josm-custom.jar -->
185 <delete file="${dist.jar}"/>
186 <jar destfile="${dist.jar}" basedir="${build.dir}" level="${clevel}">
187 <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
188 <manifest>
189 <attribute name="Main-class" value="org.openstreetmap.josm.gui.MainApplication"/>
190 <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
191 <attribute name="Main-Date" value="${version.entry.commit.date}"/>
192 <attribute name="Permissions" value="all-permissions"/>
193 <attribute name="Codebase" value="josm.openstreetmap.de"/>
194 <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
195 <!-- Java 9 stuff. Entries are safely ignored by Java 8 -->
196 <attribute name="Add-Exports" value="java.base/sun.security.util java.base/sun.security.x509 java.desktop/com.apple.eawt java.desktop/com.sun.imageio.spi javafx.graphics/com.sun.javafx.application jdk.deploy/com.sun.deploy.config" />
197 <attribute name="Add-Opens" value="java.base/java.lang java.base/java.nio java.base/jdk.internal.loader java.base/jdk.internal.ref java.desktop/javax.imageio.spi java.desktop/javax.swing.text.html java.prefs/java.util.prefs" />
198 </manifest>
199 <service type="java.text.spi.DecimalFormatSymbolsProvider" provider="org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider" />
200 <zipfileset dir="images" prefix="images"/>
201 <zipfileset dir="data" prefix="data"/>
202 <zipfileset dir="styles" prefix="styles"/>
203 <zipfileset dir="${src.dir}/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
204 </jar>
205 </target>
206 <!-- Mac OS X target -->
207 <target name="mac" depends="init-properties">
208 <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
209 <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="${tools.dir}/appbundler-1.0ea.jar"/>
210 <!-- create MacOS X application bundle -->
211 <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
212 mainclassname="org.openstreetmap.josm.gui.MainApplication"
213 copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
214 applicationCategory="public.app-category.utilities"
215 shortversion="${version.entry.commit.revision} SVN"
216 version="${version.entry.commit.revision} SVN"
217 icon="macosx/JOSM.app/Contents/Resources/JOSM.icns"
218 highResolutionCapable="true">
219
220 <arch name="x86_64"/>
221 <arch name="i386"/>
222
223 <classpath file="${bundle.jar}"/>
224
225 <option value="-Xmx2048m"/>
226
227 <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
228 <option value="-Xdock:name=JOSM"/>
229
230 <!-- OSX specific options, optional -->
231 <option value="-Dapple.laf.useScreenMenuBar=true"/>
232 <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
233 <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
234 <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
235 <option value="-Dcom.apple.smallTabs=true"/>
236 </bundleapp>
237
238 <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
239 <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="${tools.dir}/xmltask.jar"/>
240
241 <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
242 <!-- remove empty CFBundleDocumentTypes definition -->
243 <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/>
244 <!-- insert our own keys -->
245 <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" />
246 </xmltask>
247
248 <!-- create ZIP file with MacOS X application bundle -->
249 <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
250 <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
251 <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
252 </zip>
253 </target>
254 <target name="distmac" depends="dist">
255 <antcall target="mac">
256 <param name="bundle.outdir" value="${dist.dir}"/>
257 <param name="bundle.jar" value="${dist.jar}"/>
258 </antcall>
259 </target>
260 <!-- Windows target -->
261 <target name="distwin" depends="dist">
262 <exec dir="windows" executable="./josm-setup-unix.sh">
263 <arg value="${version.entry.commit.revision}"/>
264 <arg value="${dist.jar}"/>
265 </exec>
266 </target>
267 <target name="javacc" depends="init" unless="javacc.notRequired">
268 <mkdir dir="${mapcss.dir}/parsergen"/>
269 <java classname="javacc" fork="true" failonerror="true">
270 <classpath path="${javacc.home}/javacc.jar"/>
271 <arg value="-DEBUG_PARSER=false"/>
272 <arg value="-DEBUG_TOKEN_MANAGER=false"/>
273 <arg value="-JDK_VERSION=${java.lang.version}"/>
274 <arg value="-GRAMMAR_ENCODING=UTF-8"/>
275 <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
276 <arg value="${mapcss.dir}/MapCSSParser.jj"/>
277 </java>
278 </target>
279 <target name="compile-cots" depends="init">
280 <!-- COTS -->
281 <javac srcdir="${src.dir}" includes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/tukaani/**" nowarn="on" encoding="iso-8859-1"
282 destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeAntRuntime="false" createMissingPackageInfoClass="false">
283 <!-- get rid of "internal proprietary API" warning -->
284 <compilerarg value="-XDignore.symbol.file"/>
285 <exclude name="org/apache/commons/compress/PasswordRequiredException.java"/>
286 <exclude name="org/apache/commons/compress/archivers/**"/>
287 <exclude name="org/apache/commons/compress/changes/**"/>
288 <exclude name="org/apache/commons/compress/compressors/bzip2/BZip2Utils.java"/>
289 <exclude name="org/apache/commons/compress/compressors/brotli/**"/>
290 <exclude name="org/apache/commons/compress/compressors/CompressorStreamFactory.java"/>
291 <exclude name="org/apache/commons/compress/compressors/CompressorStreamProvider.java"/>
292 <exclude name="org/apache/commons/compress/compressors/CompressorException.java"/>
293 <exclude name="org/apache/commons/compress/compressors/FileNameUtil.java"/>
294 <exclude name="org/apache/commons/compress/compressors/deflate/**"/>
295 <exclude name="org/apache/commons/compress/compressors/gzip/**"/>
296 <exclude name="org/apache/commons/compress/compressors/lz4/**"/>
297 <exclude name="org/apache/commons/compress/compressors/lzma/**"/>
298 <exclude name="org/apache/commons/compress/compressors/lz77support/**"/>
299 <exclude name="org/apache/commons/compress/compressors/pack200/**"/>
300 <exclude name="org/apache/commons/compress/compressors/snappy/**"/>
301 <exclude name="org/apache/commons/compress/compressors/xz/XZUtils.java"/>
302 <exclude name="org/apache/commons/compress/compressors/z/**"/>
303 <exclude name="org/apache/commons/compress/compressors/zstandard/**"/>
304 <exclude name="org/apache/commons/compress/parallel/**"/>
305 <exclude name="org/apache/commons/compress/utils/ArchiveUtils.java"/>
306 <exclude name="org/apache/commons/jcs/JCS.java"/>
307 <exclude name="org/apache/commons/jcs/access/GroupCacheAccess.java"/>
308 <exclude name="org/apache/commons/jcs/access/PartitionedCacheAccess.java"/>
309 <exclude name="org/apache/commons/jcs/access/behavior/IGroupCacheAccess.java"/>
310 <exclude name="org/apache/commons/jcs/access/exception/InvalidGroupException.java"/>
311 <exclude name="org/apache/commons/jcs/admin/servlet/**"/>
312 <exclude name="org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCacheMonitor.java"/>
313 <exclude name="org/apache/commons/jcs/auxiliary/disk/jdbc/**"/>
314 <exclude name="org/apache/commons/jcs/auxiliary/lateral/**"/>
315 <exclude name="org/apache/commons/jcs/auxiliary/remote/**"/>
316 <exclude name="org/apache/commons/jcs/engine/CacheAdaptor.java"/>
317 <exclude name="org/apache/commons/jcs/engine/CacheGroup.java"/>
318 <exclude name="org/apache/commons/jcs/engine/CacheWatchRepairable.java"/>
319 <exclude name="org/apache/commons/jcs/engine/Zombie*.java"/>
320 <exclude name="org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java"/>
321 <exclude name="org/apache/commons/jcs/utils/access/**"/>
322 <exclude name="org/apache/commons/jcs/utils/discovery/**"/>
323 <exclude name="org/apache/commons/jcs/utils/net/**"/>
324 <exclude name="org/apache/commons/jcs/utils/props/**"/>
325 <exclude name="org/apache/commons/jcs/utils/servlet/**"/>
326 <exclude name="org/apache/commons/logging/impl/AvalonLogger.java"/>
327 <exclude name="org/apache/commons/logging/impl/Jdk13LumberjackLogger.java"/>
328 <exclude name="org/apache/commons/logging/impl/Log4JLogger.java"/>
329 <exclude name="org/apache/commons/logging/impl/LogKitLogger.java"/>
330 <exclude name="org/apache/commons/logging/impl/ServletContextCleaner.java"/>
331 </javac>
332 </target>
333 <target name="compile-jmapviewer" depends="init">
334 <!-- JMapViewer -->
335 <javac sourcepath="" srcdir="${src.dir}" fork="yes"
336 excludes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java,org/openstreetmap/gui/jmapviewer/JMapViewerTree.java,org/openstreetmap/gui/jmapviewer/checkBoxTree/**,org/openstreetmap/josm/**,org/tukaani/**"
337 destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
338 <compilerarg value="-J-Xbootclasspath/p:${error_prone_javac.jar}" unless:set="isJava9"/>
339 <compilerarg line="-XDcompilePolicy=simple"/>
340 <compilerarg value="-processorpath"/>
341 <compilerarg pathref="processor.path"/>
342 <compilerarg value="-Xlint:cast"/>
343 <compilerarg value="-Xlint:deprecation"/>
344 <compilerarg value="-Xlint:dep-ann"/>
345 <compilerarg value="-Xlint:divzero"/>
346 <compilerarg value="-Xlint:empty"/>
347 <compilerarg value="-Xlint:finally"/>
348 <compilerarg value="-Xlint:overrides"/>
349 <!--<compilerarg value="-Xlint:rawtypes"/>-->
350 <compilerarg value="-Xlint:static"/>
351 <compilerarg value="-Xlint:try"/>
352 <compilerarg value="-Xlint:unchecked"/>
353 <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
354 <compilerarg value="-XDignore.symbol.file"/>
355 <compilerarg value="-Xplugin:ErrorProne -Xep:CatchAndPrintStackTrace:OFF -Xep:ReferenceEquality:OFF -Xep:StringSplitter:OFF"/>
356 <compilerarg line="-Xmaxwarns 1000"/>
357 </javac>
358 </target>
359 <target name="compile" depends="init,javacc,compile-cots,compile-jmapviewer">
360 <!-- JOSM -->
361 <javac sourcepath="" srcdir="${src.dir}" fork="yes"
362 excludes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/**,org/tukaani/**"
363 destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
364 <compilerarg value="-J-Xbootclasspath/p:${error_prone_javac.jar}" unless:set="isJava9"/>
365 <compilerarg line="-XDcompilePolicy=simple"/>
366 <compilerarg value="-processorpath"/>
367 <compilerarg pathref="processor.path"/>
368 <compilerarg value="-Xlint:cast"/>
369 <compilerarg value="-Xlint:deprecation"/>
370 <compilerarg value="-Xlint:dep-ann"/>
371 <compilerarg value="-Xlint:divzero"/>
372 <compilerarg value="-Xlint:empty"/>
373 <compilerarg value="-Xlint:finally"/>
374 <compilerarg value="-Xlint:overrides"/>
375 <!--<compilerarg value="-Xlint:rawtypes"/>-->
376 <compilerarg value="-Xlint:static"/>
377 <compilerarg value="-Xlint:try"/>
378 <compilerarg value="-Xlint:unchecked"/>
379 <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
380 <compilerarg value="-XDignore.symbol.file"/>
381 <compilerarg value="-Xplugin:ErrorProne -Xep:ReferenceEquality:OFF -Xep:ImmutableEnumChecker:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:FloatingPointLiteralPrecision:OFF -Xep:ShortCircuitBoolean:OFF -Xep:StringSplitter:OFF -Xep:JdkObsolete:OFF -Xep:UnnecessaryParentheses:OFF -Xep:EqualsGetClass:OFF -Xep:ThreadPriorityCheck:OFF -Xep:UndefinedEquals:OFF"/>
382 <compilerarg line="-Xmaxwarns 1000"/>
383 <exclude name="org/openstreetmap/josm/io/audio/fx/*.java" if:set="noJavaFX"/>
384 </javac>
385
386 <copy todir="build" failonerror="no" includeemptydirs="no">
387 <fileset dir="resources"/>
388 </copy>
389 </target>
390 <target name="init" depends="init-properties">
391 <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
392 <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
393 </uptodate>
394 <mkdir dir="${build.dir}"/>
395 <mkdir dir="${dist.dir}"/>
396 </target>
397 <target name="javadoc" depends="init-properties">
398 <javadoc destdir="javadoc"
399 sourcepath="${src.dir}"
400 encoding="UTF-8"
401 packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
402 excludepackagenames="org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.*"
403 windowtitle="JOSM"
404 use="true"
405 private="true"
406 linksource="true"
407 author="false">
408 <link href="https://docs.oracle.com/javase/8/docs/api"/>
409 <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
410 <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
411 <arg value="-html5" if:set="isJava9" />
412 <arg value="--add-exports" if:set="isJava9" />
413 <arg value="java.base/sun.security.util=ALL-UNNAMED" if:set="isJava9" />
414 <arg value="--add-exports" if:set="isJava9" />
415 <arg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" />
416 <arg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
417 <arg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
418 <excludepackage name="org/openstreetmap/josm/io/audio/fx" if:set="noJavaFX" />
419 </javadoc>
420 </target>
421 <target name="clean" depends="init-properties">
422 <delete dir="${build.dir}"/>
423 <delete dir="${proj-build.dir}"/>
424 <delete dir="${checkstyle-build.dir}"/>
425 <delete dir="${dist.dir}"/>
426 <delete dir="${mapcss.dir}/parsergen"/>
427 <delete file="${src.dir}/org/w3/_2001/xmlschema/Adapter1.java"/>
428 <delete dir="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
429 <delete file="${epsg.output}"/>
430 <delete file="${pmd.dir}/cache"/>
431 </target>
432 <macrodef name="init-test-preferences">
433 <attribute name="testfamily"/>
434 <sequential>
435 <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
436 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
437 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
438 </sequential>
439 </macrodef>
440 <target name="test-init" depends="init-properties">
441 <mkdir dir="${test.dir}/build"/>
442 <mkdir dir="${test.dir}/build/unit"/>
443 <mkdir dir="${test.dir}/build/functional"/>
444 <mkdir dir="${test.dir}/build/performance"/>
445 <mkdir dir="${test.dir}/report"/>
446 <init-test-preferences testfamily="unit"/>
447 <init-test-preferences testfamily="functional"/>
448 <init-test-preferences testfamily="performance"/>
449 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${tools.dir}/jacocoant.jar" />
450 </target>
451 <target name="test-clean" depends="init-properties">
452 <delete dir="${test.dir}/build"/>
453 <delete dir="${test.dir}/report"/>
454 <delete file="${test.dir}/jacoco.exec" />
455 <delete file="${test.dir}/jacocoIT.exec" />
456 <delete file="${test.dir}/config/unit-josm.home" failonerror="false"/>
457 <delete file="${test.dir}/config/functional-josm.home" failonerror="false"/>
458 <delete file="${test.dir}/config/performance-josm.home" failonerror="false"/>
459 </target>
460 <macrodef name="call-javac">
461 <attribute name="testfamily"/>
462 <element name="cp-elements"/>
463 <sequential>
464 <javac srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}"
465 target="${java.lang.version}" source="${java.lang.version}" debug="on"
466 includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
467 <compilerarg value="-Xlint:all"/>
468 <compilerarg value="-Xlint:-serial"/>
469 <classpath>
470 <cp-elements/>
471 </classpath>
472 </javac>
473 </sequential>
474 </macrodef>
475 <target name="test-compile" depends="test-init,dist">
476 <call-javac testfamily="unit">
477 <cp-elements>
478 <path refid="test.classpath"/>
479 </cp-elements>
480 </call-javac>
481 <call-javac testfamily="functional">
482 <cp-elements>
483 <path refid="test.classpath"/>
484 <pathelement path="${test.dir}/build/unit"/>
485 </cp-elements>
486 </call-javac>
487 <call-javac testfamily="performance">
488 <cp-elements>
489 <path refid="test.classpath"/>
490 <pathelement path="${test.dir}/build/unit"/>
491 </cp-elements>
492 </call-javac>
493 </target>
494 <macrodef name="call-junit">
495 <attribute name="testfamily"/>
496 <attribute name="testITsuffix" default=""/>
497 <attribute name="coverage" default="${coverageByDefault}"/>
498 <sequential>
499 <echo message="Running @{testfamily}@{testITsuffix} tests with JUnit"/>
500 <jacoco:coverage destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}"
501 inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
502 <junit printsummary="${junit.printsummary}" fork="true" forkmode="once" failureproperty="test.@{testfamily}@{testITsuffix}.failed">
503 <jvmarg value="-Dfile.encoding=UTF-8"/>
504 <jvmarg value="-javaagent:${test.dir}/lib/jmockit.jar"/>
505 <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
506 <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
507 <jvmarg value="--add-exports" if:set="isJava9" />
508 <jvmarg value="java.base/sun.security.util=ALL-UNNAMED" if:set="isJava9" />
509 <jvmarg value="--add-exports" if:set="isJava9" />
510 <jvmarg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" />
511 <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
512 <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
513 <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
514 <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
515 <jvmarg value="--add-opens" if:set="isJava9" />
516 <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
517 <jvmarg value="--add-opens" if:set="isJava9" />
518 <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
519 <jvmarg value="--add-opens" if:set="isJava9" />
520 <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
521 <jvmarg value="--add-opens" if:set="isJava9" />
522 <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
523 <jvmarg value="--add-opens" if:set="isJava9" />
524 <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
525 <jvmarg value="--add-opens" if:set="isJava9" />
526 <jvmarg value="java.base/jdk.internal.loader=ALL-UNNAMED" if:set="isJava9" />
527 <jvmarg value="--add-opens" if:set="isJava9" />
528 <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
529 <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
530 <sysproperty key="josm.test.data" value="${test.dir}/data"/>
531 <sysproperty key="java.awt.headless" value="${test.headless}"/>
532 <sysproperty key="glass.platform" value="Monocle"/>
533 <sysproperty key="monocle.platform" value="Headless"/>
534 <sysproperty key="prism.order" value="sw"/>
535 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
536 <classpath>
537 <path refid="test.classpath"/>
538 <pathelement path="${test.dir}/build/unit"/>
539 <pathelement path="${test.dir}/build/@{testfamily}"/>
540 <pathelement path="${test.dir}/config"/>
541 </classpath>
542 <formatter type="plain"/>
543 <formatter type="xml"/>
544 <batchtest fork="yes" todir="${test.dir}/report">
545 <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test@{testITsuffix}.class"/>
546 </batchtest>
547 </junit>
548 </jacoco:coverage>
549 </sequential>
550 </macrodef>
551 <target name="test" depends="test-compile" unless="test.notRequired"
552 description="Run unit and functional tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
553 <call-junit testfamily="unit"/>
554 <call-junit testfamily="functional"/>
555 </target>
556 <target name="test-hardfail" depends="test" description="Run 'test' target but abort if tests failed">
557 <fail message="'test' failed">
558 <condition>
559 <or>
560 <isset property="test.unit.failed"/>
561 <isset property="test.functional.failed"/>
562 </or>
563 </condition>
564 </fail>
565 </target>
566 <target name="test-unit" depends="test-compile" unless="test-unit.notRequired"
567 description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
568 <call-junit testfamily="unit"/>
569 </target>
570 <target name="test-unit-hardfail" depends="test-unit" description="Run 'test-unit' target but abort if tests failed">
571 <fail message="'test-unit' failed" if="test.unit.failed"/>
572 </target>
573 <target name="test-it" depends="test-compile" unless="test-it.notRequired"
574 description="Run integration tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
575 <call-junit testfamily="unit" testITsuffix="IT"/>
576 <call-junit testfamily="functional" testITsuffix="IT"/>
577 </target>
578 <target name="test-it-hardfail" depends="test-it" description="Run 'test-it' target but abort if tests failed">
579 <fail message="'test-it' failed">
580 <condition>
581 <or>
582 <isset property="test.unitIT.failed"/>
583 <isset property="test.functionalIT.failed"/>
584 </or>
585 </condition>
586 </fail>
587 </target>
588 <target name="test-perf" depends="test-compile" unless="test-perf.notRequired"
589 description="Run performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
590 <call-junit testfamily="performance" coverage="false"/>
591 </target>
592 <target name="test-perf-hardfail" depends="test-perf" description="Run 'test-perf' target but abort if tests failed">
593 <fail message="'test-perf' failed" if="test.performance.failed"/>
594 </target>
595 <target name="test-html" depends="test, test-it, test-perf" description="Generate HTML test reports">
596 <!-- May require additional ant dependencies like ant-trax package -->
597 <junitreport todir="${test.dir}/report">
598 <fileset dir="${test.dir}/report">
599 <include name="TEST-*.xml"/>
600 </fileset>
601 <report todir="${test.dir}/report/html"/>
602 </junitreport>
603 <jacoco:report>
604 <executiondata>
605 <fileset dir="${test.dir}" includes="*.exec"/>
606 </executiondata>
607 <structure name="JOSM Test Coverage">
608 <classfiles>
609 <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
610 </classfiles>
611 <sourcefiles encoding="UTF-8">
612 <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
613 </sourcefiles>
614 </structure>
615 <html destdir="${test.dir}/report/jacoco"/>
616 </jacoco:report>
617 </target>
618 <target name="dist-optimized" depends="dist" unless="isJava11">
619 <taskdef resource="proguard/ant/task.properties" classpath="${tools.dir}/proguard.jar"/>
620 <proguard>
621 -injars ${dist.jar}
622 -outjars ${dist-optimized.jar}
623
624 -libraryjars ${java.home}/${java.library.dir}
625
626 -dontoptimize
627 -dontobfuscate
628
629 # These options probably are not necessary (and make processing a bit slower)
630 -dontskipnonpubliclibraryclasses
631 -dontskipnonpubliclibraryclassmembers
632
633 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
634 public static void main(java.lang.String[]);
635 }
636
637 -keep class * extends org.openstreetmap.josm.io.FileImporter
638 -keep class * extends org.openstreetmap.josm.io.FileExporter
639 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
640 -keep class org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory$PseudoClasses {
641 static boolean *(org.openstreetmap.josm.gui.mappaint.Environment);
642 }
643 -keep class org.apache.commons.logging.impl.*
644
645 -keepclassmembers enum * {
646 public static **[] values();
647 public static ** valueOf(java.lang.String);
648 }
649
650 # Keep unused public classes and methods (needed for plugins)
651 -keep public class * {
652 public protected *;
653 }
654
655 # Keep serialization code
656 -keepclassmembers class * implements java.io.Serializable {
657 static final long serialVersionUID;
658 private static final java.io.ObjectStreamField[] serialPersistentFields;
659 private void writeObject(java.io.ObjectOutputStream);
660 private void readObject(java.io.ObjectInputStream);
661 java.lang.Object writeReplace();
662 java.lang.Object readResolve();
663 }
664
665 # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
666 # This note should not be a problem as we don't use obfuscation
667 -dontnote
668 </proguard>
669 </target>
670 <target name="dist-optimized-report" depends="dist-optimized">
671 <!-- generate difference report between optimized jar and normal one -->
672 <exec executable="perl" dir="${basedir}">
673 <arg value="${tools.dir}/japicc/japi-compliance-checker.pl"/>
674 <arg value="--lib=JOSM"/>
675 <arg value="--keep-internal"/>
676 <arg value="--v1=${version.entry.commit.revision}"/>
677 <arg value="--v2=${version.entry.commit.revision}-optimized"/>
678 <arg value="--report-path=${dist.dir}/compat_report.html"/>
679 <arg value="${dist.jar}"/>
680 <arg value="${dist-optimized.jar}"/>
681 </exec>
682 </target>
683 <target name="check-plugins" depends="dist-optimized" description="Check of plugins binary compatibility" unless="isJava11">
684 <local name="dir"/>
685 <local name="plugins"/>
686 <property name="dir" value="plugin-check"/>
687 <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
688 <classpath path="${tools.dir}/animal-sniffer-ant-tasks.jar"/>
689 </typedef>
690 <delete dir="${dir}" failonerror="false"/>
691 <mkdir dir="${dir}"/>
692 <!-- List of deprecated plugins -->
693 <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
694 <filterchain>
695 <linecontains>
696 <contains value="new DeprecatedPlugin("/>
697 </linecontains>
698 <tokenfilter>
699 <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
700 </tokenfilter>
701 <striplinebreaks/>
702 <tokenfilter>
703 <replaceregex pattern="\|$" replace="" flags="gi"/>
704 </tokenfilter>
705 </filterchain>
706 </loadfile>
707 <!-- Download list of plugins -->
708 <loadresource property="plugins">
709 <url url="https://josm.openstreetmap.de/plugin"/>
710 <filterchain>
711 <linecontainsregexp negate="true">
712 <regexp pattern="^\t.*"/>
713 </linecontainsregexp>
714 <linecontainsregexp negate="true">
715 <regexp pattern="${deprecated-plugins}"/>
716 </linecontainsregexp>
717 <linecontainsregexp negate="true" unless:set="isJava10">
718 <!-- Skip javafx on Java 8/9, built for Java 10+ only -->
719 <regexp pattern="javafx.*"/>
720 </linecontainsregexp>
721 <tokenfilter>
722 <replaceregex pattern="^.*;" replace="" flags="gi"/>
723 </tokenfilter>
724 </filterchain>
725 </loadresource>
726 <!-- Delete files that are not in plugin list (like old plugins) -->
727 <loadresource property="file-list">
728 <propertyresource name="plugins"/>
729 <filterchain>
730 <tokenfilter>
731 <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
732 </tokenfilter>
733 <striplinebreaks/>
734 <tokenfilter>
735 <replaceregex pattern="\|$" replace="" flags="gi"/>
736 </tokenfilter>
737 </filterchain>
738 </loadresource>
739 <delete>
740 <restrict>
741 <fileset dir="${dir}"/>
742 <not>
743 <name regex="${file-list}"/>
744 </not>
745 </restrict>
746 </delete>
747 <!-- Download plugins -->
748 <copy todir="${dir}" flatten="true" verbose="true" failonerror="false">
749 <resourcelist>
750 <string value="${plugins}"/>
751 </resourcelist>
752 </copy>
753 <!-- Check plugins -->
754 <as:build-signatures destfile="${dir}/api.sig">
755 <path>
756 <fileset file="${dist-optimized.jar}"/>
757 <fileset file="${java.home}/lib/rt.jar" unless:set="isJava9"/>
758 <fileset file="${java.home}/lib/jce.jar" unless:set="isJava9"/>
759 <fileset file="${java.home}/lib/ext/jfxrt.jar" unless:set="isJava9"/>
760 <fileset dir="${java.home}/jmods" if:set="isJava9"/>
761 </path>
762 </as:build-signatures>
763 <as:check-signature signature="${dir}/api.sig" failonerror="false">
764 <ignore classname="afu.*"/>
765 <ignore classname="android.*"/>
766 <ignore classname="au.*"/>
767 <ignore classname="com.*"/>
768 <ignore classname="de.*"/>
769 <ignore classname="edu.*"/>
770 <ignore classname="groovy.*"/>
771 <ignore classname="io.*"/>
772 <ignore classname="it.*"/>
773 <ignore classname="java.lang.invoke.MethodHandle"/>
774 <ignore classname="javax.*"/>
775 <ignore classname="jdk.swing.interop.*"/>
776 <ignore classname="jogamp.*"/>
777 <ignore classname="junit.*"/>
778 <ignore classname="kdu_jni.*"/>
779 <ignore classname="net.*"/>
780 <ignore classname="netscape.*"/>
781 <ignore classname="nu.*"/>
782 <ignore classname="oracle.*"/>
783 <ignore classname="org.apache.*"/>
784 <ignore classname="org.bouncycastle.*"/>
785 <ignore classname="org.checkerframework.*"/>
786 <ignore classname="org.codehaus.*"/>
787 <ignore classname="org.conscrypt.*"/>
788 <ignore classname="org.dom4j.*"/>
789 <ignore classname="org.eclipse.*"/>
790 <ignore classname="org.ejml.*"/>
791 <ignore classname="org.fusesource.*"/>
792 <ignore classname="org.gdal.*"/>
793 <ignore classname="org.hibernate.*"/>
794 <ignore classname="org.hsqldb.*"/>
795 <ignore classname="org.ibex.*"/>
796 <ignore classname="org.iso_relax.*"/>
797 <ignore classname="org.jaitools.*"/>
798 <ignore classname="org.jaxen.*"/>
799 <ignore classname="org.jboss.*"/>
800 <ignore classname="org.jctools.*"/>
801 <ignore classname="org.jdom.*"/>
802 <ignore classname="org.jdom2.*"/>
803 <ignore classname="org.jfree.*"/>
804 <ignore classname="org.jgraph.*"/>
805 <ignore classname="org.joda.*"/>
806 <ignore classname="org.json.*"/>
807 <ignore classname="org.junit.*"/>
808 <ignore classname="org.jvnet.*"/>
809 <ignore classname="org.kxml2.*"/>
810 <ignore classname="org.objectweb.*"/>
811 <ignore classname="org.osgi.*"/>
812 <ignore classname="org.postgresql.*"/>
813 <ignore classname="org.python.*"/>
814 <ignore classname="org.seasar.*"/>
815 <ignore classname="org.slf4j.*"/>
816 <ignore classname="org.springframework.*"/>
817 <ignore classname="org.testng.*"/>
818 <ignore classname="org.w3c.*"/>
819 <ignore classname="org.zeromq.*"/>
820 <!-- plugins used by another ones -->
821 <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
822 <ignore classname="org.openstreetmap.josm.plugins.jaxb.*"/>
823 <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
824 <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
825 <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
826 <ignore classname="org.openstreetmap.josm.plugins.openjfx.*"/>
827 <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
828 <ignore classname="sun.*"/>
829 <path path="${dir}"/>
830 </as:check-signature>
831 </target>
832
833 <target name="taginfo-compile" depends="dist">
834 <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="TagInfoExtract.java"
835 destdir="${taginfo-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
836 includeantruntime="false" createMissingPackageInfoClass="false"
837 encoding="UTF-8" classpath="${build.dir}">
838 </javac>
839 </target>
840
841 <macrodef name="_taginfo">
842 <attribute name="type"/>
843 <attribute name="output"/>
844 <sequential>
845 <echo message="Generating Taginfo for type @{type} to @{output}"/>
846 <java classname="TagInfoExtract" failonerror="true" fork="false">
847 <sysproperty key="java.awt.headless" value="true"/>
848 <classpath>
849 <pathelement path="${dist.jar}"/>
850 <pathelement path="${taginfo-build.dir}"/>
851 </classpath>
852 <arg value="--type"/>
853 <arg value="@{type}"/>
854 <arg value="--noexit"/>
855 <arg value="--imgurlprefix"/>
856 <arg value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/>
857 <arg value="--output"/>
858 <arg value="@{output}"/>
859 </java>
860 </sequential>
861 </macrodef>
862
863 <target name="taginfo" depends="taginfo-compile">
864 <_taginfo type="mappaint" output="taginfo_style.json"/>
865 <_taginfo type="presets" output="taginfo_presets.json"/>
866 <_taginfo type="external_presets" output="taginfo_external_presets.json"/>
867 </target>
868
869 <target name="imageryindex" depends="init-properties">
870 <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="groovy.classpath"/>
871 <echo message="Checking editor imagery difference"/>
872 <groovy src="scripts/SyncEditorLayerIndex.groovy" classpath="${dist.jar}">
873 <arg value="-noeli"/>
874 <arg value="-p"/>
875 <arg value="imagery_eliout.imagery.xml"/>
876 <arg value="-q"/>
877 <arg value="imagery_josmout.imagery.xml"/>
878 </groovy>
879 </target>
880
881 <target name="imageryindexdownload">
882 <exec append="false" executable="wget" failifexecutionfails="true">
883 <arg value="https://josm.openstreetmap.de/maps"/>
884 <arg value="-O"/>
885 <arg value="imagery_josm.imagery.xml"/>
886 <arg value="--unlink"/>
887 </exec>
888 <exec append="false" executable="wget" failifexecutionfails="true">
889 <arg value="https://josm.openstreetmap.de/wiki/ImageryCompareIgnores?format=txt"/>
890 <arg value="-O"/>
891 <arg value="imagery_josm.ignores.txt"/>
892 <arg value="--unlink"/>
893 </exec>
894 <exec append="false" executable="wget" failifexecutionfails="true">
895 <arg value="https://raw.githubusercontent.com/osmlab/editor-layer-index/gh-pages/imagery.geojson"/>
896 <arg value="-O"/>
897 <arg value="imagery_eli.geojson"/>
898 <arg value="--unlink"/>
899 </exec>
900 <antcall target="imageryindex"/>
901 </target>
902
903 <target name="checkstyle-compile" depends="init-properties">
904 <mkdir dir="${checkstyle-build.dir}"/>
905 <javac sourcepath="" srcdir="${checkstyle.dir}/src" failonerror="true"
906 destdir="${checkstyle-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
907 includeantruntime="false" createMissingPackageInfoClass="false"
908 encoding="UTF-8" classpath="${checkstyle.dir}/checkstyle-all.jar">
909 </javac>
910 </target>
911 <target name="checkstyle-changed" depends="checkstyle-compile">
912 <exec append="false" osfamily="unix" executable="bash" failifexecutionfails="true">
913 <arg value="-c"/>
914 <arg value="svn status -q --ignore-externals src test | grep -o '\(src\|test\)/.*' | xargs java -cp '${checkstyle.dir}/checkstyle-all.jar:${checkstyle-build.dir}' com.puppycrawl.tools.checkstyle.Main -c ${checkstyle.dir}/josm_checks.xml | sed -e 's:\([^ ]*\) [^:]*/\([^:/]*.java\:[^:]*\):(\2)\1:'"/>
915 </exec>
916 <exec append="false" osfamily="windows" executable="powershell" failifexecutionfails="true">
917 <arg value="/c"/>
918 <arg value="svn status -q --ignore-externals src test | ForEach-Object {java -cp '${checkstyle.dir}/checkstyle-all.jar;${checkstyle-build.dir}' com.puppycrawl.tools.checkstyle.Main -c ${checkstyle.dir}/josm_checks.xml $_.split(' ')[7]}"/>
919 </exec>
920 </target>
921 <target name="checkstyle" depends="checkstyle-compile">
922 <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
923 classpath="${checkstyle.dir}/checkstyle-all.jar:${checkstyle-build.dir}"/>
924 <checkstyle config="${checkstyle.dir}/josm_checks.xml">
925 <fileset dir="${base.dir}/src/org/openstreetmap/josm" includes="**/*.java"
926 excludes="gui/mappaint/mapcss/parsergen/*.java"/>
927 <fileset dir="${base.dir}/test" includes="**/*.java"/>
928 <fileset dir="${base.dir}/scripts" includes="**/*.java"/>
929 <formatter type="plain"/>
930 <formatter type="xml" toFile="checkstyle-josm.xml"/>
931 </checkstyle>
932 </target>
933
934 <target name="spotbugs" depends="dist">
935 <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${spotbugs.dir}/spotbugs-ant.jar"/>
936 <path id="spotbugs-classpath">
937 <fileset dir="${spotbugs.dir}">
938 <include name="*.jar"/>
939 </fileset>
940 </path>
941 <property name="spotbugs-classpath" refid="spotbugs-classpath"/>
942 <spotbugs output="xml"
943 outputFile="spotbugs-josm.xml"
944 classpath="${spotbugs-classpath}"
945 pluginList=""
946 excludeFilter="${spotbugs.dir}/josm-filter.xml"
947 effort="max"
948 reportLevel="low"
949 >
950 <sourcePath path="${base.dir}/src" />
951 <class location="${dist.jar}" />
952 </spotbugs>
953 </target>
954
955 <target name="pmd" depends="init-properties">
956 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpath="${toString:pmd.classpath}"/>
957 <pmd shortFilenames="true" cacheLocation="${pmd.dir}/cache" encoding="UTF-8">
958 <sourceLanguage name="java" version="${java.lang.version}" />
959 <ruleset>${pmd.dir}/josm-ruleset.xml</ruleset>
960 <formatter type="text" toConsole="true" />
961 <formatter type="xml" toFile="pmd-josm.xml">
962 <param name="encoding" value="UTF-8" />
963 </formatter>
964 <fileset dir="${src.dir}">
965 <include name="org/openstreetmap/josm/**/*.java"/>
966 <exclude name="org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/*.java" />
967 </fileset>
968 <fileset dir="${base.dir}/scripts" includes="**/*.java"/>
969 </pmd>
970 </target>
971
972 <target name="run" depends="dist">
973 <java jar="${dist.jar}" fork="true">
974 <arg value="--set=expert=true"/>
975 <arg value="--set=remotecontrol.enabled=true"/>
976 <arg value="--set=debug.edt-checker.enable=false"/>
977 <jvmarg value="-Djosm.home=/tmp/.josm/"/>
978 </java>
979 </target>
980 <!--
981 ** Compile build script for generating projection list.
982 -->
983 <target name="epsg-compile" depends="init-properties">
984 <property name="proj-classpath" location="${build.dir}"/>
985 <mkdir dir="${proj-build.dir}"/>
986 <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="BuildProjectionDefinitions.java"
987 destdir="${proj-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
988 includeantruntime="false" createMissingPackageInfoClass="false"
989 encoding="UTF-8" classpath="${proj-classpath}">
990 </javac>
991 </target>
992 <!--
993 ** generate projection list.
994 -->
995 <target name="epsg" depends="epsg-compile">
996 <touch file="${epsg.output}" mkdirs="true"/>
997 <java classname="BuildProjectionDefinitions" failonerror="true" fork="true">
998 <sysproperty key="java.awt.headless" value="true"/>
999 <classpath>
1000 <pathelement path="${base.dir}"/>
1001 <pathelement path="${proj-classpath}"/>
1002 <pathelement path="${proj-build.dir}"/>
1003 </classpath>
1004 <arg value="${base.dir}"/>
1005 </java>
1006 </target>
1007 <!--
1008 ** update projection test files after an update of projection definitions
1009 -->
1010 <target name="update-proj-files" depends="test-compile">
1011 <java classname="org.openstreetmap.josm.data.projection.ProjectionRefTest" failonerror="true" fork="true">
1012 <classpath>
1013 <path refid="test.classpath"/>
1014 <pathelement path="${test.dir}/build/unit"/>
1015 </classpath>
1016 </java>
1017 <java classname="org.openstreetmap.josm.data.projection.ProjectionRegressionTest" failonerror="true" fork="true">
1018 <classpath>
1019 <path refid="test.classpath"/>
1020 <pathelement path="${test.dir}/build/unit"/>
1021 </classpath>
1022 </java>
1023 </target>
1024 <!--
1025 ** generate jdeps dependency graph
1026 -->
1027 <target name="jdeps" depends="compile">
1028 <delete dir="${modules.dir}"/>
1029 <mkdir dir="${modules.dir}"/>
1030 <!-- JOSM only -->
1031 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-actions.jar" includes="org/openstreetmap/josm/actions/**/*.class"/>
1032 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-cli.jar" includes="org/openstreetmap/josm/cli/**/*.class"/>
1033 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-command.jar" includes="org/openstreetmap/josm/command/**/*.class"/>
1034 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-data.jar" includes="org/openstreetmap/josm/data/**/*.class"/>
1035 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-gui.jar" includes="org/openstreetmap/josm/gui/**/*.class"/>
1036 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-io.jar" includes="org/openstreetmap/josm/io/**/*.class"/>
1037 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-plugins.jar" includes="org/openstreetmap/josm/plugins/**/*.class"/>
1038 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-spi.jar" includes="org/openstreetmap/josm/spi/**/*.class"/>
1039 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-tools.jar" includes="org/openstreetmap/josm/tools/**/*.class"/>
1040 <exec executable="jdeps" dir="${modules.dir}">
1041 <arg line="-f 'java.*|org.xml.*|org.w3c.*|sun.*|com.*|oauth.*|org.apache.*|org.glassfish.*|org.jdesktop.*|org.openstreetmap.gui.*'"/>
1042 <arg line="-dotoutput dots *.jar"/>
1043 </exec>
1044 <exec executable="dot" dir="${modules.dir}/dots">
1045 <arg line="-O -Tpng summary.dot"/>
1046 </exec>
1047 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-without-dependencies.png"/>
1048 <!-- Direct dependencies -->
1049 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/metadata-extractor.jar" includes="com/drew/**/*.class"/>
1050 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/svgSalamander.jar" includes="com/kitfox/**/*.class"/>
1051 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/javax-json.jar" includes="javax/**/*.class"/>
1052 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/oauth-signpost.jar" includes="oauth/**/*.class"/>
1053 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/commons-compress.jar" includes="org/apache/commons/compress/**/*.class"/>
1054 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/commons-jcs.jar" includes="org/apache/commons/jcs/**/*.class"/>
1055 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/glassfish-json.jar" includes="org/glassfish/**/*.class"/>
1056 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/jdesktop.jar" includes="org/jdesktop/**/*.class"/>
1057 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/jmapviewer.jar" includes="org/openstreetmap/gui/**/*.class"/>
1058 <exec executable="jdeps" dir="${modules.dir}">
1059 <arg line="-f 'java.*|org.xml.*|org.w3c.*|sun.*|com.sun.*|com.google.*|org.tukaani.*|org.apache.commons.logging.*'"/>
1060 <arg line="-dotoutput dots *.jar"/>
1061 </exec>
1062 <exec executable="dot" dir="${modules.dir}/dots">
1063 <arg line="-O -Tpng summary.dot"/>
1064 </exec>
1065 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-with-direct-dependencies.png"/>
1066 <!-- All dependencies -->
1067 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/commons-logging.jar" includes="org/apache/commons/logging/**/*.class"/>
1068 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/google-gdata.jar" includes="com/google/**/*.class"/>
1069 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/tukaani-xz.jar" includes="org/tukaani/**/*.class"/>
1070 <exec executable="jdeps" dir="${modules.dir}">
1071 <arg line="-dotoutput dots *.jar"/>
1072 </exec>
1073 <exec executable="dot" dir="${modules.dir}/dots">
1074 <arg line="-O -Tpng summary.dot"/>
1075 </exec>
1076 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-with-all-dependencies.png"/>
1077 </target>
1078</project>
Note: See TracBrowser for help on using the repository browser.