source: josm/trunk/build.xml@ 14230

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

see #16498 - simplify build.xml and update to latest snapshot of error_prone, patched for Java 12 compatibility

See https://github.com/google/error-prone/pull/1107
See https://github.com/google/error-prone/commit/3f2ca43e53266e84e17e4fb3f34888be5cb29293#commitcomment-30382503

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