source: josm/trunk/build.xml@ 14116

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

see #15560, see #16047 - make error_prone work on Java 10/11. For details refer to:

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