source: josm/trunk/build.xml@ 16873

Last change on this file since 16873 was 16659, checked in by simon04, 4 years ago

see #16567 - JUnit 5: set -Djunit.jupiter.extensions.autodetection.enabled=true to clear JMockit mocks (patch by taylor.smock)

  • Property svn:eol-style set to native
File size: 61.7 KB
RevLine 
[4166]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
[7133]7** This will create 'josm-custom.jar' in directory 'dist'. See also
[7183]8** https://josm.openstreetmap.de/wiki/DevelopersGuide/CreateBuild
[4166]9**
10-->
[15977]11<project name="josm" default="dist"
12 xmlns:as="antlib:org.codehaus.mojo.animal_sniffer"
13 xmlns:if="ant:if"
14 xmlns:ivy="antlib:org.apache.ivy.ant"
15 xmlns:jacoco="antlib:org.jacoco.ant"
16 xmlns:unless="ant:unless"
17>
18 <target name="init-ivy">
[16183]19 <property name="ivy.version" value="2.5.0"/>
[15977]20 <dirname property="base.dir" file="${ant.file.josm}"/>
21 <property name="lib.dir" location="${base.dir}/lib"/>
22 <property name="tools.dir" location="${base.dir}/tools"/>
[16168]23 <property name="tools.ivy" location="${tools.dir}/ivy.xml"/>
[16183]24 <property name="ivy.jar.dir" location="${tools.dir}/ivy"/>
25 <property name="ivy.jar.file" location="${ivy.jar.dir}/ivy-${ivy.version}.jar"/>
26 <mkdir dir="${ivy.jar.dir}"/>
27 <get src="https://josm.openstreetmap.de/nexus/content/repositories/public/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"
28 dest="${ivy.jar.file}"
29 skipexisting="true"
30 />
31 <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.jar.file}"/>
[15977]32 </target>
33 <target name="init-properties" depends="resolve">
[13641]34 <property environment="env"/>
[9765]35 <!-- Load properties in a target and not at top level, so this build file can be
36 imported from an IDE ant file (Netbeans) without messing up IDE properties.
37 When imported from another file, ${basedir} will point to the parent directory
38 of the importing ant file. Use ${base.dir} instead, which is always the parent
39 directory of this file. -->
40 <property name="test.dir" location="${base.dir}/test"/>
41 <property name="src.dir" location="${base.dir}/src"/>
[13819]42 <condition property="noJavaFX">
43 <or>
[13642]44 <isset property="env.JOSM_NOJAVAFX"/>
[13819]45 <not>
46 <available classname="javafx.scene.media.Media"/>
47 </not>
48 </or>
[13641]49 </condition>
[16341]50 <available property="svn.present" file="${base.dir}/.svn"/>
51 <available property="git.present" file="${base.dir}/.git"/>
[9765]52 <property name="build.dir" location="${base.dir}/build"/>
53 <property name="dist.dir" location="${base.dir}/dist"/>
[16140]54 <property name="resources.dir" location="${base.dir}/resources"/>
[14136]55 <property name="modules.dir" location="${dist.dir}/modules"/>
[13209]56 <property name="tools.dir" location="${base.dir}/tools"/>
57 <property name="pmd.dir" location="${tools.dir}/pmd"/>
58 <property name="checkstyle.dir" location="${tools.dir}/checkstyle"/>
59 <property name="spotbugs.dir" location="${tools.dir}/spotbugs"/>
60 <property name="javacc.home" location="${tools.dir}"/>
[9765]61 <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
62 <property name="proj-build.dir" location="${base.dir}/build2"/>
[15033]63 <property name="script-build.dir" location="${base.dir}/build2"/>
[12582]64 <property name="checkstyle-build.dir" location="${base.dir}/build2"/>
[16140]65 <property name="epsg.output" location="${resources.dir}/data/projection/custom-epsg"/>
[16231]66 <property name="commons-lang3.jar" location="${tools.dir}/commons-lang3.jar"/>
[12628]67 <property name="dist.jar" location="${dist.dir}/josm-custom.jar"/>
68 <property name="dist-optimized.jar" location="${dist.dir}/josm-custom-optimized.jar"/>
[16141]69 <property name="dist-sources.jar" location="${dist.dir}/josm-custom-sources.jar"/>
[12628]70 <property name="java.lang.version" value="1.8" />
[14052]71 <property name="test.headless" value="true" />
[13103]72 <property name="jacoco.includes" value="org.openstreetmap.josm.*" />
[13097]73 <property name="jacoco.inclbootstrapclasses" value="false" />
74 <property name="jacoco.inclnolocationclasses" value="false" />
[14309]75 <property name="junit.printsummary" value="on" />
[15032]76 <property name="default-junit-includes" value="**/*Test.class"/>
77 <property name="default-junitIT-includes" value="**/*TestIT.class"/>
[9765]78 <!-- build parameter: compression level (ant -Dclevel=N)
79 N ranges from 0 (no compression) to 9 (maximum compression)
80 default: 9 -->
81 <condition property="clevel" value="${clevel}" else="9">
82 <isset property="clevel"/>
83 </condition>
[14172]84 <!-- For Java specific stuff by version -->
85 <condition property="isJava9"><matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" /></condition>
86 <condition property="isJava10"><matches string="${ant.java.version}" pattern="1[0-9]" /></condition>
87 <condition property="isJava11"><matches string="${ant.java.version}" pattern="1[1-9]" /></condition>
88 <condition property="isJava12"><matches string="${ant.java.version}" pattern="1[2-9]" /></condition>
89 <condition property="isJava13"><matches string="${ant.java.version}" pattern="1[3-9]" /></condition>
[16156]90 <condition property="isJava16"><matches string="${ant.java.version}" pattern="1[6-9]" /></condition>
91 <!-- Disable jacoco on Java 16+, see https://github.com/jacoco/jacoco/pull/992 -->
[13523]92 <condition property="coverageByDefault">
93 <not>
[16156]94 <isset property="isJava16"/>
[13523]95 </not>
96 </condition>
[14244]97 <condition property="java.library.dir" value="jmods" else="lib">
98 <isset property="isJava9"/>
99 </condition>
[9765]100 </target>
[4166]101 <!--
[6540]102 ** Initializes the REVISION.XML file from SVN information
[6133]103 -->
[16341]104 <target name="init-svn-revision-xml" if="svn.present" depends="init-properties">
105 <exec append="false" output="${base.dir}/REVISION.XML" executable="svn" dir="${base.dir}" resultproperty="svn.info.result">
[4166]106 <env key="LANG" value="C"/>
107 <arg value="info"/>
108 <arg value="--xml"/>
109 <arg value="."/>
110 </exec>
[6540]111 </target>
112 <!--
113 ** Initializes the REVISION.XML file from git information
114 -->
[16341]115 <target name="init-git-revision-xml" if="git.present" depends="init-properties">
116 <exec append="false" output="${base.dir}/REVISION.XML" executable="git" dir="${base.dir}">
[6540]117 <arg value="log"/>
118 <arg value="-1"/>
119 <arg value="--grep=git-svn-id"/>
[6545]120 <!--
121 %B: raw body (unwrapped subject and body)
122 %n: new line
123 %ai: author date, ISO 8601 format
124 -->
125 <arg value="--pretty=format:%B%n%ai"/>
[6540]126 <arg value="HEAD"/>
127 </exec>
[9765]128 <replaceregexp file="${base.dir}/REVISION.XML" flags="s"
[6545]129 match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
130 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;"/>
[6540]131 </target>
132 <!--
133 ** Creates the REVISION file to be included in the distribution
134 -->
[9765]135 <target name="create-revision" depends="init-properties,init-svn-revision-xml,init-git-revision-xml">
136 <xmlproperty file="${base.dir}/REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
137 <delete file="${base.dir}/REVISION.XML"/>
[4166]138 <tstamp>
139 <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
140 </tstamp>
141 <property name="version.entry.commit.revision" value="UNKNOWN"/>
[6540]142 <property name="version.entry.commit.date" value="UNKNOWN"/>
[5362]143 <!-- add Build-Name: ... when making special builds, e.g. DEBIAN -->
[16349]144 <echo file="${resources.dir}/REVISION">
[4166]145# automatically generated by JOSM build.xml - do not edit
146Revision: ${version.entry.commit.revision}
147Is-Local-Build: true
148Build-Date: ${build.tstamp}
149</echo>
150 </target>
[6540]151 <!--
152 ** Check internal XML files against their XSD
153 -->
[9765]154 <target name="check-schemas" unless="check-schemas.notRequired" depends="init-properties">
[16140]155 <schemavalidate file="${resources.dir}/data/defaultpresets.xml" >
156 <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="${resources.dir}/data/tagging-preset.xsd" />
[6208]157 </schemavalidate>
158 </target>
[6540]159 <!--
160 ** Main target that builds JOSM and checks XML against schemas
161 -->
[16349]162 <target name="dist" depends="compile,extract-libraries,epsg,copy-resources,check-schemas">
[4166]163 <echo>Revision ${version.entry.commit.revision}</echo>
[12648]164 <copy file="CONTRIBUTION" todir="${build.dir}"/>
165 <copy file="README" todir="${build.dir}"/>
166 <copy file="LICENSE" todir="${build.dir}"/>
[4166]167 <!-- create josm-custom.jar -->
[12628]168 <delete file="${dist.jar}"/>
169 <jar destfile="${dist.jar}" basedir="${build.dir}" level="${clevel}">
[4166]170 <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
171 <manifest>
[11926]172 <attribute name="Main-class" value="org.openstreetmap.josm.gui.MainApplication"/>
[4166]173 <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
174 <attribute name="Main-Date" value="${version.entry.commit.date}"/>
[6341]175 <attribute name="Permissions" value="all-permissions"/>
176 <attribute name="Codebase" value="josm.openstreetmap.de"/>
177 <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
[12205]178 <!-- Java 9 stuff. Entries are safely ignored by Java 8 -->
[15469]179 <attribute name="Add-Exports" value="java.desktop/com.apple.eawt java.desktop/com.sun.imageio.spi java.desktop/com.sun.imageio.plugins.jpeg javafx.graphics/com.sun.javafx.application jdk.deploy/com.sun.deploy.config" />
[12932]180 <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" />
[4166]181 </manifest>
182 </jar>
183 </target>
[7001]184 <!-- Mac OS X target -->
[9765]185 <target name="mac" depends="init-properties">
[6217]186 <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
[14793]187 <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="${tools.dir}/appbundler.jar"/>
[6217]188 <!-- create MacOS X application bundle -->
[6945]189 <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
[6216]190 mainclassname="org.openstreetmap.josm.gui.MainApplication"
[6217]191 copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
[6216]192 applicationCategory="public.app-category.utilities"
193 shortversion="${version.entry.commit.revision} SVN"
194 version="${version.entry.commit.revision} SVN"
[16007]195 icon="native/macosx/JOSM.app/Contents/Resources/JOSM.icns"
[6217]196 highResolutionCapable="true">
[6216]197
198 <arch name="x86_64"/>
199 <arch name="i386"/>
200
[6945]201 <classpath file="${bundle.jar}"/>
[6216]202
[13722]203 <option value="-Xmx2048m"/>
[6216]204
205 <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
206 <option value="-Xdock:name=JOSM"/>
207
208 <!-- OSX specific options, optional -->
209 <option value="-Dapple.laf.useScreenMenuBar=true"/>
210 <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
211 <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
212 <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
213 <option value="-Dcom.apple.smallTabs=true"/>
214 </bundleapp>
[9765]215
[6217]216 <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
[13209]217 <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="${tools.dir}/xmltask.jar"/>
[9765]218
[6945]219 <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
[7367]220 <!-- remove empty CFBundleDocumentTypes definition -->
221 <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/>
[7287]222 <!-- insert our own keys -->
[16007]223 <insert position="before" path="/plist/dict/key[1]" file="native/macosx/JOSM.app/Contents/Info.plist_template.xml" />
[6217]224 </xmltask>
[9765]225
[6216]226 <!-- create ZIP file with MacOS X application bundle -->
[7001]227 <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
[6945]228 <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
229 <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
[6216]230 </zip>
[6217]231 </target>
[7001]232 <target name="distmac" depends="dist">
233 <antcall target="mac">
[9765]234 <param name="bundle.outdir" value="${dist.dir}"/>
[12628]235 <param name="bundle.jar" value="${dist.jar}"/>
[6945]236 </antcall>
237 </target>
[7839]238 <!-- Windows target -->
239 <target name="distwin" depends="dist">
[16007]240 <exec dir="native/windows" executable="./josm-setup-unix.sh">
[7839]241 <arg value="${version.entry.commit.revision}"/>
[12628]242 <arg value="${dist.jar}"/>
[7839]243 </exec>
244 </target>
[5392]245 <target name="javacc" depends="init" unless="javacc.notRequired">
[16243]246 <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="javacc.classpath" conf="javacc"/>
[4252]247 <mkdir dir="${mapcss.dir}/parsergen"/>
[11676]248 <java classname="javacc" fork="true" failonerror="true">
[16168]249 <classpath refid="javacc.classpath"/>
[7043]250 <arg value="-DEBUG_PARSER=false"/>
251 <arg value="-DEBUG_TOKEN_MANAGER=false"/>
[12628]252 <arg value="-JDK_VERSION=${java.lang.version}"/>
[6446]253 <arg value="-GRAMMAR_ENCODING=UTF-8"/>
[4257]254 <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
255 <arg value="${mapcss.dir}/MapCSSParser.jj"/>
[11676]256 </java>
[4252]257 </target>
[16036]258 <target name="compile-cots" depends="init" description="Compiles third-party dependencies not retrieved with Ivy">
[7068]259 <!-- COTS -->
[16537]260 <javac srcdir="${src.dir}" includes="com/kitfox/**" excludes="**/package-info.java" nowarn="on" encoding="iso-8859-1"
[16346]261 destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeAntRuntime="false">
[7019]262 <!-- get rid of "internal proprietary API" warning -->
[7068]263 <compilerarg value="-XDignore.symbol.file"/>
[16050]264 <classpath>
265 <path refid="runtime.path"/>
266 </classpath>
[7019]267 </javac>
[12648]268 </target>
[16194]269 <target name="compile" depends="init,javacc,compile-cots" unless="compile.notRequired" description="Compiles JOSM">
[16556]270 <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="errorprone.classpath" conf="errorprone"/>
[16571]271 <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="errorprone_javac.classpath" conf="errorprone_javac"/>
[8526]272 <!-- JOSM -->
[14222]273 <javac sourcepath="" srcdir="${src.dir}" fork="yes"
[16556]274 excludes="com/**,org/apache/commons/**,**/package-info.java"
[16346]275 destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" encoding="UTF-8">
[16571]276 <compilerarg value="-J-Xbootclasspath/p:${toString:errorprone_javac.classpath}" unless:set="isJava9"/>
[14222]277 <compilerarg line="-XDcompilePolicy=simple"/>
278 <compilerarg value="-processorpath"/>
[16556]279 <compilerarg pathref="errorprone.classpath"/>
[8526]280 <compilerarg value="-Xlint:cast"/>
281 <compilerarg value="-Xlint:deprecation"/>
282 <compilerarg value="-Xlint:dep-ann"/>
283 <compilerarg value="-Xlint:divzero"/>
284 <compilerarg value="-Xlint:empty"/>
285 <compilerarg value="-Xlint:finally"/>
286 <compilerarg value="-Xlint:overrides"/>
287 <!--<compilerarg value="-Xlint:rawtypes"/>-->
288 <compilerarg value="-Xlint:static"/>
289 <compilerarg value="-Xlint:try"/>
290 <compilerarg value="-Xlint:unchecked"/>
291 <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
292 <compilerarg value="-XDignore.symbol.file"/>
[16643]293 <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:JdkObsolete:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF"/>
[10659]294 <compilerarg line="-Xmaxwarns 1000"/>
[15977]295 <classpath>
296 <path refid="runtime.path"/>
297 </classpath>
[8526]298 </javac>
[16036]299 </target>
[16349]300 <target name="create-resources" depends="create-revision" description="Create generated resource files">
301 <copy todir="${resources.dir}">
302 <file file="CONTRIBUTION"/>
303 <file file="README"/>
304 <file file="LICENSE"/>
305 </copy>
306 </target>
307 <target name="copy-resources" depends="create-resources" description="Copy resource files to build directory">
[6756]308 <copy todir="build" failonerror="no" includeemptydirs="no">
[16140]309 <fileset dir="${resources.dir}"/>
[6756]310 </copy>
[4166]311 </target>
[9765]312 <target name="init" depends="init-properties">
[5392]313 <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
314 <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
315 </uptodate>
[16345]316 <uptodate property="epsg.notRequired" targetfile="${epsg.output}">
317 <srcfiles file="${base.dir}/scripts/BuildProjectionDefinitions.java"/>
318 <srcfiles dir="nodist/data/projection"/>
319 </uptodate>
[9765]320 <mkdir dir="${build.dir}"/>
321 <mkdir dir="${dist.dir}"/>
[4166]322 </target>
[9765]323 <target name="javadoc" depends="init-properties">
324 <javadoc destdir="javadoc"
[7133]325 sourcepath="${src.dir}"
[15992]326 classpathref="compile.path"
[9765]327 encoding="UTF-8"
[16194]328 packagenames="org.openstreetmap.josm.*"
[9250]329 excludepackagenames="org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.*"
[5263]330 windowtitle="JOSM"
331 use="true"
[5481]332 private="true"
[5263]333 linksource="true"
334 author="false">
[15106]335 <link href="https://docs.oracle.com/javase/8/docs/api" unless:set="isJava11" />
336 <link href="https://docs.oracle.com/en/java/javase/11/docs/api" if:set="isJava11" />
[16348]337 <doctitle><![CDATA[<h2>
338 <img src="https://josm.openstreetmap.de/svn/trunk/nodist/images/logo/header.png" style="vertical-align: middle;" alt="JOSM">
339 &mdash; Javadoc
340 </h2>]]></doctitle>
[6955]341 <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
[15243]342 <!-- Disable HTML checking until we switch to Java13+, see https://bugs.openjdk.java.net/browse/JDK-8223552 -->
343 <arg value="-Xdoclint:-html" if:set="isJava13" />
[13494]344 <arg value="-html5" if:set="isJava9" />
[13820]345 <arg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
346 <arg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
[5263]347 </javadoc>
348 </target>
[9765]349 <target name="clean" depends="init-properties">
350 <delete dir="${build.dir}"/>
351 <delete dir="${proj-build.dir}"/>
[15033]352 <delete dir="${script-build.dir}"/>
[12582]353 <delete dir="${checkstyle-build.dir}"/>
[9765]354 <delete dir="${dist.dir}"/>
[4252]355 <delete dir="${mapcss.dir}/parsergen"/>
[8535]356 <delete file="${src.dir}/org/w3/_2001/xmlschema/Adapter1.java"/>
357 <delete dir="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
[9133]358 <delete file="${epsg.output}"/>
[13209]359 <delete file="${pmd.dir}/cache"/>
[4166]360 </target>
[7068]361 <macrodef name="init-test-preferences">
362 <attribute name="testfamily"/>
363 <sequential>
364 <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
365 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
366 <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
367 </sequential>
368 </macrodef>
[9765]369 <target name="test-init" depends="init-properties">
[6121]370 <mkdir dir="${test.dir}/build"/>
[7068]371 <mkdir dir="${test.dir}/build/unit"/>
372 <mkdir dir="${test.dir}/build/functional"/>
373 <mkdir dir="${test.dir}/build/performance"/>
[4166]374 <mkdir dir="${test.dir}/report"/>
[7068]375 <init-test-preferences testfamily="unit"/>
376 <init-test-preferences testfamily="functional"/>
377 <init-test-preferences testfamily="performance"/>
[16229]378 <path id="test.classpath">
379 <path refid="test.path"/>
380 <pathelement path="${build.dir}"/>
381 <pathelement path="${resources.dir}"/>
382 </path>
[16243]383 <ivy:retrieve log="download-only" pattern="${test.dir}/lib/[artifact].[ext]" conf="jmockit"/>
384 <ivy:retrieve log="download-only" pattern="${tools.dir}/[artifact].[ext]" conf="commonslang"/>
385 <ivy:retrieve log="download-only" pattern="${tools.dir}/[conf].[ext]" conf="jacocoant"/>
[13209]386 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${tools.dir}/jacocoant.jar" />
[4166]387 </target>
[9765]388 <target name="test-clean" depends="init-properties">
[6121]389 <delete dir="${test.dir}/build"/>
[4166]390 <delete dir="${test.dir}/report"/>
[6133]391 <delete file="${test.dir}/jacoco.exec" />
[9501]392 <delete file="${test.dir}/jacocoIT.exec" />
[10850]393 <delete file="${test.dir}/config/unit-josm.home" failonerror="false"/>
394 <delete file="${test.dir}/config/functional-josm.home" failonerror="false"/>
395 <delete file="${test.dir}/config/performance-josm.home" failonerror="false"/>
[4166]396 </target>
[14065]397 <macrodef name="call-javac">
[7068]398 <attribute name="testfamily"/>
399 <element name="cp-elements"/>
400 <sequential>
[14065]401 <javac srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}"
402 target="${java.lang.version}" source="${java.lang.version}" debug="on"
[16346]403 includeantruntime="false" encoding="UTF-8">
[14065]404 <compilerarg value="-Xlint:all"/>
[16603]405 <compilerarg value="-Xlint:-path"/><!-- Suppress "bad path element .../xmpcore-6.0.6.jar: no such file or directory" warning, see https://github.com/drewnoakes/metadata-extractor/pull/483 -->
[14065]406 <compilerarg value="-Xlint:-serial"/>
[7068]407 <classpath>
408 <cp-elements/>
409 </classpath>
[14065]410 </javac>
[7068]411 </sequential>
412 </macrodef>
[16036]413 <target name="test-compile" depends="test-init,compile,extract-libraries,epsg,copy-resources" description="Compiles all tests">
[14065]414 <call-javac testfamily="unit">
[7068]415 <cp-elements>
416 <path refid="test.classpath"/>
417 </cp-elements>
[14065]418 </call-javac>
419 <call-javac testfamily="functional">
[7068]420 <cp-elements>
421 <path refid="test.classpath"/>
422 <pathelement path="${test.dir}/build/unit"/>
423 </cp-elements>
[14065]424 </call-javac>
425 <call-javac testfamily="performance">
[7068]426 <cp-elements>
427 <path refid="test.classpath"/>
428 <pathelement path="${test.dir}/build/unit"/>
429 </cp-elements>
[14065]430 </call-javac>
[4166]431 </target>
[7068]432 <macrodef name="call-junit">
433 <attribute name="testfamily"/>
[9501]434 <attribute name="testITsuffix" default=""/>
[13523]435 <attribute name="coverage" default="${coverageByDefault}"/>
[15032]436 <attribute name="includes" default="${default-junit@{testITsuffix}-includes}"/>
437 <attribute name="excludes" default="${default-junit@{testITsuffix}-excludes}"/>
[7068]438 <sequential>
[9501]439 <echo message="Running @{testfamily}@{testITsuffix} tests with JUnit"/>
[16617]440 <jacoco:agent destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}" dumponexit="true"
441 inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}" property="jacocoagent@{testfamily}@{testITsuffix}" if:true="@{coverage}"/>
442 <junitlauncher printsummary="${junit.printsummary}" failureproperty="test.@{testfamily}@{testITsuffix}.failed">
443 <classpath>
444 <path refid="test.classpath"/>
445 <pathelement path="${test.dir}/build/unit"/> <!-- required for functional/etc to have JOSMTestRules -->
446 <pathelement path="${test.dir}/build/@{testfamily}"/>
447 </classpath>
448 <testclasses outputDir="${test.dir}/report">
449 <fileset dir="${test.dir}/build/@{testfamily}" includes="@{includes}" excludes="@{excludes}"/>
450 <fork>
451 <jvmarg value="${jacocoagent@{testfamily}@{testITsuffix}}" if:set="jacocoagent@{testfamily}@{testITsuffix}" />
452 <jvmarg value="-Dfile.encoding=UTF-8"/>
453 <jvmarg value="-javaagent:${test.dir}/lib/jmockit.jar"/>
[16659]454 <jvmarg value="-Djunit.jupiter.extensions.autodetection.enabled=true"/>
[16617]455 <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
456 <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
457 <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
458 <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
459 <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
460 <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
461 <jvmarg value="--add-opens" if:set="isJava9" />
462 <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
463 <jvmarg value="--add-opens" if:set="isJava9" />
464 <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
465 <jvmarg value="--add-opens" if:set="isJava9" />
466 <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
467 <jvmarg value="--add-opens" if:set="isJava9" />
468 <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
469 <jvmarg value="--add-opens" if:set="isJava9" />
470 <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
471 <jvmarg value="--add-opens" if:set="isJava9" />
472 <jvmarg value="java.base/jdk.internal.loader=ALL-UNNAMED" if:set="isJava9" />
473 <jvmarg value="--add-opens" if:set="isJava9" />
474 <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
475 <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
476 <sysproperty key="josm.test.data" value="${test.dir}/data"/>
477 <sysproperty key="java.awt.headless" value="${test.headless}"/>
478 <sysproperty key="glass.platform" value="Monocle"/>
479 <sysproperty key="monocle.platform" value="Headless"/>
480 <sysproperty key="prism.order" value="sw"/>
481 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
482 </fork>
483 <listener type="legacy-plain" />
484 <listener type="legacy-xml" />
485 </testclasses>
486 </junitlauncher>
[7068]487 </sequential>
488 </macrodef>
[9501]489 <target name="test" depends="test-compile" unless="test.notRequired"
[12534]490 description="Run unit and functional tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
[7068]491 <call-junit testfamily="unit"/>
492 <call-junit testfamily="functional"/>
[4166]493 </target>
[14141]494 <target name="test-hardfail" depends="test" description="Run 'test' target but abort if tests failed">
495 <fail message="'test' failed">
496 <condition>
497 <or>
498 <isset property="test.unit.failed"/>
499 <isset property="test.functional.failed"/>
500 </or>
501 </condition>
502 </fail>
503 </target>
504 <target name="test-unit" depends="test-compile" unless="test-unit.notRequired"
505 description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
506 <call-junit testfamily="unit"/>
507 </target>
508 <target name="test-unit-hardfail" depends="test-unit" description="Run 'test-unit' target but abort if tests failed">
509 <fail message="'test-unit' failed" if="test.unit.failed"/>
510 </target>
[16051]511 <target name="test-it" depends="test-compile,create-revision" unless="test-it.notRequired"
[9501]512 description="Run integration tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
513 <call-junit testfamily="unit" testITsuffix="IT"/>
514 <call-junit testfamily="functional" testITsuffix="IT"/>
515 </target>
[14141]516 <target name="test-it-hardfail" depends="test-it" description="Run 'test-it' target but abort if tests failed">
517 <fail message="'test-it' failed">
518 <condition>
519 <or>
520 <isset property="test.unitIT.failed"/>
521 <isset property="test.functionalIT.failed"/>
522 </or>
523 </condition>
524 </fail>
525 </target>
[12534]526 <target name="test-perf" depends="test-compile" unless="test-perf.notRequired"
527 description="Run performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
528 <call-junit testfamily="performance" coverage="false"/>
529 </target>
[14141]530 <target name="test-perf-hardfail" depends="test-perf" description="Run 'test-perf' target but abort if tests failed">
531 <fail message="'test-perf' failed" if="test.performance.failed"/>
532 </target>
[15703]533 <target name="test-html" depends="test, test-it, test-perf" description="Generate HTML, CSV and XML test reports">
[4166]534 <!-- May require additional ant dependencies like ant-trax package -->
535 <junitreport todir="${test.dir}/report">
536 <fileset dir="${test.dir}/report">
537 <include name="TEST-*.xml"/>
538 </fileset>
539 <report todir="${test.dir}/report/html"/>
540 </junitreport>
[6133]541 <jacoco:report>
542 <executiondata>
[11963]543 <fileset dir="${test.dir}" includes="*.exec"/>
[6133]544 </executiondata>
545 <structure name="JOSM Test Coverage">
546 <classfiles>
547 <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
548 </classfiles>
549 <sourcefiles encoding="UTF-8">
550 <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
551 </sourcefiles>
552 </structure>
[6134]553 <html destdir="${test.dir}/report/jacoco"/>
[15703]554 <xml destfile="${test.dir}/report/jacoco.xml"/>
555 <csv destfile="${test.dir}/report/jacoco.csv"/>
[6133]556 </jacoco:report>
[4166]557 </target>
[16170]558 <target name="dist-optimized" depends="dist" unless="isJava13">
[16243]559 <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="proguard.classpath" conf="proguard"/>
[16169]560 <taskdef resource="proguard/ant/task.properties" classpathref="proguard.classpath"/>
[4166]561 <proguard>
[12628]562 -injars ${dist.jar}
563 -outjars ${dist-optimized.jar}
[4166]564
[14244]565 -libraryjars ${java.home}/${java.library.dir}
[4166]566
[7367]567 -dontoptimize
568 -dontobfuscate
[16116]569 -dontwarn org.jetbrains.annotations.**
[4166]570
[7367]571 # These options probably are not necessary (and make processing a bit slower)
572 -dontskipnonpubliclibraryclasses
573 -dontskipnonpubliclibraryclassmembers
[4166]574
[7367]575 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
576 public static void main(java.lang.String[]);
577 }
[4166]578
[7367]579 -keep class * extends org.openstreetmap.josm.io.FileImporter
580 -keep class * extends org.openstreetmap.josm.io.FileExporter
581 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
[10949]582 -keep class org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory$PseudoClasses {
[8532]583 static boolean *(org.openstreetmap.josm.gui.mappaint.Environment);
584 }
[4166]585
[7367]586 -keepclassmembers enum * {
587 public static **[] values();
588 public static ** valueOf(java.lang.String);
589 }
[4166]590
[12873]591 # Keep unused public classes and methods (needed for plugins)
592 -keep public class * {
[7367]593 public protected *;
594 }
[4838]595
[12873]596 # Keep serialization code
[10949]597 -keepclassmembers class * implements java.io.Serializable {
[16617]598 static final long serialVersionUID;
[12873]599 private static final java.io.ObjectStreamField[] serialPersistentFields;
[10949]600 private void writeObject(java.io.ObjectOutputStream);
601 private void readObject(java.io.ObjectInputStream);
[16617]602 java.lang.Object writeReplace();
[12873]603 java.lang.Object readResolve();
[10949]604 }
605
[7367]606 # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
607 # This note should not be a problem as we don't use obfuscation
608 -dontnote
[6133]609 </proguard>
[4166]610 </target>
[14244]611 <target name="dist-optimized-report" depends="dist-optimized">
[10845]612 <!-- generate difference report between optimized jar and normal one -->
613 <exec executable="perl" dir="${basedir}">
[13209]614 <arg value="${tools.dir}/japicc/japi-compliance-checker.pl"/>
[10845]615 <arg value="--lib=JOSM"/>
616 <arg value="--keep-internal"/>
617 <arg value="--v1=${version.entry.commit.revision}"/>
618 <arg value="--v2=${version.entry.commit.revision}-optimized"/>
619 <arg value="--report-path=${dist.dir}/compat_report.html"/>
[12628]620 <arg value="${dist.jar}"/>
621 <arg value="${dist-optimized.jar}"/>
[10845]622 </exec>
623 </target>
[14258]624 <target name="check-plugins" depends="dist-optimized" description="Check of plugins binary compatibility" unless="isJava11">
[4166]625 <local name="dir"/>
626 <local name="plugins"/>
627 <property name="dir" value="plugin-check"/>
628 <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
[13209]629 <classpath path="${tools.dir}/animal-sniffer-ant-tasks.jar"/>
[4166]630 </typedef>
[13574]631 <delete dir="${dir}" failonerror="false"/>
[4166]632 <mkdir dir="${dir}"/>
633 <!-- List of deprecated plugins -->
[7133]634 <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
[4166]635 <filterchain>
636 <linecontains>
637 <contains value="new DeprecatedPlugin("/>
638 </linecontains>
639 <tokenfilter>
640 <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
641 </tokenfilter>
642 <striplinebreaks/>
643 <tokenfilter>
644 <replaceregex pattern="\|$" replace="" flags="gi"/>
645 </tokenfilter>
646 </filterchain>
647 </loadfile>
[5498]648 <!-- Download list of plugins -->
[4166]649 <loadresource property="plugins">
[6955]650 <url url="https://josm.openstreetmap.de/plugin"/>
[4166]651 <filterchain>
652 <linecontainsregexp negate="true">
653 <regexp pattern="^\t.*"/>
654 </linecontainsregexp>
655 <linecontainsregexp negate="true">
656 <regexp pattern="${deprecated-plugins}"/>
657 </linecontainsregexp>
[14244]658 <linecontainsregexp negate="true" unless:set="isJava10">
[14383]659 <!-- Skip javafx on Java 8/9, built for Java 10+ only -->
660 <regexp pattern="javafx.*"/>
[14244]661 </linecontainsregexp>
[15234]662 <linecontainsregexp negate="true" unless:set="isJava11">
663 <!-- Skip http2 on Java 8/9/10, built for Java 11+ only -->
664 <regexp pattern="http2.*"/>
665 </linecontainsregexp>
[4166]666 <tokenfilter>
667 <replaceregex pattern="^.*;" replace="" flags="gi"/>
668 </tokenfilter>
669 </filterchain>
[6133]670 </loadresource>
671 <!-- Delete files that are not in plugin list (like old plugins) -->
672 <loadresource property="file-list">
673 <propertyresource name="plugins"/>
674 <filterchain>
675 <tokenfilter>
676 <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
677 </tokenfilter>
678 <striplinebreaks/>
679 <tokenfilter>
680 <replaceregex pattern="\|$" replace="" flags="gi"/>
[9765]681 </tokenfilter>
[6133]682 </filterchain>
683 </loadresource>
684 <delete>
685 <restrict>
686 <fileset dir="${dir}"/>
687 <not>
688 <name regex="${file-list}"/>
689 </not>
690 </restrict>
691 </delete>
692 <!-- Download plugins -->
[12874]693 <copy todir="${dir}" flatten="true" verbose="true" failonerror="false">
[4166]694 <resourcelist>
695 <string value="${plugins}"/>
696 </resourcelist>
697 </copy>
698 <!-- Check plugins -->
[5498]699 <as:build-signatures destfile="${dir}/api.sig">
700 <path>
[12628]701 <fileset file="${dist-optimized.jar}"/>
[14244]702 <fileset file="${java.home}/lib/rt.jar" unless:set="isJava9"/>
703 <fileset file="${java.home}/lib/jce.jar" unless:set="isJava9"/>
704 <fileset file="${java.home}/lib/ext/jfxrt.jar" unless:set="isJava9"/>
705 <fileset dir="${java.home}/jmods" if:set="isJava9"/>
[14997]706 <fileset dir="/usr/share/openjfx/lib" unless:set="isJava9"/>
[5498]707 </path>
[6133]708 </as:build-signatures>
[12873]709 <as:check-signature signature="${dir}/api.sig" failonerror="false">
[13711]710 <ignore classname="afu.*"/>
[13921]711 <ignore classname="android.*"/>
[12873]712 <ignore classname="au.*"/>
[7367]713 <ignore classname="com.*"/>
[12873]714 <ignore classname="de.*"/>
715 <ignore classname="edu.*"/>
716 <ignore classname="groovy.*"/>
[13962]717 <ignore classname="io.*"/>
[12873]718 <ignore classname="it.*"/>
[14167]719 <ignore classname="java.lang.invoke.MethodHandle"/>
[15639]720 <ignore classname="java.nio.ByteBuffer"/>
721 <ignore classname="java.nio.FloatBuffer"/>
[15387]722 <ignore classname="java.util.list.kotlin.*"/>
[7367]723 <ignore classname="javax.*"/>
[14245]724 <ignore classname="jdk.swing.interop.*"/>
[7367]725 <ignore classname="jogamp.*"/>
726 <ignore classname="junit.*"/>
[12873]727 <ignore classname="kdu_jni.*"/>
[15387]728 <ignore classname="kotlin.*"/>
[12873]729 <ignore classname="net.*"/>
730 <ignore classname="netscape.*"/>
731 <ignore classname="nu.*"/>
732 <ignore classname="oracle.*"/>
[7367]733 <ignore classname="org.apache.*"/>
[12873]734 <ignore classname="org.bouncycastle.*"/>
[13711]735 <ignore classname="org.checkerframework.*"/>
[7367]736 <ignore classname="org.codehaus.*"/>
[13921]737 <ignore classname="org.conscrypt.*"/>
[7367]738 <ignore classname="org.dom4j.*"/>
[12873]739 <ignore classname="org.eclipse.*"/>
740 <ignore classname="org.ejml.*"/>
[14164]741 <ignore classname="org.fusesource.*"/>
[12873]742 <ignore classname="org.gdal.*"/>
[15377]743 <ignore classname="org.geotools.data.h2.*"/>
744 <ignore classname="org.geotools.gce.imagemosaic.*"/>
[12873]745 <ignore classname="org.hibernate.*"/>
[7367]746 <ignore classname="org.hsqldb.*"/>
747 <ignore classname="org.ibex.*"/>
[7934]748 <ignore classname="org.iso_relax.*"/>
[7367]749 <ignore classname="org.jaitools.*"/>
750 <ignore classname="org.jaxen.*"/>
[12873]751 <ignore classname="org.jboss.*"/>
[14164]752 <ignore classname="org.jctools.*"/>
[13575]753 <ignore classname="org.jdom.*"/>
[7367]754 <ignore classname="org.jdom2.*"/>
[12873]755 <ignore classname="org.jfree.*"/>
[4166]756 <ignore classname="org.jgraph.*"/>
[12873]757 <ignore classname="org.joda.*"/>
[14164]758 <ignore classname="org.json.*"/>
[12873]759 <ignore classname="org.junit.*"/>
760 <ignore classname="org.jvnet.*"/>
[7367]761 <ignore classname="org.kxml2.*"/>
[15639]762 <ignore classname="org.locationtech.*"/>
[15462]763 <ignore classname="org.mozilla.*"/>
[8090]764 <ignore classname="org.objectweb.*"/>
[15387]765 <ignore classname="org.opentest4j.*"/>
[12873]766 <ignore classname="org.osgi.*"/>
767 <ignore classname="org.postgresql.*"/>
[7367]768 <ignore classname="org.python.*"/>
[12875]769 <ignore classname="org.seasar.*"/>
[7367]770 <ignore classname="org.slf4j.*"/>
[12873]771 <ignore classname="org.springframework.*"/>
772 <ignore classname="org.testng.*"/>
[13113]773 <ignore classname="org.w3c.*"/>
[12873]774 <ignore classname="org.zeromq.*"/>
[15540]775 <ignore classname="waffle.*"/>
[8173]776 <!-- plugins used by another ones -->
[7494]777 <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
[14244]778 <ignore classname="org.openstreetmap.josm.plugins.jaxb.*"/>
[7934]779 <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
[7494]780 <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
781 <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
[14244]782 <ignore classname="org.openstreetmap.josm.plugins.openjfx.*"/>
[7494]783 <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
[12875]784 <ignore classname="sun.*"/>
[4166]785 <path path="${dir}"/>
786 </as:check-signature>
787 </target>
[4838]788
[16036]789 <target name="script-compile" depends="test-compile" description="Compiles all scripts">
[15033]790 <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="*.java"
791 destdir="${script-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
[16346]792 includeantruntime="false" encoding="UTF-8">
[15033]793 <classpath>
794 <pathelement path="${build.dir}"/>
795 <pathelement path="${test.dir}/build/unit"/>
796 <pathelement path="${commons-lang3.jar}"/>
797 </classpath>
[14636]798 </javac>
799 </target>
800
[8687]801 <macrodef name="_taginfo">
802 <attribute name="type"/>
803 <attribute name="output"/>
804 <sequential>
805 <echo message="Generating Taginfo for type @{type} to @{output}"/>
[14636]806 <java classname="TagInfoExtract" failonerror="true" fork="false">
807 <sysproperty key="java.awt.headless" value="true"/>
808 <classpath>
[16126]809 <pathelement path="${build.dir}"/>
[15033]810 <pathelement path="${script-build.dir}"/>
811 <pathelement path="${commons-lang3.jar}"/>
[14636]812 </classpath>
813 <arg value="--type"/>
[8687]814 <arg value="@{type}"/>
815 <arg value="--noexit"/>
816 <arg value="--imgurlprefix"/>
[14636]817 <arg value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/>
818 <arg value="--output"/>
[8687]819 <arg value="@{output}"/>
[14636]820 </java>
[8687]821 </sequential>
822 </macrodef>
823
[15033]824 <target name="taginfo" depends="script-compile">
[9250]825 <_taginfo type="mappaint" output="taginfo_style.json"/>
826 <_taginfo type="presets" output="taginfo_presets.json"/>
827 <_taginfo type="external_presets" output="taginfo_external_presets.json"/>
[8687]828 </target>
829
[15033]830 <target name="imageryindex" depends="init-properties,script-compile">
[9505]831 <echo message="Checking editor imagery difference"/>
[15033]832 <java classname="SyncEditorLayerIndex" failonerror="true" fork="false">
833 <classpath>
[16126]834 <pathelement path="${build.dir}"/>
[15033]835 <pathelement path="${script-build.dir}"/>
836 <pathelement path="${commons-lang3.jar}"/>
837 </classpath>
838 <arg value="--noeli"/>
839 <arg value="-p"/>
840 <arg value="imagery_eliout.imagery.xml"/>
841 <arg value="-q"/>
842 <arg value="imagery_josmout.imagery.xml"/>
843 </java>
[9505]844 </target>
845
846 <target name="imageryindexdownload">
847 <exec append="false" executable="wget" failifexecutionfails="true">
848 <arg value="https://josm.openstreetmap.de/maps"/>
849 <arg value="-O"/>
[11965]850 <arg value="imagery_josm.imagery.xml"/>
[9505]851 <arg value="--unlink"/>
852 </exec>
853 <exec append="false" executable="wget" failifexecutionfails="true">
[11238]854 <arg value="https://josm.openstreetmap.de/wiki/ImageryCompareIgnores?format=txt"/>
855 <arg value="-O"/>
[11965]856 <arg value="imagery_josm.ignores.txt"/>
[11238]857 <arg value="--unlink"/>
858 </exec>
859 <exec append="false" executable="wget" failifexecutionfails="true">
[16375]860 <arg value="https://raw.githubusercontent.com/osmlab/editor-layer-index/gh-pages/imagery.geojson"/>
[9505]861 <arg value="-O"/>
[11965]862 <arg value="imagery_eli.geojson"/>
[9505]863 <arg value="--unlink"/>
864 </exec>
865 <antcall target="imageryindex"/>
866 </target>
867
[12582]868 <target name="checkstyle-compile" depends="init-properties">
[16243]869 <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="checkstyle.classpath" conf="checkstyle"/>
[12582]870 <mkdir dir="${checkstyle-build.dir}"/>
[13209]871 <javac sourcepath="" srcdir="${checkstyle.dir}/src" failonerror="true"
[12628]872 destdir="${checkstyle-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
[16346]873 includeantruntime="false"
[16171]874 encoding="UTF-8" classpathref="checkstyle.classpath">
[12582]875 </javac>
876 </target>
[13303]877 <target name="checkstyle-changed" depends="checkstyle-compile">
878 <exec append="false" osfamily="unix" executable="bash" failifexecutionfails="true">
879 <arg value="-c"/>
[16171]880 <arg value="(git ls-files src test --modified 2>/dev/null || svn status -q --ignore-externals src test) | grep -o '\(src\|test\)/.*' | xargs java -cp '${toString:checkstyle.classpath}:${checkstyle-build.dir}' com.puppycrawl.tools.checkstyle.Main -c ${checkstyle.dir}/josm_checks.xml | sed -e 's:\([^ ]*\) [^:]*/\([^:/]*.java\:[^:]*\):(\2)\1:'"/>
[13303]881 </exec>
882 <exec append="false" osfamily="windows" executable="powershell" failifexecutionfails="true">
883 <arg value="/c"/>
[16171]884 <arg value="svn status -q --ignore-externals src test | ForEach-Object {java -cp '${toString:checkstyle.classpath};${checkstyle-build.dir}' com.puppycrawl.tools.checkstyle.Main -c ${checkstyle.dir}/josm_checks.xml $_.split(' ')[7]}"/>
[13303]885 </exec>
886 </target>
[12582]887 <target name="checkstyle" depends="checkstyle-compile">
[16171]888 <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties">
889 <classpath refid="checkstyle.classpath"/>
890 <classpath path="${checkstyle-build.dir}"/>
891 </taskdef>
[13209]892 <checkstyle config="${checkstyle.dir}/josm_checks.xml">
[9765]893 <fileset dir="${base.dir}/src/org/openstreetmap/josm" includes="**/*.java"
[9250]894 excludes="gui/mappaint/mapcss/parsergen/*.java"/>
[9765]895 <fileset dir="${base.dir}/test" includes="**/*.java"/>
[14637]896 <fileset dir="${base.dir}/scripts" includes="**/*.java"/>
[11681]897 <formatter type="plain"/>
[8508]898 <formatter type="xml" toFile="checkstyle-josm.xml"/>
899 </checkstyle>
900 </target>
901
[16020]902 <target name="spotbugs" depends="dist">
[16243]903 <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="spotbugs.classpath" conf="spotbugs"/>
[16169]904 <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="spotbugs.classpath"/>
[12801]905 <spotbugs output="xml"
906 outputFile="spotbugs-josm.xml"
[16166]907 classpath="${toString:spotbugs.classpath}"
[6133]908 pluginList=""
[13209]909 excludeFilter="${spotbugs.dir}/josm-filter.xml"
[16229]910 onlyAnalyze="org.openstreetmap.josm.-"
[6133]911 effort="max"
[10223]912 reportLevel="low"
[6133]913 >
[16229]914 <class location="${dist.jar}" />
[12801]915 </spotbugs>
[4838]916 </target>
[11713]917
918 <target name="pmd" depends="init-properties">
[16243]919 <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="pmd.classpath" conf="pmd"/>
[16169]920 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/>
[13209]921 <pmd shortFilenames="true" cacheLocation="${pmd.dir}/cache" encoding="UTF-8">
[12628]922 <sourceLanguage name="java" version="${java.lang.version}" />
[13209]923 <ruleset>${pmd.dir}/josm-ruleset.xml</ruleset>
[11713]924 <formatter type="text" toConsole="true" />
925 <formatter type="xml" toFile="pmd-josm.xml">
926 <param name="encoding" value="UTF-8" />
927 </formatter>
928 <fileset dir="${src.dir}">
929 <include name="org/openstreetmap/josm/**/*.java"/>
930 <exclude name="org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/*.java" />
931 </fileset>
[14638]932 <fileset dir="${base.dir}/scripts" includes="**/*.java"/>
[11713]933 </pmd>
934 </target>
935
[5323]936 <target name="run" depends="dist">
[12628]937 <java jar="${dist.jar}" fork="true">
[5323]938 <arg value="--set=expert=true"/>
[15797]939 <arg value="--set=iso.dates=true"/>
[5323]940 <jvmarg value="-Djosm.home=/tmp/.josm/"/>
941 </java>
942 </target>
[9765]943 <!--
944 ** Compile build script for generating projection list.
945 -->
[16352]946 <target name="epsg-compile" depends="init-properties">
[9765]947 <property name="proj-classpath" location="${build.dir}"/>
948 <mkdir dir="${proj-build.dir}"/>
[13794]949 <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="BuildProjectionDefinitions.java"
[12628]950 destdir="${proj-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
[16346]951 includeantruntime="false"
[9765]952 encoding="UTF-8" classpath="${proj-classpath}">
[9133]953 </javac>
954 </target>
[9765]955 <!--
956 ** generate projection list.
957 -->
[16345]958 <target name="epsg" unless="epsg.notRequired" depends="epsg-compile">
[13236]959 <touch file="${epsg.output}" mkdirs="true"/>
[10259]960 <java classname="BuildProjectionDefinitions" failonerror="true" fork="true">
[9735]961 <sysproperty key="java.awt.headless" value="true"/>
[9133]962 <classpath>
[16140]963 <pathelement path="${resources.dir}"/>
[9765]964 <pathelement path="${proj-classpath}"/>
965 <pathelement path="${proj-build.dir}"/>
[9133]966 </classpath>
[9765]967 <arg value="${base.dir}"/>
[9133]968 </java>
969 </target>
[14136]970 <!--
[14568]971 ** update projection test files after an update of projection definitions
972 -->
973 <target name="update-proj-files" depends="test-compile">
974 <java classname="org.openstreetmap.josm.data.projection.ProjectionRefTest" failonerror="true" fork="true">
975 <classpath>
976 <path refid="test.classpath"/>
977 <pathelement path="${test.dir}/build/unit"/>
978 </classpath>
979 </java>
980 <java classname="org.openstreetmap.josm.data.projection.ProjectionRegressionTest" failonerror="true" fork="true">
981 <classpath>
982 <path refid="test.classpath"/>
983 <pathelement path="${test.dir}/build/unit"/>
984 </classpath>
985 </java>
986 </target>
987 <!--
[14136]988 ** generate jdeps dependency graph
989 -->
990 <target name="jdeps" depends="compile">
991 <delete dir="${modules.dir}"/>
992 <mkdir dir="${modules.dir}"/>
993 <!-- JOSM only -->
994 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-actions.jar" includes="org/openstreetmap/josm/actions/**/*.class"/>
995 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-cli.jar" includes="org/openstreetmap/josm/cli/**/*.class"/>
996 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-command.jar" includes="org/openstreetmap/josm/command/**/*.class"/>
997 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-data.jar" includes="org/openstreetmap/josm/data/**/*.class"/>
998 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-gui.jar" includes="org/openstreetmap/josm/gui/**/*.class"/>
999 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-io.jar" includes="org/openstreetmap/josm/io/**/*.class"/>
1000 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-plugins.jar" includes="org/openstreetmap/josm/plugins/**/*.class"/>
1001 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-spi.jar" includes="org/openstreetmap/josm/spi/**/*.class"/>
1002 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-tools.jar" includes="org/openstreetmap/josm/tools/**/*.class"/>
1003 <exec executable="jdeps" dir="${modules.dir}">
[16050]1004 <arg line="-f 'java.*|org.xml.*|org.w3c.*|sun.*|com.*|oauth.*|org.apache.*|org.glassfish.*|org.openstreetmap.gui.*'"/>
[14136]1005 <arg line="-dotoutput dots *.jar"/>
1006 </exec>
1007 <exec executable="dot" dir="${modules.dir}/dots">
1008 <arg line="-O -Tpng summary.dot"/>
1009 </exec>
1010 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-without-dependencies.png"/>
1011 <!-- Direct dependencies -->
[16050]1012 <copy todir="${modules.dir}" flatten="true">
1013 <fileset refid="runtime.fileset" />
1014 </copy>
[14136]1015 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/svgSalamander.jar" includes="com/kitfox/**/*.class"/>
1016 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/oauth-signpost.jar" includes="oauth/**/*.class"/>
[16399]1017 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/commons-jcs.jar" includes="org/apache/commons/jcs3/**/*.class"/>
[14136]1018 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/jmapviewer.jar" includes="org/openstreetmap/gui/**/*.class"/>
1019 <exec executable="jdeps" dir="${modules.dir}">
[16408]1020 <arg line="-f 'java.*|org.xml.*|org.w3c.*|sun.*|com.sun.*|com.google.*|org.tukaani.*'"/>
[14136]1021 <arg line="-dotoutput dots *.jar"/>
1022 </exec>
1023 <exec executable="dot" dir="${modules.dir}/dots">
1024 <arg line="-O -Tpng summary.dot"/>
1025 </exec>
1026 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-with-direct-dependencies.png"/>
1027 <!-- All dependencies -->
1028 <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/google-gdata.jar" includes="com/google/**/*.class"/>
1029 <exec executable="jdeps" dir="${modules.dir}">
1030 <arg line="-dotoutput dots *.jar"/>
1031 </exec>
1032 <exec executable="dot" dir="${modules.dir}/dots">
1033 <arg line="-O -Tpng summary.dot"/>
1034 </exec>
1035 <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-with-all-dependencies.png"/>
1036 </target>
[16050]1037 <target name="resolve" depends="init-ivy" unless="resolve.notRequired" description="Resolve Ivy dependencies">
[16125]1038 <ivy:settings file="${base.dir}/ivysettings.xml"/>
[16243]1039 <ivy:resolve log="download-only" file="${base.dir}/ivy.xml" keep="true"/>
1040 <ivy:cachepath log="download-only" pathid="compile.path" conf="compile"/>
1041 <ivy:cachepath log="download-only" pathid="runtime.path" conf="runtime"/>
1042 <ivy:cachefileset log="download-only" setid="runtime.fileset" conf="runtime"/>
1043 <ivy:cachepath log="download-only" pathid="test.path" conf="test"/>
[15977]1044 </target>
[16002]1045 <target name="extract-libraries" depends="resolve" description="extract libraries to build dir">
1046 <unzip dest="${build.dir}">
1047 <fileset refid="runtime.fileset"/>
1048 <patternset>
[16397]1049 <exclude name="META-INF/*"/>
1050 <exclude name="META-INF/maven/**"/>
1051 <exclude name="META-INF/versions/**"/>
[16002]1052 <exclude name="*"/>
[16194]1053 <exclude name="org/openstreetmap/gui/jmapviewer/Demo*"/>
[16027]1054 <exclude name="com/drew/imaging/FileTypeDetector*"/>
1055 <exclude name="com/drew/imaging/ImageMetadataReader*"/>
[16025]1056 <exclude name="com/drew/imaging/avi/**"/>
1057 <exclude name="com/drew/imaging/bmp/**"/>
1058 <exclude name="com/drew/imaging/eps/**"/>
1059 <exclude name="com/drew/imaging/gif/**"/>
1060 <exclude name="com/drew/imaging/heif/**"/>
1061 <exclude name="com/drew/imaging/ico/**"/>
1062 <exclude name="com/drew/imaging/mp3/**"/>
1063 <exclude name="com/drew/imaging/mp4/**"/>
1064 <exclude name="com/drew/imaging/pcx/**"/>
1065 <exclude name="com/drew/imaging/png/**"/>
1066 <exclude name="com/drew/imaging/psd/**"/>
1067 <exclude name="com/drew/imaging/quicktime/**"/>
1068 <exclude name="com/drew/imaging/raf/**"/>
1069 <exclude name="com/drew/imaging/riff/**"/>
1070 <exclude name="com/drew/imaging/wav/**"/>
1071 <exclude name="com/drew/imaging/webp/**"/>
1072 <exclude name="com/drew/metadata/avi/**"/>
1073 <exclude name="com/drew/metadata/bmp/**"/>
1074 <exclude name="com/drew/metadata/eps/**"/>
1075 <exclude name="com/drew/metadata/gif/**"/>
1076 <exclude name="com/drew/metadata/heif/**"/>
1077 <exclude name="com/drew/metadata/ico/**"/>
1078 <exclude name="com/drew/metadata/mov/**"/>
1079 <exclude name="com/drew/metadata/mp3/**"/>
1080 <exclude name="com/drew/metadata/mp4/**"/>
1081 <exclude name="com/drew/metadata/pcx/**"/>
1082 <exclude name="com/drew/metadata/png/**"/>
1083 <exclude name="com/drew/metadata/wav/**"/>
1084 <exclude name="com/drew/metadata/webp/**"/>
1085 <exclude name="com/drew/tools/**"/>
[16026]1086 <exclude name="org/apache/commons/compress/PasswordRequiredException*"/>
[16023]1087 <exclude name="org/apache/commons/compress/archivers/**"/>
1088 <exclude name="org/apache/commons/compress/changes/**"/>
[16026]1089 <exclude name="org/apache/commons/compress/compressors/bzip2/BZip2Utils*"/>
[16023]1090 <exclude name="org/apache/commons/compress/compressors/brotli/**"/>
[16026]1091 <exclude name="org/apache/commons/compress/compressors/CompressorStreamFactory*"/>
1092 <exclude name="org/apache/commons/compress/compressors/CompressorStreamProvider*"/>
1093 <exclude name="org/apache/commons/compress/compressors/CompressorException*"/>
1094 <exclude name="org/apache/commons/compress/compressors/FileNameUtil*"/>
[16023]1095 <exclude name="org/apache/commons/compress/compressors/deflate/**"/>
1096 <exclude name="org/apache/commons/compress/compressors/gzip/**"/>
1097 <exclude name="org/apache/commons/compress/compressors/lz4/**"/>
1098 <exclude name="org/apache/commons/compress/compressors/lzma/**"/>
1099 <exclude name="org/apache/commons/compress/compressors/lz77support/**"/>
1100 <exclude name="org/apache/commons/compress/compressors/pack200/**"/>
1101 <exclude name="org/apache/commons/compress/compressors/snappy/**"/>
[16026]1102 <exclude name="org/apache/commons/compress/compressors/xz/XZUtils*"/>
[16023]1103 <exclude name="org/apache/commons/compress/compressors/z/**"/>
1104 <exclude name="org/apache/commons/compress/compressors/zstandard/**"/>
1105 <exclude name="org/apache/commons/compress/parallel/**"/>
[16026]1106 <exclude name="org/apache/commons/compress/utils/ArchiveUtils*"/>
[16399]1107 <exclude name="org/apache/commons/jcs3/auxiliary/disk/jdbc/**"/>
1108 <exclude name="org/apache/commons/jcs3/auxiliary/remote/http/client/**"/>
1109 <exclude name="org/apache/commons/jcs3/auxiliary/remote/http/server/RemoteHttpCacheServlet*"/>
1110 <exclude name="org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheStartupServlet*"/>
1111 <exclude name="org/apache/commons/jcs3/log/Log4j2Factory*"/>
1112 <exclude name="org/apache/commons/jcs3/log/Log4j2LogAdapter*"/>
1113 <exclude name="org/apache/commons/jcs3/utils/servlet/**"/>
[16002]1114 </patternset>
1115 </unzip>
1116 </target>
[16150]1117 <target name="sources" description="Generates jar file of JOSM source files and its dependencies" depends="init,epsg,resolve">
[16243]1118 <ivy:cachefileset log="download-only" setid="sources.fileset" conf="sources"/>
[16141]1119 <jar destfile="${dist-sources.jar}" level="${clevel}">
1120 <zipgroupfileset refid="sources.fileset"/>
[16350]1121 <fileset dir="${src.dir}"/>
[16141]1122 <fileset dir="${resources.dir}"/>
1123 </jar>
1124 </target>
[15977]1125 <target name="bootstrap-workspace" description="Copy libraries from ivy cache to workspace folders for IDE" depends="resolve">
1126 <delete dir="${lib.dir}"/>
[16229]1127 <ivy:retrieve pattern="${lib.dir}/[conf]/[artifact]-[type].[ext]" conf="compile,runtime,sources,test"/>
[16556]1128 <ivy:retrieve pattern="${lib.dir}/tools/[artifact]-[type].[ext]" conf="javacc,checkstyle,pmd,spotbugs,errorprone" file="${tools.ivy}"/>
[15977]1129 </target>
[16243]1130 <target name="ivy-report" description="Generates Ivy reports of dependency resolving" depends="resolve">
1131 <ivy:report todir="${tools.dir}/ivy-report" graph="false"/>
1132 </target>
[16229]1133 <target name="api-dependency-tree" description="Displays Ivy dependency tree for JOSM API" depends="resolve">
1134 <ivy:dependencytree conf="api"/>
1135 </target>
1136 <target name="test-dependency-tree" description="Displays Ivy dependency tree for JOSM tests" depends="resolve">
1137 <ivy:dependencytree conf="test"/>
1138 </target>
[4166]1139</project>
Note: See TracBrowser for help on using the repository browser.