source: josm/trunk/build.xml@ 13722

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

see #16260, see #16311 - increase default memory options to 2GB

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