source: josm/trunk/build.xml@ 15991

Last change on this file since 15991 was 15977, checked in by simon04, 5 years ago

see #16860, see #18140 - Setup Apache Ivy (patch by wiktorn, modified)

  • Property svn:eol-style set to native
File size: 62.8 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 encoding="UTF-8"
429 packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
430 excludepackagenames="org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.*"
431 windowtitle="JOSM"
432 use="true"
433 private="true"
434 linksource="true"
435 author="false">
436 <link href="https://docs.oracle.com/javase/8/docs/api" unless:set="isJava11" />
437 <link href="https://docs.oracle.com/en/java/javase/11/docs/api" if:set="isJava11" />
438 <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
439 <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
440 <!-- Disable HTML checking until we switch to Java13+, see https://bugs.openjdk.java.net/browse/JDK-8223552 -->
441 <arg value="-Xdoclint:-html" if:set="isJava13" />
442 <arg value="-html5" if:set="isJava9" />
443 <arg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
444 <arg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
445 <excludepackage name="org/openstreetmap/josm/io/audio/fx" if:set="noJavaFX" />
446 </javadoc>
447 </target>
448 <target name="clean" depends="init-properties">
449 <delete dir="${build.dir}"/>
450 <delete dir="${proj-build.dir}"/>
451 <delete dir="${script-build.dir}"/>
452 <delete dir="${checkstyle-build.dir}"/>
453 <delete dir="${dist.dir}"/>
454 <delete dir="${mapcss.dir}/parsergen"/>
455 <delete file="${src.dir}/org/w3/_2001/xmlschema/Adapter1.java"/>
456 <delete dir="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
457 <delete file="${epsg.output}"/>
458 <delete file="${pmd.dir}/cache"/>
459 </target>
460 <macrodef name="init-test-preferences">
461 <attribute name="testfamily"/>
462 <sequential>
463 <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
464 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
465 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
466 </sequential>
467 </macrodef>
468 <target name="test-init" depends="init-properties">
469 <mkdir dir="${test.dir}/build"/>
470 <mkdir dir="${test.dir}/build/unit"/>
471 <mkdir dir="${test.dir}/build/functional"/>
472 <mkdir dir="${test.dir}/build/performance"/>
473 <mkdir dir="${test.dir}/report"/>
474 <init-test-preferences testfamily="unit"/>
475 <init-test-preferences testfamily="functional"/>
476 <init-test-preferences testfamily="performance"/>
477 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${tools.dir}/jacocoant.jar" />
478 </target>
479 <target name="test-clean" depends="init-properties">
480 <delete dir="${test.dir}/build"/>
481 <delete dir="${test.dir}/report"/>
482 <delete file="${test.dir}/jacoco.exec" />
483 <delete file="${test.dir}/jacocoIT.exec" />
484 <delete file="${test.dir}/config/unit-josm.home" failonerror="false"/>
485 <delete file="${test.dir}/config/functional-josm.home" failonerror="false"/>
486 <delete file="${test.dir}/config/performance-josm.home" failonerror="false"/>
487 </target>
488 <macrodef name="call-javac">
489 <attribute name="testfamily"/>
490 <element name="cp-elements"/>
491 <sequential>
492 <javac srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}"
493 target="${java.lang.version}" source="${java.lang.version}" debug="on"
494 includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
495 <compilerarg value="-Xlint:all"/>
496 <compilerarg value="-Xlint:-serial"/>
497 <classpath>
498 <cp-elements/>
499 </classpath>
500 </javac>
501 </sequential>
502 </macrodef>
503 <target name="test-compile" depends="test-init,dist">
504 <call-javac testfamily="unit">
505 <cp-elements>
506 <path refid="test.classpath"/>
507 </cp-elements>
508 </call-javac>
509 <call-javac testfamily="functional">
510 <cp-elements>
511 <path refid="test.classpath"/>
512 <pathelement path="${test.dir}/build/unit"/>
513 </cp-elements>
514 </call-javac>
515 <call-javac testfamily="performance">
516 <cp-elements>
517 <path refid="test.classpath"/>
518 <pathelement path="${test.dir}/build/unit"/>
519 </cp-elements>
520 </call-javac>
521 </target>
522 <macrodef name="call-junit">
523 <attribute name="testfamily"/>
524 <attribute name="testITsuffix" default=""/>
525 <attribute name="coverage" default="${coverageByDefault}"/>
526 <attribute name="includes" default="${default-junit@{testITsuffix}-includes}"/>
527 <attribute name="excludes" default="${default-junit@{testITsuffix}-excludes}"/>
528 <sequential>
529 <echo message="Running @{testfamily}@{testITsuffix} tests with JUnit"/>
530 <jacoco:coverage destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}"
531 inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
532 <junit printsummary="${junit.printsummary}" fork="true" forkmode="once" failureproperty="test.@{testfamily}@{testITsuffix}.failed">
533 <jvmarg value="-Dfile.encoding=UTF-8"/>
534 <jvmarg value="-javaagent:${test.dir}/lib/jmockit.jar"/>
535 <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
536 <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
537 <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
538 <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
539 <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
540 <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
541 <jvmarg value="--add-opens" if:set="isJava9" />
542 <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
543 <jvmarg value="--add-opens" if:set="isJava9" />
544 <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
545 <jvmarg value="--add-opens" if:set="isJava9" />
546 <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
547 <jvmarg value="--add-opens" if:set="isJava9" />
548 <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
549 <jvmarg value="--add-opens" if:set="isJava9" />
550 <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
551 <jvmarg value="--add-opens" if:set="isJava9" />
552 <jvmarg value="java.base/jdk.internal.loader=ALL-UNNAMED" if:set="isJava9" />
553 <jvmarg value="--add-opens" if:set="isJava9" />
554 <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
555 <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
556 <sysproperty key="josm.test.data" value="${test.dir}/data"/>
557 <sysproperty key="java.awt.headless" value="${test.headless}"/>
558 <sysproperty key="glass.platform" value="Monocle"/>
559 <sysproperty key="monocle.platform" value="Headless"/>
560 <sysproperty key="prism.order" value="sw"/>
561 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
562 <classpath>
563 <path refid="test.classpath"/>
564 <pathelement path="${test.dir}/build/unit"/>
565 <pathelement path="${test.dir}/build/@{testfamily}"/>
566 <pathelement path="${test.dir}/config"/>
567 </classpath>
568 <formatter type="plain"/>
569 <formatter type="xml"/>
570 <batchtest fork="yes" todir="${test.dir}/report">
571 <fileset dir="${test.dir}/build/@{testfamily}" includes="@{includes}" excludes="@{excludes}"/>
572 </batchtest>
573 </junit>
574 </jacoco:coverage>
575 </sequential>
576 </macrodef>
577 <target name="test" depends="test-compile" unless="test.notRequired"
578 description="Run unit and functional tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
579 <call-junit testfamily="unit"/>
580 <call-junit testfamily="functional"/>
581 </target>
582 <target name="test-hardfail" depends="test" description="Run 'test' target but abort if tests failed">
583 <fail message="'test' failed">
584 <condition>
585 <or>
586 <isset property="test.unit.failed"/>
587 <isset property="test.functional.failed"/>
588 </or>
589 </condition>
590 </fail>
591 </target>
592 <target name="test-unit" depends="test-compile" unless="test-unit.notRequired"
593 description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
594 <call-junit testfamily="unit"/>
595 </target>
596 <target name="test-unit-hardfail" depends="test-unit" description="Run 'test-unit' target but abort if tests failed">
597 <fail message="'test-unit' failed" if="test.unit.failed"/>
598 </target>
599 <target name="test-it" depends="test-compile" unless="test-it.notRequired"
600 description="Run integration tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
601 <call-junit testfamily="unit" testITsuffix="IT"/>
602 <call-junit testfamily="functional" testITsuffix="IT"/>
603 </target>
604 <target name="test-it-hardfail" depends="test-it" description="Run 'test-it' target but abort if tests failed">
605 <fail message="'test-it' failed">
606 <condition>
607 <or>
608 <isset property="test.unitIT.failed"/>
609 <isset property="test.functionalIT.failed"/>
610 </or>
611 </condition>
612 </fail>
613 </target>
614 <target name="test-perf" depends="test-compile" unless="test-perf.notRequired"
615 description="Run performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
616 <call-junit testfamily="performance" coverage="false"/>
617 </target>
618 <target name="test-perf-hardfail" depends="test-perf" description="Run 'test-perf' target but abort if tests failed">
619 <fail message="'test-perf' failed" if="test.performance.failed"/>
620 </target>
621 <target name="test-html" depends="test, test-it, test-perf" description="Generate HTML, CSV and XML test reports">
622 <!-- May require additional ant dependencies like ant-trax package -->
623 <junitreport todir="${test.dir}/report">
624 <fileset dir="${test.dir}/report">
625 <include name="TEST-*.xml"/>
626 </fileset>
627 <report todir="${test.dir}/report/html"/>
628 </junitreport>
629 <jacoco:report>
630 <executiondata>
631 <fileset dir="${test.dir}" includes="*.exec"/>
632 </executiondata>
633 <structure name="JOSM Test Coverage">
634 <classfiles>
635 <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
636 </classfiles>
637 <sourcefiles encoding="UTF-8">
638 <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
639 </sourcefiles>
640 </structure>
641 <html destdir="${test.dir}/report/jacoco"/>
642 <xml destfile="${test.dir}/report/jacoco.xml"/>
643 <csv destfile="${test.dir}/report/jacoco.csv"/>
644 </jacoco:report>
645 </target>
646 <target name="dist-optimized" depends="dist" unless="isJava11">
647 <taskdef resource="proguard/ant/task.properties" classpath="${tools.dir}/proguard.jar"/>
648 <proguard>
649 -injars ${dist.jar}
650 -outjars ${dist-optimized.jar}
651
652 -libraryjars ${java.home}/${java.library.dir}
653
654 -dontoptimize
655 -dontobfuscate
656
657 # These options probably are not necessary (and make processing a bit slower)
658 -dontskipnonpubliclibraryclasses
659 -dontskipnonpubliclibraryclassmembers
660
661 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
662 public static void main(java.lang.String[]);
663 }
664
665 -keep class * extends org.openstreetmap.josm.io.FileImporter
666 -keep class * extends org.openstreetmap.josm.io.FileExporter
667 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
668 -keep class org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory$PseudoClasses {
669 static boolean *(org.openstreetmap.josm.gui.mappaint.Environment);
670 }
671 -keep class org.apache.commons.logging.impl.*
672
673 -keepclassmembers enum * {
674 public static **[] values();
675 public static ** valueOf(java.lang.String);
676 }
677
678 # Keep unused public classes and methods (needed for plugins)
679 -keep public class * {
680 public protected *;
681 }
682
683 # Keep serialization code
684 -keepclassmembers class * implements java.io.Serializable {
685 static final long serialVersionUID;
686 private static final java.io.ObjectStreamField[] serialPersistentFields;
687 private void writeObject(java.io.ObjectOutputStream);
688 private void readObject(java.io.ObjectInputStream);
689 java.lang.Object writeReplace();
690 java.lang.Object readResolve();
691 }
692
693 # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
694 # This note should not be a problem as we don't use obfuscation
695 -dontnote
696 </proguard>
697 </target>
698 <target name="dist-optimized-report" depends="dist-optimized">
699 <!-- generate difference report between optimized jar and normal one -->
700 <exec executable="perl" dir="${basedir}">
701 <arg value="${tools.dir}/japicc/japi-compliance-checker.pl"/>
702 <arg value="--lib=JOSM"/>
703 <arg value="--keep-internal"/>
704 <arg value="--v1=${version.entry.commit.revision}"/>
705 <arg value="--v2=${version.entry.commit.revision}-optimized"/>
706 <arg value="--report-path=${dist.dir}/compat_report.html"/>
707 <arg value="${dist.jar}"/>
708 <arg value="${dist-optimized.jar}"/>
709 </exec>
710 </target>
711 <target name="check-plugins" depends="dist-optimized" description="Check of plugins binary compatibility" unless="isJava11">
712 <local name="dir"/>
713 <local name="plugins"/>
714 <property name="dir" value="plugin-check"/>
715 <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
716 <classpath path="${tools.dir}/animal-sniffer-ant-tasks.jar"/>
717 </typedef>
718 <delete dir="${dir}" failonerror="false"/>
719 <mkdir dir="${dir}"/>
720 <!-- List of deprecated plugins -->
721 <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
722 <filterchain>
723 <linecontains>
724 <contains value="new DeprecatedPlugin("/>
725 </linecontains>
726 <tokenfilter>
727 <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
728 </tokenfilter>
729 <striplinebreaks/>
730 <tokenfilter>
731 <replaceregex pattern="\|$" replace="" flags="gi"/>
732 </tokenfilter>
733 </filterchain>
734 </loadfile>
735 <!-- Download list of plugins -->
736 <loadresource property="plugins">
737 <url url="https://josm.openstreetmap.de/plugin"/>
738 <filterchain>
739 <linecontainsregexp negate="true">
740 <regexp pattern="^\t.*"/>
741 </linecontainsregexp>
742 <linecontainsregexp negate="true">
743 <regexp pattern="${deprecated-plugins}"/>
744 </linecontainsregexp>
745 <linecontainsregexp negate="true" unless:set="isJava10">
746 <!-- Skip javafx on Java 8/9, built for Java 10+ only -->
747 <regexp pattern="javafx.*"/>
748 </linecontainsregexp>
749 <linecontainsregexp negate="true" unless:set="isJava11">
750 <!-- Skip http2 on Java 8/9/10, built for Java 11+ only -->
751 <regexp pattern="http2.*"/>
752 </linecontainsregexp>
753 <tokenfilter>
754 <replaceregex pattern="^.*;" replace="" flags="gi"/>
755 </tokenfilter>
756 </filterchain>
757 </loadresource>
758 <!-- Delete files that are not in plugin list (like old plugins) -->
759 <loadresource property="file-list">
760 <propertyresource name="plugins"/>
761 <filterchain>
762 <tokenfilter>
763 <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
764 </tokenfilter>
765 <striplinebreaks/>
766 <tokenfilter>
767 <replaceregex pattern="\|$" replace="" flags="gi"/>
768 </tokenfilter>
769 </filterchain>
770 </loadresource>
771 <delete>
772 <restrict>
773 <fileset dir="${dir}"/>
774 <not>
775 <name regex="${file-list}"/>
776 </not>
777 </restrict>
778 </delete>
779 <!-- Download plugins -->
780 <copy todir="${dir}" flatten="true" verbose="true" failonerror="false">
781 <resourcelist>
782 <string value="${plugins}"/>
783 </resourcelist>
784 </copy>
785 <!-- Check plugins -->
786 <as:build-signatures destfile="${dir}/api.sig">
787 <path>
788 <fileset file="${dist-optimized.jar}"/>
789 <fileset file="${java.home}/lib/rt.jar" unless:set="isJava9"/>
790 <fileset file="${java.home}/lib/jce.jar" unless:set="isJava9"/>
791 <fileset file="${java.home}/lib/ext/jfxrt.jar" unless:set="isJava9"/>
792 <fileset dir="${java.home}/jmods" if:set="isJava9"/>
793 <fileset dir="/usr/share/openjfx/lib" unless:set="isJava9"/>
794 </path>
795 </as:build-signatures>
796 <as:check-signature signature="${dir}/api.sig" failonerror="false">
797 <ignore classname="afu.*"/>
798 <ignore classname="android.*"/>
799 <ignore classname="au.*"/>
800 <ignore classname="com.*"/>
801 <ignore classname="de.*"/>
802 <ignore classname="edu.*"/>
803 <ignore classname="groovy.*"/>
804 <ignore classname="io.*"/>
805 <ignore classname="it.*"/>
806 <ignore classname="java.lang.invoke.MethodHandle"/>
807 <ignore classname="java.nio.ByteBuffer"/>
808 <ignore classname="java.nio.FloatBuffer"/>
809 <ignore classname="java.util.list.kotlin.*"/>
810 <ignore classname="javax.*"/>
811 <ignore classname="jdk.swing.interop.*"/>
812 <ignore classname="jogamp.*"/>
813 <ignore classname="junit.*"/>
814 <ignore classname="kdu_jni.*"/>
815 <ignore classname="kotlin.*"/>
816 <ignore classname="net.*"/>
817 <ignore classname="netscape.*"/>
818 <ignore classname="nu.*"/>
819 <ignore classname="oracle.*"/>
820 <ignore classname="org.apache.*"/>
821 <ignore classname="org.bouncycastle.*"/>
822 <ignore classname="org.checkerframework.*"/>
823 <ignore classname="org.codehaus.*"/>
824 <ignore classname="org.conscrypt.*"/>
825 <ignore classname="org.dom4j.*"/>
826 <ignore classname="org.eclipse.*"/>
827 <ignore classname="org.ejml.*"/>
828 <ignore classname="org.fusesource.*"/>
829 <ignore classname="org.gdal.*"/>
830 <ignore classname="org.geotools.data.h2.*"/>
831 <ignore classname="org.geotools.gce.imagemosaic.*"/>
832 <ignore classname="org.hibernate.*"/>
833 <ignore classname="org.hsqldb.*"/>
834 <ignore classname="org.ibex.*"/>
835 <ignore classname="org.iso_relax.*"/>
836 <ignore classname="org.jaitools.*"/>
837 <ignore classname="org.jaxen.*"/>
838 <ignore classname="org.jboss.*"/>
839 <ignore classname="org.jctools.*"/>
840 <ignore classname="org.jdom.*"/>
841 <ignore classname="org.jdom2.*"/>
842 <ignore classname="org.jfree.*"/>
843 <ignore classname="org.jgraph.*"/>
844 <ignore classname="org.joda.*"/>
845 <ignore classname="org.json.*"/>
846 <ignore classname="org.junit.*"/>
847 <ignore classname="org.jvnet.*"/>
848 <ignore classname="org.kxml2.*"/>
849 <ignore classname="org.locationtech.*"/>
850 <ignore classname="org.mozilla.*"/>
851 <ignore classname="org.objectweb.*"/>
852 <ignore classname="org.opentest4j.*"/>
853 <ignore classname="org.osgi.*"/>
854 <ignore classname="org.postgresql.*"/>
855 <ignore classname="org.python.*"/>
856 <ignore classname="org.seasar.*"/>
857 <ignore classname="org.slf4j.*"/>
858 <ignore classname="org.springframework.*"/>
859 <ignore classname="org.testng.*"/>
860 <ignore classname="org.w3c.*"/>
861 <ignore classname="org.zeromq.*"/>
862 <ignore classname="waffle.*"/>
863 <!-- plugins used by another ones -->
864 <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
865 <ignore classname="org.openstreetmap.josm.plugins.jaxb.*"/>
866 <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
867 <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
868 <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
869 <ignore classname="org.openstreetmap.josm.plugins.openjfx.*"/>
870 <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
871 <ignore classname="sun.*"/>
872 <path path="${dir}"/>
873 </as:check-signature>
874 </target>
875
876 <target name="script-compile" depends="dist, test-compile">
877 <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="*.java"
878 destdir="${script-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
879 includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
880 <classpath>
881 <pathelement path="${build.dir}"/>
882 <pathelement path="${test.dir}/build/unit"/>
883 <pathelement path="${guava.jar}"/>
884 <pathelement path="${commons-lang3.jar}"/>
885 </classpath>
886 </javac>
887 </target>
888
889 <macrodef name="_taginfo">
890 <attribute name="type"/>
891 <attribute name="output"/>
892 <sequential>
893 <echo message="Generating Taginfo for type @{type} to @{output}"/>
894 <java classname="TagInfoExtract" failonerror="true" fork="false">
895 <sysproperty key="java.awt.headless" value="true"/>
896 <classpath>
897 <pathelement path="${dist.jar}"/>
898 <pathelement path="${script-build.dir}"/>
899 <pathelement path="${guava.jar}"/>
900 <pathelement path="${commons-lang3.jar}"/>
901 </classpath>
902 <arg value="--type"/>
903 <arg value="@{type}"/>
904 <arg value="--noexit"/>
905 <arg value="--imgurlprefix"/>
906 <arg value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/>
907 <arg value="--output"/>
908 <arg value="@{output}"/>
909 </java>
910 </sequential>
911 </macrodef>
912
913 <target name="taginfo" depends="script-compile">
914 <_taginfo type="mappaint" output="taginfo_style.json"/>
915 <_taginfo type="presets" output="taginfo_presets.json"/>
916 <_taginfo type="external_presets" output="taginfo_external_presets.json"/>
917 </target>
918
919 <target name="imageryindex" depends="init-properties,script-compile">
920 <echo message="Checking editor imagery difference"/>
921 <java classname="SyncEditorLayerIndex" failonerror="true" fork="false">
922 <classpath>
923 <pathelement path="${dist.jar}"/>
924 <pathelement path="${script-build.dir}"/>
925 <pathelement path="${guava.jar}"/>
926 <pathelement path="${commons-lang3.jar}"/>
927 </classpath>
928 <arg value="--noeli"/>
929 <arg value="-p"/>
930 <arg value="imagery_eliout.imagery.xml"/>
931 <arg value="-q"/>
932 <arg value="imagery_josmout.imagery.xml"/>
933 </java>
934 </target>
935
936 <target name="imageryindexdownload">
937 <exec append="false" executable="wget" failifexecutionfails="true">
938 <arg value="https://josm.openstreetmap.de/maps"/>
939 <arg value="-O"/>
940 <arg value="imagery_josm.imagery.xml"/>
941 <arg value="--unlink"/>
942 </exec>
943 <exec append="false" executable="wget" failifexecutionfails="true">
944 <arg value="https://josm.openstreetmap.de/wiki/ImageryCompareIgnores?format=txt"/>
945 <arg value="-O"/>
946 <arg value="imagery_josm.ignores.txt"/>
947 <arg value="--unlink"/>
948 </exec>
949 <exec append="false" executable="wget" failifexecutionfails="true">
950 <arg value="https://raw.githubusercontent.com/osmlab/editor-layer-index/gh-pages/imagery.geojson"/>
951 <arg value="-O"/>
952 <arg value="imagery_eli.geojson"/>
953 <arg value="--unlink"/>
954 </exec>
955 <antcall target="imageryindex"/>
956 </target>
957
958 <target name="checkstyle-compile" depends="init-properties">
959 <mkdir dir="${checkstyle-build.dir}"/>
960 <javac sourcepath="" srcdir="${checkstyle.dir}/src" failonerror="true"
961 destdir="${checkstyle-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
962 includeantruntime="false" createMissingPackageInfoClass="false"
963 encoding="UTF-8" classpath="${checkstyle.dir}/checkstyle-all.jar">
964 </javac>
965 </target>
966 <target name="checkstyle-changed" depends="checkstyle-compile">
967 <exec append="false" osfamily="unix" executable="bash" failifexecutionfails="true">
968 <arg value="-c"/>
969 <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:'"/>
970 </exec>
971 <exec append="false" osfamily="windows" executable="powershell" failifexecutionfails="true">
972 <arg value="/c"/>
973 <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]}"/>
974 </exec>
975 </target>
976 <target name="checkstyle" depends="checkstyle-compile">
977 <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
978 classpath="${checkstyle.dir}/checkstyle-all.jar:${checkstyle-build.dir}"/>
979 <checkstyle config="${checkstyle.dir}/josm_checks.xml">
980 <fileset dir="${base.dir}/src/org/openstreetmap/josm" includes="**/*.java"
981 excludes="gui/mappaint/mapcss/parsergen/*.java"/>
982 <fileset dir="${base.dir}/test" includes="**/*.java"/>
983 <fileset dir="${base.dir}/scripts" includes="**/*.java"/>
984 <formatter type="plain"/>
985 <formatter type="xml" toFile="checkstyle-josm.xml"/>
986 </checkstyle>
987 </target>
988
989 <target name="spotbugs" depends="dist">
990 <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${spotbugs.dir}/spotbugs-ant.jar"/>
991 <path id="spotbugs-classpath">
992 <fileset dir="${spotbugs.dir}">
993 <include name="*.jar"/>
994 </fileset>
995 </path>
996 <property name="spotbugs-classpath" refid="spotbugs-classpath"/>
997 <spotbugs output="xml"
998 outputFile="spotbugs-josm.xml"
999 classpath="${spotbugs-classpath}"
1000 pluginList=""
1001 excludeFilter="${spotbugs.dir}/josm-filter.xml"
1002 effort="max"
1003 reportLevel="low"
1004 >
1005 <classpath>
1006 <path refid="spotbugs-classpath"/>
1007 <path refid="compile.path"/>
1008 </classpath>
1009 <sourcePath path="${base.dir}/src" />
1010 <class location="${dist.jar}" />
1011 </spotbugs>
1012 </target>
1013
1014 <target name="pmd" depends="init-properties">
1015 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpath="${toString:pmd.classpath}"/>
1016 <pmd shortFilenames="true" cacheLocation="${pmd.dir}/cache" encoding="UTF-8">
1017 <sourceLanguage name="java" version="${java.lang.version}" />
1018 <ruleset>${pmd.dir}/josm-ruleset.xml</ruleset>
1019 <formatter type="text" toConsole="true" />
1020 <formatter type="xml" toFile="pmd-josm.xml">
1021 <param name="encoding" value="UTF-8" />
1022 </formatter>
1023 <fileset dir="${src.dir}">
1024 <include name="org/openstreetmap/josm/**/*.java"/>
1025 <exclude name="org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/*.java" />
1026 </fileset>
1027 <fileset dir="${base.dir}/scripts" includes="**/*.java"/>
1028 </pmd>
1029 </target>
1030
1031 <target name="run" depends="dist">
1032 <java jar="${dist.jar}" fork="true">
1033 <arg value="--set=expert=true"/>
1034 <arg value="--set=iso.dates=true"/>
1035 <jvmarg value="-Djosm.home=/tmp/.josm/"/>
1036 </java>
1037 </target>
1038 <!--
1039 ** Compile build script for generating projection list.
1040 -->
1041 <target name="epsg-compile" depends="init-properties">
1042 <property name="proj-classpath" location="${build.dir}"/>
1043 <mkdir dir="${proj-build.dir}"/>
1044 <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="BuildProjectionDefinitions.java"
1045 destdir="${proj-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
1046 includeantruntime="false" createMissingPackageInfoClass="false"
1047 encoding="UTF-8" classpath="${proj-classpath}">
1048 </javac>
1049 </target>
1050 <!--
1051 ** generate projection list.
1052 -->
1053 <target name="epsg" depends="epsg-compile">
1054 <touch file="${epsg.output}" mkdirs="true"/>
1055 <java classname="BuildProjectionDefinitions" failonerror="true" fork="true">
1056 <sysproperty key="java.awt.headless" value="true"/>
1057 <classpath>
1058 <pathelement path="${base.dir}"/>
1059 <pathelement path="${proj-classpath}"/>
1060 <pathelement path="${proj-build.dir}"/>
1061 </classpath>
1062 <arg value="${base.dir}"/>
1063 </java>
1064 </target>
1065 <!--
1066 ** update projection test files after an update of projection definitions
1067 -->
1068 <target name="update-proj-files" depends="test-compile">
1069 <java classname="org.openstreetmap.josm.data.projection.ProjectionRefTest" failonerror="true" fork="true">
1070 <classpath>
1071 <path refid="test.classpath"/>
1072 <pathelement path="${test.dir}/build/unit"/>
1073 </classpath>
1074 </java>
1075 <java classname="org.openstreetmap.josm.data.projection.ProjectionRegressionTest" failonerror="true" fork="true">
1076 <classpath>
1077 <path refid="test.classpath"/>
1078 <pathelement path="${test.dir}/build/unit"/>
1079 </classpath>
1080 </java>
1081 </target>
1082 <!--
1083 ** generate jdeps dependency graph
1084 -->
1085 <target name="jdeps" depends="compile">
1086 <delete dir="${modules.dir}"/>
1087 <mkdir dir="${modules.dir}"/>
1088 <!-- JOSM only -->
1089 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-actions.jar" includes="org/openstreetmap/josm/actions/**/*.class"/>
1090 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-cli.jar" includes="org/openstreetmap/josm/cli/**/*.class"/>
1091 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-command.jar" includes="org/openstreetmap/josm/command/**/*.class"/>
1092 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-data.jar" includes="org/openstreetmap/josm/data/**/*.class"/>
1093 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-gui.jar" includes="org/openstreetmap/josm/gui/**/*.class"/>
1094 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-io.jar" includes="org/openstreetmap/josm/io/**/*.class"/>
1095 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-plugins.jar" includes="org/openstreetmap/josm/plugins/**/*.class"/>
1096 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-spi.jar" includes="org/openstreetmap/josm/spi/**/*.class"/>
1097 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-tools.jar" includes="org/openstreetmap/josm/tools/**/*.class"/>
1098 <exec executable="jdeps" dir="${modules.dir}">
1099 <arg line="-f 'java.*|org.xml.*|org.w3c.*|sun.*|com.*|oauth.*|org.apache.*|org.glassfish.*|org.jdesktop.*|org.openstreetmap.gui.*'"/>
1100 <arg line="-dotoutput dots *.jar"/>
1101 </exec>
1102 <exec executable="dot" dir="${modules.dir}/dots">
1103 <arg line="-O -Tpng summary.dot"/>
1104 </exec>
1105 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-without-dependencies.png"/>
1106 <!-- Direct dependencies -->
1107 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/metadata-extractor.jar" includes="com/drew/**/*.class"/>
1108 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/svgSalamander.jar" includes="com/kitfox/**/*.class"/>
1109 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/javax-json.jar" includes="javax/**/*.class"/>
1110 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/oauth-signpost.jar" includes="oauth/**/*.class"/>
1111 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/commons-compress.jar" includes="org/apache/commons/compress/**/*.class"/>
1112 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/commons-jcs.jar" includes="org/apache/commons/jcs/**/*.class"/>
1113 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/glassfish-json.jar" includes="org/glassfish/**/*.class"/>
1114 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/jdesktop.jar" includes="org/jdesktop/**/*.class"/>
1115 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/jmapviewer.jar" includes="org/openstreetmap/gui/**/*.class"/>
1116 <exec executable="jdeps" dir="${modules.dir}">
1117 <arg line="-f 'java.*|org.xml.*|org.w3c.*|sun.*|com.sun.*|com.google.*|org.tukaani.*|org.apache.commons.logging.*'"/>
1118 <arg line="-dotoutput dots *.jar"/>
1119 </exec>
1120 <exec executable="dot" dir="${modules.dir}/dots">
1121 <arg line="-O -Tpng summary.dot"/>
1122 </exec>
1123 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-with-direct-dependencies.png"/>
1124 <!-- All dependencies -->
1125 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/commons-logging.jar" includes="org/apache/commons/logging/**/*.class"/>
1126 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/google-gdata.jar" includes="com/google/**/*.class"/>
1127 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/tukaani-xz.jar" includes="org/tukaani/**/*.class"/>
1128 <exec executable="jdeps" dir="${modules.dir}">
1129 <arg line="-dotoutput dots *.jar"/>
1130 </exec>
1131 <exec executable="dot" dir="${modules.dir}/dots">
1132 <arg line="-O -Tpng summary.dot"/>
1133 </exec>
1134 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-with-all-dependencies.png"/>
1135 </target>
1136 <target name="resolve" depends="init-ivy">
1137 <ivy:resolve keep="true"/>
1138 <ivy:report todir="${tools.dir}/ivy-report" graph="false"/>
1139 <ivy:cachepath pathid="compile.path" conf="compile"/>
1140 <ivy:cachepath pathid="runtime.path" conf="runtime"/>
1141 <ivy:cachefileset setid="runtime.fileset" conf="runtime"/>
1142 <ivy:cachepath pathid="test.path" conf="test"/>
1143 <ivy:retrieve pattern="${tools.dir}/ivy/[artifact]-[type].[ext]" conf="ivy"/>
1144 </target>
1145 <target name="bootstrap-workspace" description="Copy libraries from ivy cache to workspace folders for IDE" depends="resolve">
1146 <delete dir="${lib.dir}"/>
1147 <ivy:retrieve pattern="${lib.dir}/compile/[artifact]-[type].[ext]" conf="compile"/>
1148 <ivy:retrieve pattern="${lib.dir}/runtime/[artifact]-[type].[ext]" conf="runtime"/>
1149 </target>
1150</project>
Note: See TracBrowser for help on using the repository browser.