source: josm/trunk/build.xml@ 14867

Last change on this file since 14867 was 14793, checked in by Don-vip, 6 years ago

fix #17278 - update macOS appbundler to https://mvnrepository.com/artifact/com.panayotis/appbundler/1.1.0 for Java 9+ compatibility

  • Property svn:eol-style set to native
File size: 59.4 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!-- ** build.xml - main ant file for JOSM
3**
4** To build run
5** ant clean
6** ant dist
7** This will create 'josm-custom.jar' in directory 'dist'. See also
8** https://josm.openstreetmap.de/wiki/DevelopersGuide/CreateBuild
9**
10-->
11<project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if" xmlns:unless="ant:unless">
12 <target name="init-properties">
13 <property environment="env"/>
14 <!-- Load properties in a target and not at top level, so this build file can be
15 imported from an IDE ant file (Netbeans) without messing up IDE properties.
16 When imported from another file, ${basedir} will point to the parent directory
17 of the importing ant file. Use ${base.dir} instead, which is always the parent
18 directory of this file. -->
19 <dirname property="base.dir" file="${ant.file.josm}"/>
20 <property name="test.dir" location="${base.dir}/test"/>
21 <property name="src.dir" location="${base.dir}/src"/>
22 <condition property="noJavaFX">
23 <or>
24 <isset property="env.JOSM_NOJAVAFX"/>
25 <not>
26 <available classname="javafx.scene.media.Media"/>
27 </not>
28 </or>
29 </condition>
30 <property name="build.dir" location="${base.dir}/build"/>
31 <property name="dist.dir" location="${base.dir}/dist"/>
32 <property name="modules.dir" location="${dist.dir}/modules"/>
33 <property name="tools.dir" location="${base.dir}/tools"/>
34 <property name="pmd.dir" location="${tools.dir}/pmd"/>
35 <property name="checkstyle.dir" location="${tools.dir}/checkstyle"/>
36 <property name="spotbugs.dir" location="${tools.dir}/spotbugs"/>
37 <property name="javacc.home" location="${tools.dir}"/>
38 <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
39 <property name="proj-build.dir" location="${base.dir}/build2"/>
40 <property name="taginfo-build.dir" location="${base.dir}/build2"/>
41 <property name="checkstyle-build.dir" location="${base.dir}/build2"/>
42 <property name="epsg.output" location="${base.dir}/data/projection/custom-epsg"/>
43 <property name="error_prone_core.jar" location="${tools.dir}/error_prone_core.jar"/>
44 <property name="error_prone_javac.jar" location="${tools.dir}/error_prone_javac.jar"/>
45 <property name="dataflow.jar" location="${tools.dir}/dataflow.jar"/>
46 <property name="javacutil.jar" location="${tools.dir}/javacutil.jar"/>
47 <property name="failureaccess.jar" location="${tools.dir}/failureaccess.jar"/>
48 <property name="guava.jar" location="${tools.dir}/guava.jar"/>
49 <property name="jformatstring.jar" location="${spotbugs.dir}/jFormatString-3.0.0.jar"/>
50 <property name="dist.jar" location="${dist.dir}/josm-custom.jar"/>
51 <property name="dist-optimized.jar" location="${dist.dir}/josm-custom-optimized.jar"/>
52 <property name="java.lang.version" value="1.8" />
53 <property name="test.headless" value="true" />
54 <property name="jacoco.includes" value="org.openstreetmap.josm.*" />
55 <property name="jacoco.inclbootstrapclasses" value="false" />
56 <property name="jacoco.inclnolocationclasses" value="false" />
57 <property name="junit.printsummary" value="on" />
58 <!-- build parameter: compression level (ant -Dclevel=N)
59 N ranges from 0 (no compression) to 9 (maximum compression)
60 default: 9 -->
61 <condition property="clevel" value="${clevel}" else="9">
62 <isset property="clevel"/>
63 </condition>
64 <!-- For Java specific stuff by version -->
65 <condition property="isJava9"><matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" /></condition>
66 <condition property="isJava10"><matches string="${ant.java.version}" pattern="1[0-9]" /></condition>
67 <condition property="isJava11"><matches string="${ant.java.version}" pattern="1[1-9]" /></condition>
68 <condition property="isJava12"><matches string="${ant.java.version}" pattern="1[2-9]" /></condition>
69 <condition property="isJava13"><matches string="${ant.java.version}" pattern="1[3-9]" /></condition>
70 <!-- Disable jacoco on Java 13+, see https://github.com/jacoco/jacoco/pull/738 -->
71 <condition property="coverageByDefault">
72 <not>
73 <isset property="isJava13"/>
74 </not>
75 </condition>
76 <condition property="java.library.dir" value="jmods" else="lib">
77 <isset property="isJava9"/>
78 </condition>
79 <path id="groovy.classpath">
80 <fileset dir="${tools.dir}/groovy">
81 <include name="*.jar"/>
82 </fileset>
83 </path>
84 <path id="test.classpath">
85 <fileset dir="${test.dir}/lib">
86 <include name="**/*.jar"/>
87 </fileset>
88 <pathelement path="${dist.jar}"/>
89 <pathelement path="${failureaccess.jar}"/>
90 <pathelement path="${guava.jar}"/>
91 <pathelement path="${pmd.dir}/commons-lang3-3.8.1.jar"/>
92 <pathelement path="${spotbugs.dir}/spotbugs-annotations.jar"/>
93 </path>
94 <path id="pmd.classpath">
95 <fileset dir="${pmd.dir}">
96 <include name="*.jar"/>
97 </fileset>
98 </path>
99 <path id="processor.path">
100 <pathelement location="${error_prone_core.jar}"/>
101 <pathelement location="${dataflow.jar}"/>
102 <pathelement location="${javacutil.jar}"/>
103 <pathelement location="${failureaccess.jar}"/>
104 <pathelement location="${guava.jar}"/>
105 <pathelement location="${jformatstring.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.base/sun.security.util java.base/sun.security.x509 java.desktop/com.apple.eawt java.desktop/com.sun.imageio.spi javafx.graphics/com.sun.javafx.application jdk.deploy/com.sun.deploy.config" />
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"/>
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"/>
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"/>
415 <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
416 <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
417 <arg value="-html5" if:set="isJava9" />
418 <arg value="--add-exports" if:set="isJava9" />
419 <arg value="java.base/sun.security.util=ALL-UNNAMED" if:set="isJava9" />
420 <arg value="--add-exports" if:set="isJava9" />
421 <arg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" />
422 <arg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
423 <arg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
424 <excludepackage name="org/openstreetmap/josm/io/audio/fx" if:set="noJavaFX" />
425 </javadoc>
426 </target>
427 <target name="clean" depends="init-properties">
428 <delete dir="${build.dir}"/>
429 <delete dir="${proj-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 <sequential>
505 <echo message="Running @{testfamily}@{testITsuffix} tests with JUnit"/>
506 <jacoco:coverage destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}"
507 inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
508 <junit printsummary="${junit.printsummary}" fork="true" forkmode="once" failureproperty="test.@{testfamily}@{testITsuffix}.failed">
509 <jvmarg value="-Dfile.encoding=UTF-8"/>
510 <jvmarg value="-javaagent:${test.dir}/lib/jmockit.jar"/>
511 <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
512 <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
513 <jvmarg value="--add-exports" if:set="isJava9" />
514 <jvmarg value="java.base/sun.security.util=ALL-UNNAMED" if:set="isJava9" />
515 <jvmarg value="--add-exports" if:set="isJava9" />
516 <jvmarg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" />
517 <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
518 <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
519 <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
520 <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
521 <jvmarg value="--add-opens" if:set="isJava9" />
522 <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
523 <jvmarg value="--add-opens" if:set="isJava9" />
524 <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
525 <jvmarg value="--add-opens" if:set="isJava9" />
526 <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
527 <jvmarg value="--add-opens" if:set="isJava9" />
528 <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
529 <jvmarg value="--add-opens" if:set="isJava9" />
530 <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
531 <jvmarg value="--add-opens" if:set="isJava9" />
532 <jvmarg value="java.base/jdk.internal.loader=ALL-UNNAMED" if:set="isJava9" />
533 <jvmarg value="--add-opens" if:set="isJava9" />
534 <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
535 <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
536 <sysproperty key="josm.test.data" value="${test.dir}/data"/>
537 <sysproperty key="java.awt.headless" value="${test.headless}"/>
538 <sysproperty key="glass.platform" value="Monocle"/>
539 <sysproperty key="monocle.platform" value="Headless"/>
540 <sysproperty key="prism.order" value="sw"/>
541 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
542 <classpath>
543 <path refid="test.classpath"/>
544 <pathelement path="${test.dir}/build/unit"/>
545 <pathelement path="${test.dir}/build/@{testfamily}"/>
546 <pathelement path="${test.dir}/config"/>
547 </classpath>
548 <formatter type="plain"/>
549 <formatter type="xml"/>
550 <batchtest fork="yes" todir="${test.dir}/report">
551 <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test@{testITsuffix}.class"/>
552 </batchtest>
553 </junit>
554 </jacoco:coverage>
555 </sequential>
556 </macrodef>
557 <target name="test" depends="test-compile" unless="test.notRequired"
558 description="Run unit and functional tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
559 <call-junit testfamily="unit"/>
560 <call-junit testfamily="functional"/>
561 </target>
562 <target name="test-hardfail" depends="test" description="Run 'test' target but abort if tests failed">
563 <fail message="'test' failed">
564 <condition>
565 <or>
566 <isset property="test.unit.failed"/>
567 <isset property="test.functional.failed"/>
568 </or>
569 </condition>
570 </fail>
571 </target>
572 <target name="test-unit" depends="test-compile" unless="test-unit.notRequired"
573 description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
574 <call-junit testfamily="unit"/>
575 </target>
576 <target name="test-unit-hardfail" depends="test-unit" description="Run 'test-unit' target but abort if tests failed">
577 <fail message="'test-unit' failed" if="test.unit.failed"/>
578 </target>
579 <target name="test-it" depends="test-compile" unless="test-it.notRequired"
580 description="Run integration tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
581 <call-junit testfamily="unit" testITsuffix="IT"/>
582 <call-junit testfamily="functional" testITsuffix="IT"/>
583 </target>
584 <target name="test-it-hardfail" depends="test-it" description="Run 'test-it' target but abort if tests failed">
585 <fail message="'test-it' failed">
586 <condition>
587 <or>
588 <isset property="test.unitIT.failed"/>
589 <isset property="test.functionalIT.failed"/>
590 </or>
591 </condition>
592 </fail>
593 </target>
594 <target name="test-perf" depends="test-compile" unless="test-perf.notRequired"
595 description="Run performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
596 <call-junit testfamily="performance" coverage="false"/>
597 </target>
598 <target name="test-perf-hardfail" depends="test-perf" description="Run 'test-perf' target but abort if tests failed">
599 <fail message="'test-perf' failed" if="test.performance.failed"/>
600 </target>
601 <target name="test-html" depends="test, test-it, test-perf" description="Generate HTML test reports">
602 <!-- May require additional ant dependencies like ant-trax package -->
603 <junitreport todir="${test.dir}/report">
604 <fileset dir="${test.dir}/report">
605 <include name="TEST-*.xml"/>
606 </fileset>
607 <report todir="${test.dir}/report/html"/>
608 </junitreport>
609 <jacoco:report>
610 <executiondata>
611 <fileset dir="${test.dir}" includes="*.exec"/>
612 </executiondata>
613 <structure name="JOSM Test Coverage">
614 <classfiles>
615 <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
616 </classfiles>
617 <sourcefiles encoding="UTF-8">
618 <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
619 </sourcefiles>
620 </structure>
621 <html destdir="${test.dir}/report/jacoco"/>
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 <tokenfilter>
728 <replaceregex pattern="^.*;" replace="" flags="gi"/>
729 </tokenfilter>
730 </filterchain>
731 </loadresource>
732 <!-- Delete files that are not in plugin list (like old plugins) -->
733 <loadresource property="file-list">
734 <propertyresource name="plugins"/>
735 <filterchain>
736 <tokenfilter>
737 <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
738 </tokenfilter>
739 <striplinebreaks/>
740 <tokenfilter>
741 <replaceregex pattern="\|$" replace="" flags="gi"/>
742 </tokenfilter>
743 </filterchain>
744 </loadresource>
745 <delete>
746 <restrict>
747 <fileset dir="${dir}"/>
748 <not>
749 <name regex="${file-list}"/>
750 </not>
751 </restrict>
752 </delete>
753 <!-- Download plugins -->
754 <copy todir="${dir}" flatten="true" verbose="true" failonerror="false">
755 <resourcelist>
756 <string value="${plugins}"/>
757 </resourcelist>
758 </copy>
759 <!-- Check plugins -->
760 <as:build-signatures destfile="${dir}/api.sig">
761 <path>
762 <fileset file="${dist-optimized.jar}"/>
763 <fileset file="${java.home}/lib/rt.jar" unless:set="isJava9"/>
764 <fileset file="${java.home}/lib/jce.jar" unless:set="isJava9"/>
765 <fileset file="${java.home}/lib/ext/jfxrt.jar" unless:set="isJava9"/>
766 <fileset dir="${java.home}/jmods" if:set="isJava9"/>
767 </path>
768 </as:build-signatures>
769 <as:check-signature signature="${dir}/api.sig" failonerror="false">
770 <ignore classname="afu.*"/>
771 <ignore classname="android.*"/>
772 <ignore classname="au.*"/>
773 <ignore classname="com.*"/>
774 <ignore classname="de.*"/>
775 <ignore classname="edu.*"/>
776 <ignore classname="groovy.*"/>
777 <ignore classname="io.*"/>
778 <ignore classname="it.*"/>
779 <ignore classname="java.lang.invoke.MethodHandle"/>
780 <ignore classname="javax.*"/>
781 <ignore classname="jdk.swing.interop.*"/>
782 <ignore classname="jogamp.*"/>
783 <ignore classname="junit.*"/>
784 <ignore classname="kdu_jni.*"/>
785 <ignore classname="net.*"/>
786 <ignore classname="netscape.*"/>
787 <ignore classname="nu.*"/>
788 <ignore classname="oracle.*"/>
789 <ignore classname="org.apache.*"/>
790 <ignore classname="org.bouncycastle.*"/>
791 <ignore classname="org.checkerframework.*"/>
792 <ignore classname="org.codehaus.*"/>
793 <ignore classname="org.conscrypt.*"/>
794 <ignore classname="org.dom4j.*"/>
795 <ignore classname="org.eclipse.*"/>
796 <ignore classname="org.ejml.*"/>
797 <ignore classname="org.fusesource.*"/>
798 <ignore classname="org.gdal.*"/>
799 <ignore classname="org.hibernate.*"/>
800 <ignore classname="org.hsqldb.*"/>
801 <ignore classname="org.ibex.*"/>
802 <ignore classname="org.iso_relax.*"/>
803 <ignore classname="org.jaitools.*"/>
804 <ignore classname="org.jaxen.*"/>
805 <ignore classname="org.jboss.*"/>
806 <ignore classname="org.jctools.*"/>
807 <ignore classname="org.jdom.*"/>
808 <ignore classname="org.jdom2.*"/>
809 <ignore classname="org.jfree.*"/>
810 <ignore classname="org.jgraph.*"/>
811 <ignore classname="org.joda.*"/>
812 <ignore classname="org.json.*"/>
813 <ignore classname="org.junit.*"/>
814 <ignore classname="org.jvnet.*"/>
815 <ignore classname="org.kxml2.*"/>
816 <ignore classname="org.objectweb.*"/>
817 <ignore classname="org.osgi.*"/>
818 <ignore classname="org.postgresql.*"/>
819 <ignore classname="org.python.*"/>
820 <ignore classname="org.seasar.*"/>
821 <ignore classname="org.slf4j.*"/>
822 <ignore classname="org.springframework.*"/>
823 <ignore classname="org.testng.*"/>
824 <ignore classname="org.w3c.*"/>
825 <ignore classname="org.zeromq.*"/>
826 <!-- plugins used by another ones -->
827 <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
828 <ignore classname="org.openstreetmap.josm.plugins.jaxb.*"/>
829 <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
830 <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
831 <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
832 <ignore classname="org.openstreetmap.josm.plugins.openjfx.*"/>
833 <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
834 <ignore classname="sun.*"/>
835 <path path="${dir}"/>
836 </as:check-signature>
837 </target>
838
839 <target name="taginfo-compile" depends="dist">
840 <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="TagInfoExtract.java"
841 destdir="${taginfo-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
842 includeantruntime="false" createMissingPackageInfoClass="false"
843 encoding="UTF-8" classpath="${build.dir}">
844 </javac>
845 </target>
846
847 <macrodef name="_taginfo">
848 <attribute name="type"/>
849 <attribute name="output"/>
850 <sequential>
851 <echo message="Generating Taginfo for type @{type} to @{output}"/>
852 <java classname="TagInfoExtract" failonerror="true" fork="false">
853 <sysproperty key="java.awt.headless" value="true"/>
854 <classpath>
855 <pathelement path="${dist.jar}"/>
856 <pathelement path="${taginfo-build.dir}"/>
857 </classpath>
858 <arg value="--type"/>
859 <arg value="@{type}"/>
860 <arg value="--noexit"/>
861 <arg value="--imgurlprefix"/>
862 <arg value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/>
863 <arg value="--output"/>
864 <arg value="@{output}"/>
865 </java>
866 </sequential>
867 </macrodef>
868
869 <target name="taginfo" depends="taginfo-compile">
870 <_taginfo type="mappaint" output="taginfo_style.json"/>
871 <_taginfo type="presets" output="taginfo_presets.json"/>
872 <_taginfo type="external_presets" output="taginfo_external_presets.json"/>
873 </target>
874
875 <target name="imageryindex" depends="init-properties">
876 <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="groovy.classpath"/>
877 <echo message="Checking editor imagery difference"/>
878 <groovy src="scripts/SyncEditorLayerIndex.groovy" classpath="${dist.jar}">
879 <arg value="-noeli"/>
880 <arg value="-p"/>
881 <arg value="imagery_eliout.imagery.xml"/>
882 <arg value="-q"/>
883 <arg value="imagery_josmout.imagery.xml"/>
884 </groovy>
885 </target>
886
887 <target name="imageryindexdownload">
888 <exec append="false" executable="wget" failifexecutionfails="true">
889 <arg value="https://josm.openstreetmap.de/maps"/>
890 <arg value="-O"/>
891 <arg value="imagery_josm.imagery.xml"/>
892 <arg value="--unlink"/>
893 </exec>
894 <exec append="false" executable="wget" failifexecutionfails="true">
895 <arg value="https://josm.openstreetmap.de/wiki/ImageryCompareIgnores?format=txt"/>
896 <arg value="-O"/>
897 <arg value="imagery_josm.ignores.txt"/>
898 <arg value="--unlink"/>
899 </exec>
900 <exec append="false" executable="wget" failifexecutionfails="true">
901 <arg value="https://raw.githubusercontent.com/osmlab/editor-layer-index/gh-pages/imagery.geojson"/>
902 <arg value="-O"/>
903 <arg value="imagery_eli.geojson"/>
904 <arg value="--unlink"/>
905 </exec>
906 <antcall target="imageryindex"/>
907 </target>
908
909 <target name="checkstyle-compile" depends="init-properties">
910 <mkdir dir="${checkstyle-build.dir}"/>
911 <javac sourcepath="" srcdir="${checkstyle.dir}/src" failonerror="true"
912 destdir="${checkstyle-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
913 includeantruntime="false" createMissingPackageInfoClass="false"
914 encoding="UTF-8" classpath="${checkstyle.dir}/checkstyle-all.jar">
915 </javac>
916 </target>
917 <target name="checkstyle-changed" depends="checkstyle-compile">
918 <exec append="false" osfamily="unix" executable="bash" failifexecutionfails="true">
919 <arg value="-c"/>
920 <arg value="svn status -q --ignore-externals src test | grep -o '\(src\|test\)/.*' | xargs java -cp '${checkstyle.dir}/checkstyle-all.jar:${checkstyle-build.dir}' com.puppycrawl.tools.checkstyle.Main -c ${checkstyle.dir}/josm_checks.xml | sed -e 's:\([^ ]*\) [^:]*/\([^:/]*.java\:[^:]*\):(\2)\1:'"/>
921 </exec>
922 <exec append="false" osfamily="windows" executable="powershell" failifexecutionfails="true">
923 <arg value="/c"/>
924 <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]}"/>
925 </exec>
926 </target>
927 <target name="checkstyle" depends="checkstyle-compile">
928 <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
929 classpath="${checkstyle.dir}/checkstyle-all.jar:${checkstyle-build.dir}"/>
930 <checkstyle config="${checkstyle.dir}/josm_checks.xml">
931 <fileset dir="${base.dir}/src/org/openstreetmap/josm" includes="**/*.java"
932 excludes="gui/mappaint/mapcss/parsergen/*.java"/>
933 <fileset dir="${base.dir}/test" includes="**/*.java"/>
934 <fileset dir="${base.dir}/scripts" includes="**/*.java"/>
935 <formatter type="plain"/>
936 <formatter type="xml" toFile="checkstyle-josm.xml"/>
937 </checkstyle>
938 </target>
939
940 <target name="spotbugs" depends="dist">
941 <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${spotbugs.dir}/spotbugs-ant.jar"/>
942 <path id="spotbugs-classpath">
943 <fileset dir="${spotbugs.dir}">
944 <include name="*.jar"/>
945 </fileset>
946 </path>
947 <property name="spotbugs-classpath" refid="spotbugs-classpath"/>
948 <spotbugs output="xml"
949 outputFile="spotbugs-josm.xml"
950 classpath="${spotbugs-classpath}"
951 pluginList=""
952 excludeFilter="${spotbugs.dir}/josm-filter.xml"
953 effort="max"
954 reportLevel="low"
955 >
956 <sourcePath path="${base.dir}/src" />
957 <class location="${dist.jar}" />
958 </spotbugs>
959 </target>
960
961 <target name="pmd" depends="init-properties">
962 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpath="${toString:pmd.classpath}"/>
963 <pmd shortFilenames="true" cacheLocation="${pmd.dir}/cache" encoding="UTF-8">
964 <sourceLanguage name="java" version="${java.lang.version}" />
965 <ruleset>${pmd.dir}/josm-ruleset.xml</ruleset>
966 <formatter type="text" toConsole="true" />
967 <formatter type="xml" toFile="pmd-josm.xml">
968 <param name="encoding" value="UTF-8" />
969 </formatter>
970 <fileset dir="${src.dir}">
971 <include name="org/openstreetmap/josm/**/*.java"/>
972 <exclude name="org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/*.java" />
973 </fileset>
974 <fileset dir="${base.dir}/scripts" includes="**/*.java"/>
975 </pmd>
976 </target>
977
978 <target name="run" depends="dist">
979 <java jar="${dist.jar}" fork="true">
980 <arg value="--set=expert=true"/>
981 <arg value="--set=remotecontrol.enabled=true"/>
982 <arg value="--set=debug.edt-checker.enable=false"/>
983 <jvmarg value="-Djosm.home=/tmp/.josm/"/>
984 </java>
985 </target>
986 <!--
987 ** Compile build script for generating projection list.
988 -->
989 <target name="epsg-compile" depends="init-properties">
990 <property name="proj-classpath" location="${build.dir}"/>
991 <mkdir dir="${proj-build.dir}"/>
992 <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="BuildProjectionDefinitions.java"
993 destdir="${proj-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
994 includeantruntime="false" createMissingPackageInfoClass="false"
995 encoding="UTF-8" classpath="${proj-classpath}">
996 </javac>
997 </target>
998 <!--
999 ** generate projection list.
1000 -->
1001 <target name="epsg" depends="epsg-compile">
1002 <touch file="${epsg.output}" mkdirs="true"/>
1003 <java classname="BuildProjectionDefinitions" failonerror="true" fork="true">
1004 <sysproperty key="java.awt.headless" value="true"/>
1005 <classpath>
1006 <pathelement path="${base.dir}"/>
1007 <pathelement path="${proj-classpath}"/>
1008 <pathelement path="${proj-build.dir}"/>
1009 </classpath>
1010 <arg value="${base.dir}"/>
1011 </java>
1012 </target>
1013 <!--
1014 ** update projection test files after an update of projection definitions
1015 -->
1016 <target name="update-proj-files" depends="test-compile">
1017 <java classname="org.openstreetmap.josm.data.projection.ProjectionRefTest" failonerror="true" fork="true">
1018 <classpath>
1019 <path refid="test.classpath"/>
1020 <pathelement path="${test.dir}/build/unit"/>
1021 </classpath>
1022 </java>
1023 <java classname="org.openstreetmap.josm.data.projection.ProjectionRegressionTest" failonerror="true" fork="true">
1024 <classpath>
1025 <path refid="test.classpath"/>
1026 <pathelement path="${test.dir}/build/unit"/>
1027 </classpath>
1028 </java>
1029 </target>
1030 <!--
1031 ** generate jdeps dependency graph
1032 -->
1033 <target name="jdeps" depends="compile">
1034 <delete dir="${modules.dir}"/>
1035 <mkdir dir="${modules.dir}"/>
1036 <!-- JOSM only -->
1037 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-actions.jar" includes="org/openstreetmap/josm/actions/**/*.class"/>
1038 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-cli.jar" includes="org/openstreetmap/josm/cli/**/*.class"/>
1039 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-command.jar" includes="org/openstreetmap/josm/command/**/*.class"/>
1040 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-data.jar" includes="org/openstreetmap/josm/data/**/*.class"/>
1041 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-gui.jar" includes="org/openstreetmap/josm/gui/**/*.class"/>
1042 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-io.jar" includes="org/openstreetmap/josm/io/**/*.class"/>
1043 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-plugins.jar" includes="org/openstreetmap/josm/plugins/**/*.class"/>
1044 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-spi.jar" includes="org/openstreetmap/josm/spi/**/*.class"/>
1045 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-tools.jar" includes="org/openstreetmap/josm/tools/**/*.class"/>
1046 <exec executable="jdeps" dir="${modules.dir}">
1047 <arg line="-f 'java.*|org.xml.*|org.w3c.*|sun.*|com.*|oauth.*|org.apache.*|org.glassfish.*|org.jdesktop.*|org.openstreetmap.gui.*'"/>
1048 <arg line="-dotoutput dots *.jar"/>
1049 </exec>
1050 <exec executable="dot" dir="${modules.dir}/dots">
1051 <arg line="-O -Tpng summary.dot"/>
1052 </exec>
1053 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-without-dependencies.png"/>
1054 <!-- Direct dependencies -->
1055 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/metadata-extractor.jar" includes="com/drew/**/*.class"/>
1056 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/svgSalamander.jar" includes="com/kitfox/**/*.class"/>
1057 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/javax-json.jar" includes="javax/**/*.class"/>
1058 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/oauth-signpost.jar" includes="oauth/**/*.class"/>
1059 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/commons-compress.jar" includes="org/apache/commons/compress/**/*.class"/>
1060 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/commons-jcs.jar" includes="org/apache/commons/jcs/**/*.class"/>
1061 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/glassfish-json.jar" includes="org/glassfish/**/*.class"/>
1062 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/jdesktop.jar" includes="org/jdesktop/**/*.class"/>
1063 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/jmapviewer.jar" includes="org/openstreetmap/gui/**/*.class"/>
1064 <exec executable="jdeps" dir="${modules.dir}">
1065 <arg line="-f 'java.*|org.xml.*|org.w3c.*|sun.*|com.sun.*|com.google.*|org.tukaani.*|org.apache.commons.logging.*'"/>
1066 <arg line="-dotoutput dots *.jar"/>
1067 </exec>
1068 <exec executable="dot" dir="${modules.dir}/dots">
1069 <arg line="-O -Tpng summary.dot"/>
1070 </exec>
1071 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-with-direct-dependencies.png"/>
1072 <!-- All dependencies -->
1073 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/commons-logging.jar" includes="org/apache/commons/logging/**/*.class"/>
1074 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/google-gdata.jar" includes="com/google/**/*.class"/>
1075 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/tukaani-xz.jar" includes="org/tukaani/**/*.class"/>
1076 <exec executable="jdeps" dir="${modules.dir}">
1077 <arg line="-dotoutput dots *.jar"/>
1078 </exec>
1079 <exec executable="dot" dir="${modules.dir}/dots">
1080 <arg line="-O -Tpng summary.dot"/>
1081 </exec>
1082 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-with-all-dependencies.png"/>
1083 </target>
1084</project>
Note: See TracBrowser for help on using the repository browser.