source: josm/trunk/build.xml@ 14049

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

see #16047 - update to Groovy 2.5.1 (includes update to ASM 6.2 for Java 11 compatibility)

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