source: josm/trunk/build.xml@ 17242

Last change on this file since 17242 was 17236, checked in by Don-vip, 4 years ago

see #19937 - Update macOS build process (patch by Stereo, modified)

See See https://github.com/openstreetmap/josm/pull/65

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