source: josm/trunk/build.xml@ 14157

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

fix #16601 - test targets: add "-hardfail" variants which will abort with an error code on failure (patch by ris)

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