source: josm/trunk/build.xml@ 13915

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

see #16047 - tune add-exports options for Java 11

  • Property svn:eol-style set to native
File size: 50.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="tools.dir" location="${base.dir}/tools"/>
33 <property name="pmd.dir" location="${tools.dir}/pmd"/>
34 <property name="checkstyle.dir" location="${tools.dir}/checkstyle"/>
35 <property name="spotbugs.dir" location="${tools.dir}/spotbugs"/>
36 <property name="javacc.home" location="${tools.dir}"/>
37 <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
38 <property name="proj-build.dir" location="${base.dir}/build2"/>
39 <property name="checkstyle-build.dir" location="${base.dir}/build2"/>
40 <property name="epsg.output" location="${base.dir}/data/projection/custom-epsg"/>
41 <property name="groovy.jar" location="${tools.dir}/groovy-all.jar"/>
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="jacoco.includes" value="org.openstreetmap.josm.*" />
47 <property name="jacoco.inclbootstrapclasses" value="false" />
48 <property name="jacoco.inclnolocationclasses" value="false" />
49 <!-- build parameter: compression level (ant -Dclevel=N)
50 N ranges from 0 (no compression) to 9 (maximum compression)
51 default: 9 -->
52 <condition property="clevel" value="${clevel}" else="9">
53 <isset property="clevel"/>
54 </condition>
55 <!-- For Java9-specific stuff -->
56 <condition property="isJava9">
57 <matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" />
58 </condition>
59 <!-- For Java10-specific stuff -->
60 <condition property="isJava10">
61 <matches string="${ant.java.version}" pattern="1[0-9]" />
62 </condition>
63 <!-- For Java11-specific stuff -->
64 <condition property="isJava11">
65 <matches string="${ant.java.version}" pattern="1[1-9]" />
66 </condition>
67 <!-- Disable error_prone on Java 10+, see https://github.com/google/error-prone/issues/860 -->
68 <condition property="javac.compiler" value="modern" else="com.google.errorprone.ErrorProneAntCompilerAdapter">
69 <isset property="isJava10"/>
70 </condition>
71 <!-- Disable jacoco on Java 11+, see https://github.com/jacoco/jacoco/issues/629 -->
72 <condition property="coverageByDefault">
73 <not>
74 <isset property="isJava11"/>
75 </not>
76 </condition>
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="${groovy.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 value="-Xlint:cast"/>
331 <compilerarg value="-Xlint:deprecation"/>
332 <compilerarg value="-Xlint:dep-ann"/>
333 <compilerarg value="-Xlint:divzero"/>
334 <compilerarg value="-Xlint:empty"/>
335 <compilerarg value="-Xlint:finally"/>
336 <compilerarg value="-Xlint:overrides"/>
337 <!--<compilerarg value="-Xlint:rawtypes"/>-->
338 <compilerarg value="-Xlint:static"/>
339 <compilerarg value="-Xlint:try"/>
340 <compilerarg value="-Xlint:unchecked"/>
341 <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
342 <compilerarg value="-XDignore.symbol.file"/>
343 <compilerarg value="-Xep:ReferenceEquality:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
344 <compilerarg value="-Xep:StringSplitter:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
345 <compilerarg line="-Xmaxwarns 1000"/>
346 </javac>
347 </target>
348 <target name="compile" depends="init,javacc,compile-cots,compile-jmapviewer">
349 <!-- JOSM -->
350 <javac compiler="${javac.compiler}" sourcepath="" srcdir="${src.dir}"
351 excludes="com/**,javax/**,gnu/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/**,org/tukaani/**"
352 destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
353 <compilerclasspath>
354 <pathelement location="${error_prone_ant.jar}"/>
355 </compilerclasspath>
356 <compilerarg value="-Xlint:cast"/>
357 <compilerarg value="-Xlint:deprecation"/>
358 <compilerarg value="-Xlint:dep-ann"/>
359 <compilerarg value="-Xlint:divzero"/>
360 <compilerarg value="-Xlint:empty"/>
361 <compilerarg value="-Xlint:finally"/>
362 <compilerarg value="-Xlint:overrides"/>
363 <!--<compilerarg value="-Xlint:rawtypes"/>-->
364 <compilerarg value="-Xlint:static"/>
365 <compilerarg value="-Xlint:try"/>
366 <compilerarg value="-Xlint:unchecked"/>
367 <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
368 <compilerarg value="-XDignore.symbol.file"/>
369 <compilerarg value="-Xep:ReferenceEquality:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
370 <compilerarg value="-Xep:ImmutableEnumChecker:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
371 <compilerarg value="-Xep:FutureReturnValueIgnored:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
372 <compilerarg value="-Xep:FloatingPointLiteralPrecision:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
373 <compilerarg value="-Xep:ShortCircuitBoolean:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
374 <compilerarg value="-Xep:StringSplitter:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
375 <compilerarg value="-Xep:JdkObsolete:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
376 <compilerarg line="-Xmaxwarns 1000"/>
377 <exclude name="org/openstreetmap/josm/io/audio/fx/*.java" if:set="noJavaFX"/>
378 </javac>
379
380 <copy todir="build" failonerror="no" includeemptydirs="no">
381 <fileset dir="resources"/>
382 </copy>
383 </target>
384 <target name="init" depends="init-properties">
385 <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
386 <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
387 </uptodate>
388 <mkdir dir="${build.dir}"/>
389 <mkdir dir="${dist.dir}"/>
390 </target>
391 <target name="javadoc" depends="init-properties">
392 <javadoc destdir="javadoc"
393 sourcepath="${src.dir}"
394 encoding="UTF-8"
395 packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
396 excludepackagenames="org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.*"
397 windowtitle="JOSM"
398 use="true"
399 private="true"
400 linksource="true"
401 author="false">
402 <link href="http://docs.oracle.com/javase/8/docs/api"/>
403 <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
404 <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
405 <arg value="-html5" if:set="isJava9" />
406 <arg value="--add-exports" if:set="isJava9" />
407 <arg value="java.base/sun.security.util=ALL-UNNAMED" if:set="isJava9" />
408 <arg value="--add-exports" if:set="isJava9" />
409 <arg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" />
410 <arg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
411 <arg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
412 <excludepackage name="org/openstreetmap/josm/io/audio/fx" if:set="noJavaFX" />
413 </javadoc>
414 </target>
415 <target name="clean" depends="init-properties">
416 <delete dir="${build.dir}"/>
417 <delete dir="${proj-build.dir}"/>
418 <delete dir="${checkstyle-build.dir}"/>
419 <delete dir="${dist.dir}"/>
420 <delete dir="${mapcss.dir}/parsergen"/>
421 <delete file="${src.dir}/org/w3/_2001/xmlschema/Adapter1.java"/>
422 <delete dir="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
423 <delete file="${epsg.output}"/>
424 <delete file="${pmd.dir}/cache"/>
425 </target>
426 <macrodef name="init-test-preferences">
427 <attribute name="testfamily"/>
428 <sequential>
429 <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
430 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
431 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
432 </sequential>
433 </macrodef>
434 <target name="test-init" depends="init-properties">
435 <mkdir dir="${test.dir}/build"/>
436 <mkdir dir="${test.dir}/build/unit"/>
437 <mkdir dir="${test.dir}/build/functional"/>
438 <mkdir dir="${test.dir}/build/performance"/>
439 <mkdir dir="${test.dir}/report"/>
440 <init-test-preferences testfamily="unit"/>
441 <init-test-preferences testfamily="functional"/>
442 <init-test-preferences testfamily="performance"/>
443 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${tools.dir}/jacocoant.jar" />
444 </target>
445 <target name="test-clean" depends="init-properties">
446 <delete dir="${test.dir}/build"/>
447 <delete dir="${test.dir}/report"/>
448 <delete file="${test.dir}/jacoco.exec" />
449 <delete file="${test.dir}/jacocoIT.exec" />
450 <delete file="${test.dir}/config/unit-josm.home" failonerror="false"/>
451 <delete file="${test.dir}/config/functional-josm.home" failonerror="false"/>
452 <delete file="${test.dir}/config/performance-josm.home" failonerror="false"/>
453 </target>
454 <macrodef name="call-groovyc">
455 <attribute name="testfamily"/>
456 <element name="cp-elements"/>
457 <sequential>
458 <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
459 <classpath>
460 <cp-elements/>
461 </classpath>
462 <javac target="${java.lang.version}" source="${java.lang.version}" debug="on" encoding="UTF-8">
463 <compilerarg value="-Xlint:all"/>
464 <compilerarg value="-Xlint:-serial"/>
465 </javac>
466 </groovyc>
467 </sequential>
468 </macrodef>
469 <target name="test-compile" depends="test-init,dist">
470 <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="${groovy.jar}"/>
471 <call-groovyc testfamily="unit">
472 <cp-elements>
473 <path refid="test.classpath"/>
474 </cp-elements>
475 </call-groovyc>
476 <call-groovyc testfamily="functional">
477 <cp-elements>
478 <path refid="test.classpath"/>
479 <pathelement path="${test.dir}/build/unit"/>
480 </cp-elements>
481 </call-groovyc>
482 <call-groovyc testfamily="performance">
483 <cp-elements>
484 <path refid="test.classpath"/>
485 <pathelement path="${test.dir}/build/unit"/>
486 </cp-elements>
487 </call-groovyc>
488 </target>
489 <macrodef name="call-junit">
490 <attribute name="testfamily"/>
491 <attribute name="testITsuffix" default=""/>
492 <attribute name="coverage" default="${coverageByDefault}"/>
493 <sequential>
494 <echo message="Running @{testfamily}@{testITsuffix} tests with JUnit"/>
495 <jacoco:coverage destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}"
496 inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
497 <junit printsummary="yes" fork="true" forkmode="once">
498 <jvmarg value="-Dfile.encoding=UTF-8"/>
499 <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
500 <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
501 <jvmarg value="--add-exports" if:set="isJava9" />
502 <jvmarg value="java.base/sun.security.util=ALL-UNNAMED" if:set="isJava9" />
503 <jvmarg value="--add-exports" if:set="isJava9" />
504 <jvmarg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" />
505 <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
506 <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
507 <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
508 <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
509 <jvmarg value="--add-opens" if:set="isJava9" />
510 <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
511 <jvmarg value="--add-opens" if:set="isJava9" />
512 <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
513 <jvmarg value="--add-opens" if:set="isJava9" />
514 <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
515 <jvmarg value="--add-opens" if:set="isJava9" />
516 <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
517 <jvmarg value="--add-opens" if:set="isJava9" />
518 <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
519 <jvmarg value="--add-opens" if:set="isJava9" />
520 <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
521 <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
522 <sysproperty key="josm.test.data" value="${test.dir}/data"/>
523 <sysproperty key="java.awt.headless" value="true"/>
524 <sysproperty key="glass.platform" value="Monocle"/>
525 <sysproperty key="monocle.platform" value="Headless"/>
526 <sysproperty key="prism.order" value="sw"/>
527 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
528 <classpath>
529 <path refid="test.classpath"/>
530 <pathelement path="${test.dir}/build/unit"/>
531 <pathelement path="${test.dir}/build/@{testfamily}"/>
532 <pathelement path="${test.dir}/config"/>
533 </classpath>
534 <formatter type="plain"/>
535 <formatter type="xml"/>
536 <batchtest fork="yes" todir="${test.dir}/report">
537 <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test@{testITsuffix}.class"/>
538 </batchtest>
539 </junit>
540 </jacoco:coverage>
541 </sequential>
542 </macrodef>
543 <target name="test" depends="test-compile" unless="test.notRequired"
544 description="Run unit and functional tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
545 <call-junit testfamily="unit"/>
546 <call-junit testfamily="functional"/>
547 </target>
548 <target name="test-it" depends="test-compile" unless="test-it.notRequired"
549 description="Run integration tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
550 <call-junit testfamily="unit" testITsuffix="IT"/>
551 <call-junit testfamily="functional" testITsuffix="IT"/>
552 </target>
553 <target name="test-perf" depends="test-compile" unless="test-perf.notRequired"
554 description="Run performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
555 <call-junit testfamily="performance" coverage="false"/>
556 </target>
557 <target name="test-html" depends="test, test-it, test-perf" description="Generate HTML test reports">
558 <!-- May require additional ant dependencies like ant-trax package -->
559 <junitreport todir="${test.dir}/report">
560 <fileset dir="${test.dir}/report">
561 <include name="TEST-*.xml"/>
562 </fileset>
563 <report todir="${test.dir}/report/html"/>
564 </junitreport>
565 <jacoco:report>
566 <executiondata>
567 <fileset dir="${test.dir}" includes="*.exec"/>
568 </executiondata>
569 <structure name="JOSM Test Coverage">
570 <classfiles>
571 <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
572 </classfiles>
573 <sourcefiles encoding="UTF-8">
574 <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
575 </sourcefiles>
576 </structure>
577 <html destdir="${test.dir}/report/jacoco"/>
578 </jacoco:report>
579 </target>
580 <target name="dist-optimized" depends="dist">
581 <taskdef resource="proguard/ant/task.properties" classpath="${tools.dir}/proguard.jar"/>
582 <proguard>
583 -injars ${dist.jar}
584 -outjars ${dist-optimized.jar}
585
586 -libraryjars ${java.home}/lib
587
588 -dontoptimize
589 -dontobfuscate
590
591 # These options probably are not necessary (and make processing a bit slower)
592 -dontskipnonpubliclibraryclasses
593 -dontskipnonpubliclibraryclassmembers
594
595 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
596 public static void main(java.lang.String[]);
597 }
598
599 -keep class * extends org.openstreetmap.josm.io.FileImporter
600 -keep class * extends org.openstreetmap.josm.io.FileExporter
601 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
602 -keep class org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory$PseudoClasses {
603 static boolean *(org.openstreetmap.josm.gui.mappaint.Environment);
604 }
605 -keep class org.apache.commons.logging.impl.*
606
607 -keepclassmembers enum * {
608 public static **[] values();
609 public static ** valueOf(java.lang.String);
610 }
611
612 # Keep unused public classes and methods (needed for plugins)
613 -keep public class * {
614 public protected *;
615 }
616
617 # Keep serialization code
618 -keepclassmembers class * implements java.io.Serializable {
619 static final long serialVersionUID;
620 private static final java.io.ObjectStreamField[] serialPersistentFields;
621 private void writeObject(java.io.ObjectOutputStream);
622 private void readObject(java.io.ObjectInputStream);
623 java.lang.Object writeReplace();
624 java.lang.Object readResolve();
625 }
626
627 # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
628 # This note should not be a problem as we don't use obfuscation
629 -dontnote
630 </proguard>
631 </target>
632 <!-- Proguard does not support Java 9 : http://sourceforge.net/p/proguard/bugs/551/ -->
633 <target name="dist-optimized-report" depends="dist-optimized" unless="isJava9">
634 <!-- generate difference report between optimized jar and normal one -->
635 <exec executable="perl" dir="${basedir}">
636 <arg value="${tools.dir}/japicc/japi-compliance-checker.pl"/>
637 <arg value="--lib=JOSM"/>
638 <arg value="--keep-internal"/>
639 <arg value="--v1=${version.entry.commit.revision}"/>
640 <arg value="--v2=${version.entry.commit.revision}-optimized"/>
641 <arg value="--report-path=${dist.dir}/compat_report.html"/>
642 <arg value="${dist.jar}"/>
643 <arg value="${dist-optimized.jar}"/>
644 </exec>
645 </target>
646 <target name="check-plugins" depends="dist-optimized" description="Check of plugins binary compatibility">
647 <local name="dir"/>
648 <local name="plugins"/>
649 <property name="dir" value="plugin-check"/>
650 <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
651 <classpath path="${tools.dir}/animal-sniffer-ant-tasks.jar"/>
652 </typedef>
653 <delete dir="${dir}" failonerror="false"/>
654 <mkdir dir="${dir}"/>
655 <!-- List of deprecated plugins -->
656 <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
657 <filterchain>
658 <linecontains>
659 <contains value="new DeprecatedPlugin("/>
660 </linecontains>
661 <tokenfilter>
662 <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
663 </tokenfilter>
664 <striplinebreaks/>
665 <tokenfilter>
666 <replaceregex pattern="\|$" replace="" flags="gi"/>
667 </tokenfilter>
668 </filterchain>
669 </loadfile>
670 <!-- Download list of plugins -->
671 <loadresource property="plugins">
672 <url url="https://josm.openstreetmap.de/plugin"/>
673 <filterchain>
674 <linecontainsregexp negate="true">
675 <regexp pattern="^\t.*"/>
676 </linecontainsregexp>
677 <linecontainsregexp negate="true">
678 <regexp pattern="${deprecated-plugins}"/>
679 </linecontainsregexp>
680 <tokenfilter>
681 <replaceregex pattern="^.*;" replace="" flags="gi"/>
682 </tokenfilter>
683 </filterchain>
684 </loadresource>
685 <!-- Delete files that are not in plugin list (like old plugins) -->
686 <loadresource property="file-list">
687 <propertyresource name="plugins"/>
688 <filterchain>
689 <tokenfilter>
690 <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
691 </tokenfilter>
692 <striplinebreaks/>
693 <tokenfilter>
694 <replaceregex pattern="\|$" replace="" flags="gi"/>
695 </tokenfilter>
696 </filterchain>
697 </loadresource>
698 <delete>
699 <restrict>
700 <fileset dir="${dir}"/>
701 <not>
702 <name regex="${file-list}"/>
703 </not>
704 </restrict>
705 </delete>
706 <!-- Download plugins -->
707 <copy todir="${dir}" flatten="true" verbose="true" failonerror="false">
708 <resourcelist>
709 <string value="${plugins}"/>
710 </resourcelist>
711 </copy>
712 <!-- Check plugins -->
713 <as:build-signatures destfile="${dir}/api.sig">
714 <path>
715 <fileset file="${dist-optimized.jar}"/>
716 <fileset file="${java.home}/lib/rt.jar"/>
717 <fileset file="${java.home}/lib/jce.jar"/>
718 <fileset file="${java.home}/lib/ext/jfxrt.jar"/>
719 </path>
720 </as:build-signatures>
721 <as:check-signature signature="${dir}/api.sig" failonerror="false">
722 <ignore classname="afu.*"/>
723 <ignore classname="au.*"/>
724 <ignore classname="com.*"/>
725 <ignore classname="de.*"/>
726 <ignore classname="edu.*"/>
727 <ignore classname="groovy.*"/>
728 <ignore classname="it.*"/>
729 <ignore classname="javax.*"/>
730 <ignore classname="jogamp.*"/>
731 <ignore classname="junit.*"/>
732 <ignore classname="kdu_jni.*"/>
733 <ignore classname="net.*"/>
734 <ignore classname="netscape.*"/>
735 <ignore classname="nu.*"/>
736 <ignore classname="oracle.*"/>
737 <ignore classname="org.apache.*"/>
738 <ignore classname="org.bouncycastle.*"/>
739 <ignore classname="org.checkerframework.*"/>
740 <ignore classname="org.codehaus.*"/>
741 <ignore classname="org.dom4j.*"/>
742 <ignore classname="org.eclipse.*"/>
743 <ignore classname="org.ejml.*"/>
744 <ignore classname="org.gdal.*"/>
745 <ignore classname="org.hibernate.*"/>
746 <ignore classname="org.hsqldb.*"/>
747 <ignore classname="org.ibex.*"/>
748 <ignore classname="org.iso_relax.*"/>
749 <ignore classname="org.jaitools.*"/>
750 <ignore classname="org.jaxen.*"/>
751 <ignore classname="org.jboss.*"/>
752 <ignore classname="org.jdom.*"/>
753 <ignore classname="org.jdom2.*"/>
754 <ignore classname="org.jfree.*"/>
755 <ignore classname="org.jgraph.*"/>
756 <ignore classname="org.joda.*"/>
757 <ignore classname="org.junit.*"/>
758 <ignore classname="org.jvnet.*"/>
759 <ignore classname="org.kxml2.*"/>
760 <ignore classname="org.objectweb.*"/>
761 <ignore classname="org.osgi.*"/>
762 <ignore classname="org.postgresql.*"/>
763 <ignore classname="org.python.*"/>
764 <ignore classname="org.seasar.*"/>
765 <ignore classname="org.slf4j.*"/>
766 <ignore classname="org.springframework.*"/>
767 <ignore classname="org.testng.*"/>
768 <ignore classname="org.w3c.*"/>
769 <ignore classname="org.zeromq.*"/>
770 <!-- plugins used by another ones -->
771 <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
772 <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
773 <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
774 <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
775 <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
776 <ignore classname="sun.*"/>
777 <path path="${dir}"/>
778 </as:check-signature>
779 </target>
780
781 <macrodef name="_taginfo">
782 <attribute name="type"/>
783 <attribute name="output"/>
784 <sequential>
785 <echo message="Generating Taginfo for type @{type} to @{output}"/>
786 <groovy src="${taginfoextract}" classpath="${dist.jar}:${spotbugs.dir}/spotbugs-annotations.jar">
787 <arg value="-t"/>
788 <arg value="@{type}"/>
789 <arg value="--noexit"/>
790 <arg value="--svnweb"/>
791 <arg value="--imgurlprefix"/>
792 <arg value="${imgurlprefix}"/>
793 <arg value="-o"/>
794 <arg value="@{output}"/>
795 </groovy>
796 </sequential>
797 </macrodef>
798
799 <target name="taginfo" depends="dist">
800 <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${groovy.jar};${tools.dir}/commons-cli-1.3.1.jar"/>
801 <property name="taginfoextract" value="scripts/TagInfoExtract.groovy"/>
802 <property name="imgurlprefix" value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/>
803 <_taginfo type="mappaint" output="taginfo_style.json"/>
804 <_taginfo type="presets" output="taginfo_presets.json"/>
805 <_taginfo type="external_presets" output="taginfo_external_presets.json"/>
806 </target>
807
808 <target name="imageryindex" depends="init-properties">
809 <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${groovy.jar};${tools.dir}/commons-cli-1.3.1.jar"/>
810 <echo message="Checking editor imagery difference"/>
811 <groovy src="scripts/SyncEditorLayerIndex.groovy" classpath="${dist.jar}">
812 <arg value="-noeli"/>
813 <arg value="-p"/>
814 <arg value="imagery_eliout.imagery.xml"/>
815 <arg value="-q"/>
816 <arg value="imagery_josmout.imagery.xml"/>
817 </groovy>
818 </target>
819
820 <target name="imageryindexdownload">
821 <exec append="false" executable="wget" failifexecutionfails="true">
822 <arg value="https://josm.openstreetmap.de/maps"/>
823 <arg value="-O"/>
824 <arg value="imagery_josm.imagery.xml"/>
825 <arg value="--unlink"/>
826 </exec>
827 <exec append="false" executable="wget" failifexecutionfails="true">
828 <arg value="https://josm.openstreetmap.de/wiki/ImageryCompareIgnores?format=txt"/>
829 <arg value="-O"/>
830 <arg value="imagery_josm.ignores.txt"/>
831 <arg value="--unlink"/>
832 </exec>
833 <exec append="false" executable="wget" failifexecutionfails="true">
834 <arg value="https://raw.githubusercontent.com/osmlab/editor-layer-index/gh-pages/imagery.geojson"/>
835 <arg value="-O"/>
836 <arg value="imagery_eli.geojson"/>
837 <arg value="--unlink"/>
838 </exec>
839 <antcall target="imageryindex"/>
840 </target>
841
842 <target name="checkstyle-compile" depends="init-properties">
843 <mkdir dir="${checkstyle-build.dir}"/>
844 <javac sourcepath="" srcdir="${checkstyle.dir}/src" failonerror="true"
845 destdir="${checkstyle-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
846 includeantruntime="false" createMissingPackageInfoClass="false"
847 encoding="UTF-8" classpath="${checkstyle.dir}/checkstyle-all.jar">
848 </javac>
849 </target>
850 <target name="checkstyle-changed" depends="checkstyle-compile">
851 <exec append="false" osfamily="unix" executable="bash" failifexecutionfails="true">
852 <arg value="-c"/>
853 <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:'"/>
854 </exec>
855 <exec append="false" osfamily="windows" executable="powershell" failifexecutionfails="true">
856 <arg value="/c"/>
857 <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]}"/>
858 </exec>
859 </target>
860 <target name="checkstyle" depends="checkstyle-compile">
861 <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
862 classpath="${checkstyle.dir}/checkstyle-all.jar:${checkstyle-build.dir}"/>
863 <checkstyle config="${checkstyle.dir}/josm_checks.xml">
864 <fileset dir="${base.dir}/src/org/openstreetmap/josm" includes="**/*.java"
865 excludes="gui/mappaint/mapcss/parsergen/*.java"/>
866 <fileset dir="${base.dir}/test" includes="**/*.java"/>
867 <formatter type="plain"/>
868 <formatter type="xml" toFile="checkstyle-josm.xml"/>
869 </checkstyle>
870 </target>
871
872 <target name="spotbugs" depends="dist">
873 <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${spotbugs.dir}/spotbugs-ant.jar"/>
874 <path id="spotbugs-classpath">
875 <fileset dir="${spotbugs.dir}">
876 <include name="*.jar"/>
877 </fileset>
878 </path>
879 <property name="spotbugs-classpath" refid="spotbugs-classpath"/>
880 <spotbugs output="xml"
881 outputFile="spotbugs-josm.xml"
882 classpath="${spotbugs-classpath}"
883 pluginList=""
884 excludeFilter="${spotbugs.dir}/josm-filter.xml"
885 effort="max"
886 reportLevel="low"
887 >
888 <sourcePath path="${base.dir}/src" />
889 <class location="${dist.jar}" />
890 </spotbugs>
891 </target>
892
893 <target name="pmd" depends="init-properties">
894 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpath="${toString:pmd.classpath}"/>
895 <pmd shortFilenames="true" cacheLocation="${pmd.dir}/cache" encoding="UTF-8">
896 <sourceLanguage name="java" version="${java.lang.version}" />
897 <ruleset>${pmd.dir}/josm-ruleset.xml</ruleset>
898 <formatter type="text" toConsole="true" />
899 <formatter type="xml" toFile="pmd-josm.xml">
900 <param name="encoding" value="UTF-8" />
901 </formatter>
902 <fileset dir="${src.dir}">
903 <include name="org/openstreetmap/josm/**/*.java"/>
904 <exclude name="org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/*.java" />
905 </fileset>
906 </pmd>
907 </target>
908
909 <target name="run" depends="dist">
910 <java jar="${dist.jar}" fork="true">
911 <arg value="--set=expert=true"/>
912 <arg value="--set=remotecontrol.enabled=true"/>
913 <arg value="--set=debug.edt-checker.enable=false"/>
914 <jvmarg value="-Djosm.home=/tmp/.josm/"/>
915 </java>
916 </target>
917 <!--
918 ** Compile build script for generating projection list.
919 -->
920 <target name="epsg-compile" depends="init-properties">
921 <property name="proj-classpath" location="${build.dir}"/>
922 <mkdir dir="${proj-build.dir}"/>
923 <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="BuildProjectionDefinitions.java"
924 destdir="${proj-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
925 includeantruntime="false" createMissingPackageInfoClass="false"
926 encoding="UTF-8" classpath="${proj-classpath}">
927 </javac>
928 </target>
929 <!--
930 ** generate projection list.
931 -->
932 <target name="epsg" depends="epsg-compile">
933 <touch file="${epsg.output}" mkdirs="true"/>
934 <java classname="BuildProjectionDefinitions" failonerror="true" fork="true">
935 <sysproperty key="java.awt.headless" value="true"/>
936 <classpath>
937 <pathelement path="${base.dir}"/>
938 <pathelement path="${proj-classpath}"/>
939 <pathelement path="${proj-build.dir}"/>
940 </classpath>
941 <arg value="${base.dir}"/>
942 </java>
943 </target>
944</project>
Note: See TracBrowser for help on using the repository browser.