source: josm/trunk/build.xml@ 15998

Last change on this file since 15998 was 15992, checked in by simon04, 5 years ago

see #18140 - fix ant javadoc

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