source: josm/trunk/build.xml@ 15972

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

see #17516 - update to error-prone 2.3.5-SNAPSHOT plus following patches for Java 13 compatibility (https://github.com/don-vip/error-prone/commits/jdk13):

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