source: josm/trunk/build.xml@ 14214

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

see #16498 - jacoco 0.8.2.20180819 already supports Java 12 in fact :)

See https://github.com/jacoco/jacoco/issues/738

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