source: josm/trunk/build.xml@ 16126

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

see #18845 - fix build.xml for script targets, jar file is not required

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