source: josm/trunk/build.xml@ 15082

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

checkstyle/PMD

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