source: josm/trunk/build.xml@ 14613

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

tools update: awaitility 3.1.5, equalsverifier 3.1.2, jmockit 1.44, system-rules 1.19, wiremock 2.20, groovy 2.5.5, checkstyle 8.15, pmd 6.10, spotbugs 3.1.10

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