source: josm/trunk/build.xml@ 14245

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

see #11924, see #15560, see #16047, see #16682 - fixes to make work animal_sniffer (OK) with Java 9+

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