source: josm/trunk/build.xml@ 14136

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

see #15229 - add new ant target to generate jdeps dependencies graphs

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