source: josm/trunk/build.xml@ 16009

Last change on this file since 16009 was 16007, checked in by Don-vip, 5 years ago

see #18140 - fix build errors

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