source: josm/trunk/build.xml@ 13556

Last change on this file since 13556 was 13556, checked in by stoecker, 7 years ago

see #16123 - extend HTTPS test script to plugin/style/rule/preset

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