source: josm/trunk/build.xml@ 13533

Last change on this file since 13533 was 13523, checked in by Don-vip, 7 years ago

see #16047 - disable jacoco on Java 11+, see https://github.com/jacoco/jacoco/issues/629

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