[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 | -->
|
---|
[6133] | 11 | <project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
|
---|
[4252] | 12 | <property name="test.dir" location="test"/>
|
---|
| 13 | <property name="src.dir" location="src"/>
|
---|
| 14 | <property name="build.dir" location="build"/>
|
---|
| 15 | <property name="javacc.home" location="tools"/>
|
---|
| 16 | <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
|
---|
[7133] | 17 | <property name="imagerytypes.dir" location="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
|
---|
[4166] | 18 | <!-- build parameter: compression level (ant -Dclevel=N)
|
---|
| 19 | N ranges from 0 (no compression) to 9 (maximum compression)
|
---|
| 20 | default: 9 -->
|
---|
| 21 | <condition property="clevel" value="${clevel}" else="9">
|
---|
| 22 | <isset property="clevel"/>
|
---|
| 23 | </condition>
|
---|
[7209] | 24 | <!-- For Windows-specific stuff -->
|
---|
| 25 | <condition property="isWindows">
|
---|
| 26 | <os family="Windows"/>
|
---|
| 27 | </condition>
|
---|
[4252] | 28 |
|
---|
[4166] | 29 | <!--
|
---|
[6133] | 30 | ** Used by Eclipse ant builder for updating
|
---|
| 31 | ** the REVISION file used by JOSM
|
---|
| 32 | -->
|
---|
[4166] | 33 | <target name="create-revision-eclipse">
|
---|
| 34 | <property name="revision.dir" value="bin"/>
|
---|
| 35 | <antcall target="create-revision"/>
|
---|
| 36 | </target>
|
---|
| 37 | <!--
|
---|
[6540] | 38 | ** Initializes the REVISION.XML file from SVN information
|
---|
[6133] | 39 | -->
|
---|
[6545] | 40 | <target name="init-svn-revision-xml">
|
---|
[6585] | 41 | <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false" resultproperty="svn.info.result">
|
---|
[4166] | 42 | <env key="LANG" value="C"/>
|
---|
| 43 | <arg value="info"/>
|
---|
| 44 | <arg value="--xml"/>
|
---|
| 45 | <arg value="."/>
|
---|
| 46 | </exec>
|
---|
[6585] | 47 | <condition property="svn.info.success">
|
---|
| 48 | <equals arg1="${svn.info.result}" arg2="0" />
|
---|
| 49 | </condition>
|
---|
[6540] | 50 | </target>
|
---|
| 51 | <!--
|
---|
| 52 | ** Initializes the REVISION.XML file from git information
|
---|
| 53 | -->
|
---|
[6585] | 54 | <target name="init-git-revision-xml" unless="svn.info.success">
|
---|
[6545] | 55 | <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false">
|
---|
[6540] | 56 | <arg value="log"/>
|
---|
| 57 | <arg value="-1"/>
|
---|
| 58 | <arg value="--grep=git-svn-id"/>
|
---|
[6545] | 59 | <!--
|
---|
| 60 | %B: raw body (unwrapped subject and body)
|
---|
| 61 | %n: new line
|
---|
| 62 | %ai: author date, ISO 8601 format
|
---|
| 63 | -->
|
---|
| 64 | <arg value="--pretty=format:%B%n%ai"/>
|
---|
[6540] | 65 | <arg value="HEAD"/>
|
---|
| 66 | </exec>
|
---|
[6545] | 67 | <replaceregexp file="REVISION.XML" flags="s"
|
---|
| 68 | match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
|
---|
| 69 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
[6540] | 70 | </target>
|
---|
| 71 | <!--
|
---|
| 72 | ** Creates the REVISION file to be included in the distribution
|
---|
| 73 | -->
|
---|
| 74 | <target name="create-revision" depends="init-svn-revision-xml, init-git-revision-xml">
|
---|
| 75 | <property name="revision.dir" value="${build.dir}"/>
|
---|
[4166] | 76 | <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 77 | <delete file="REVISION.XML"/>
|
---|
| 78 | <tstamp>
|
---|
| 79 | <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
|
---|
| 80 | </tstamp>
|
---|
| 81 | <property name="version.entry.commit.revision" value="UNKNOWN"/>
|
---|
[6540] | 82 | <property name="version.entry.commit.date" value="UNKNOWN"/>
|
---|
[4166] | 83 | <mkdir dir="${revision.dir}"/>
|
---|
[5362] | 84 | <!-- add Build-Name: ... when making special builds, e.g. DEBIAN -->
|
---|
[4166] | 85 | <echo file="${revision.dir}/REVISION">
|
---|
| 86 | # automatically generated by JOSM build.xml - do not edit
|
---|
| 87 | Revision: ${version.entry.commit.revision}
|
---|
| 88 | Is-Local-Build: true
|
---|
| 89 | Build-Date: ${build.tstamp}
|
---|
| 90 | </echo>
|
---|
| 91 | </target>
|
---|
[6540] | 92 | <!--
|
---|
| 93 | ** Check internal XML files against their XSD
|
---|
| 94 | -->
|
---|
[7209] | 95 | <target name="check-schemas" unless="check-schemas.notRequired">
|
---|
[6208] | 96 | <schemavalidate file="data/defaultpresets.xml" >
|
---|
| 97 | <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="data/tagging-preset.xsd" />
|
---|
| 98 | </schemavalidate>
|
---|
| 99 | </target>
|
---|
[6540] | 100 | <!--
|
---|
| 101 | ** Main target that builds JOSM and checks XML against schemas
|
---|
| 102 | -->
|
---|
[6208] | 103 | <target name="dist" depends="compile,create-revision,check-schemas">
|
---|
[4166] | 104 | <echo>Revision ${version.entry.commit.revision}</echo>
|
---|
| 105 | <copy file="CONTRIBUTION" todir="build"/>
|
---|
| 106 | <copy file="README" todir="build"/>
|
---|
| 107 | <copy file="LICENSE" todir="build"/>
|
---|
| 108 | <!-- create josm-custom.jar -->
|
---|
| 109 | <delete file="dist/josm-custom.jar"/>
|
---|
| 110 | <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
|
---|
| 111 | <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
|
---|
| 112 | <manifest>
|
---|
| 113 | <attribute name="Main-class" value="JOSM"/>
|
---|
| 114 | <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
|
---|
| 115 | <attribute name="Main-Date" value="${version.entry.commit.date}"/>
|
---|
[6341] | 116 | <attribute name="Permissions" value="all-permissions"/>
|
---|
| 117 | <attribute name="Codebase" value="josm.openstreetmap.de"/>
|
---|
| 118 | <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
|
---|
[4166] | 119 | </manifest>
|
---|
| 120 | <zipfileset dir="images" prefix="images"/>
|
---|
| 121 | <zipfileset dir="data" prefix="data"/>
|
---|
| 122 | <zipfileset dir="styles" prefix="styles"/>
|
---|
[7133] | 123 | <zipfileset dir="${src.dir}/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
|
---|
[4166] | 124 | </jar>
|
---|
| 125 | </target>
|
---|
[7001] | 126 | <!-- Mac OS X target -->
|
---|
| 127 | <target name="mac">
|
---|
[6217] | 128 | <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
|
---|
| 129 | <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="tools/appbundler-1.0ea.jar"/>
|
---|
| 130 | <!-- create MacOS X application bundle -->
|
---|
[6945] | 131 | <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
|
---|
[6216] | 132 | mainclassname="org.openstreetmap.josm.gui.MainApplication"
|
---|
[6217] | 133 | copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
|
---|
[6216] | 134 | applicationCategory="public.app-category.utilities"
|
---|
| 135 | shortversion="${version.entry.commit.revision} SVN"
|
---|
| 136 | version="${version.entry.commit.revision} SVN"
|
---|
| 137 | icon="macosx/JOSM.app/Contents/Resources/JOSM.icns"
|
---|
[6217] | 138 | highResolutionCapable="true">
|
---|
[6216] | 139 |
|
---|
| 140 | <arch name="x86_64"/>
|
---|
| 141 | <arch name="i386"/>
|
---|
| 142 |
|
---|
[6945] | 143 | <classpath file="${bundle.jar}"/>
|
---|
[6216] | 144 |
|
---|
[7287] | 145 | <option value="-Xmx1024m"/>
|
---|
[6216] | 146 |
|
---|
| 147 | <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
|
---|
| 148 | <option value="-Xdock:name=JOSM"/>
|
---|
| 149 |
|
---|
| 150 | <!-- OSX specific options, optional -->
|
---|
| 151 | <option value="-Dapple.laf.useScreenMenuBar=true"/>
|
---|
| 152 | <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
|
---|
| 153 | <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
|
---|
| 154 | <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
|
---|
| 155 | <option value="-Dcom.apple.smallTabs=true"/>
|
---|
| 156 | </bundleapp>
|
---|
[6217] | 157 |
|
---|
| 158 | <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
|
---|
| 159 | <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/>
|
---|
| 160 |
|
---|
[6945] | 161 | <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
|
---|
[7367] | 162 | <!-- remove empty CFBundleDocumentTypes definition -->
|
---|
| 163 | <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/>
|
---|
[7287] | 164 | <!-- insert our own keys -->
|
---|
| 165 | <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" />
|
---|
[6217] | 166 | </xmltask>
|
---|
| 167 |
|
---|
[6216] | 168 | <!-- create ZIP file with MacOS X application bundle -->
|
---|
[7001] | 169 | <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
|
---|
[6945] | 170 | <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
|
---|
| 171 | <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
|
---|
[6216] | 172 | </zip>
|
---|
[6217] | 173 | </target>
|
---|
[7001] | 174 | <target name="distmac" depends="dist">
|
---|
| 175 | <antcall target="mac">
|
---|
[6945] | 176 | <param name="bundle.outdir" value="dist"/>
|
---|
| 177 | <param name="bundle.jar" value="dist/josm-custom.jar"/>
|
---|
| 178 | </antcall>
|
---|
| 179 | </target>
|
---|
[7839] | 180 | <!-- Windows target -->
|
---|
| 181 | <target name="distwin" depends="dist">
|
---|
[7842] | 182 | <exec dir="windows" executable="./josm-setup-unix.sh">
|
---|
[7839] | 183 | <arg value="${version.entry.commit.revision}"/>
|
---|
| 184 | <arg value="../dist/josm-custom.jar"/>
|
---|
| 185 | </exec>
|
---|
| 186 | </target>
|
---|
[5392] | 187 | <target name="javacc" depends="init" unless="javacc.notRequired">
|
---|
[4252] | 188 | <mkdir dir="${mapcss.dir}/parsergen"/>
|
---|
[4257] | 189 | <exec append="false" executable="java" failifexecutionfails="true">
|
---|
| 190 | <arg value="-cp"/>
|
---|
| 191 | <arg value="${javacc.home}/javacc.jar"/>
|
---|
| 192 | <arg value="javacc"/>
|
---|
[7043] | 193 | <arg value="-DEBUG_PARSER=false"/>
|
---|
| 194 | <arg value="-DEBUG_TOKEN_MANAGER=false"/>
|
---|
[7001] | 195 | <arg value="-JDK_VERSION=1.7"/>
|
---|
[6446] | 196 | <arg value="-GRAMMAR_ENCODING=UTF-8"/>
|
---|
[4257] | 197 | <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
|
---|
| 198 | <arg value="${mapcss.dir}/MapCSSParser.jj"/>
|
---|
| 199 | </exec>
|
---|
[4252] | 200 | </target>
|
---|
[7209] | 201 | <target name="-jaxb_win" if="isWindows">
|
---|
| 202 | <property name="xjc" value="${java.home}\..\bin\xjc.exe" />
|
---|
[7133] | 203 | </target>
|
---|
[7209] | 204 | <target name="-jaxb_nix" unless="isWindows">
|
---|
| 205 | <property name="xjc" value="${java.home}/../bin/xjc" />
|
---|
| 206 | </target>
|
---|
| 207 | <target name="jaxb" depends="init, -jaxb_win, -jaxb_nix" unless="jaxb.notRequired">
|
---|
| 208 | <exec executable="${xjc}" failonerror="true">
|
---|
| 209 | <arg value="-d"/>
|
---|
| 210 | <arg value="${src.dir}"/>
|
---|
| 211 | <arg value="-encoding"/>
|
---|
| 212 | <arg value="UTF-8"/>
|
---|
| 213 | <arg value="data_nodist/wms-cache.xsd"/>
|
---|
| 214 | </exec>
|
---|
| 215 | </target>
|
---|
[7133] | 216 | <target name="compile" depends="init,javacc,jaxb">
|
---|
[7068] | 217 | <!-- COTS -->
|
---|
[8173] | 218 | <javac srcdir="${src.dir}" includes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**" nowarn="on" encoding="iso-8859-1"
|
---|
| 219 | destdir="build" target="1.7" source="1.7" debug="on" includeAntRuntime="false" createMissingPackageInfoClass="false">
|
---|
[7019] | 220 | <!-- get rid of "internal proprietary API" warning -->
|
---|
[7068] | 221 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
[8173] | 222 | <exclude name="org/apache/commons/compress/compressors/lzma/**"/>
|
---|
| 223 | <exclude name="org/apache/commons/compress/compressors/xz/**"/>
|
---|
| 224 | <exclude name="org/apache/commons/compress/compressors/CompressorStreamFactory.java"/>
|
---|
| 225 | <exclude name="org/apache/commons/compress/compressors/deflate/**"/>
|
---|
| 226 | <exclude name="org/apache/commons/compress/compressors/gzip/**"/>
|
---|
| 227 | <exclude name="org/apache/commons/compress/compressors/lzw/**"/>
|
---|
| 228 | <exclude name="org/apache/commons/compress/compressors/pack200/**"/>
|
---|
| 229 | <exclude name="org/apache/commons/compress/compressors/snappy/**"/>
|
---|
| 230 | <exclude name="org/apache/commons/compress/compressors/z/**"/>
|
---|
| 231 | <exclude name="org/apache/commons/jcs/admin/**"/>
|
---|
| 232 | <exclude name="org/apache/commons/jcs/auxiliary/disk/jdbc/**"/>
|
---|
| 233 | <exclude name="org/apache/commons/jcs/auxiliary/remote/**"/>
|
---|
| 234 | <exclude name="org/apache/commons/jcs/utils/servlet/**"/>
|
---|
| 235 | <exclude name="org/apache/commons/logging/impl/AvalonLogger.java"/>
|
---|
| 236 | <exclude name="org/apache/commons/logging/impl/Jdk13LumberjackLogger.java"/>
|
---|
| 237 | <exclude name="org/apache/commons/logging/impl/Log4JLogger.java"/>
|
---|
| 238 | <exclude name="org/apache/commons/logging/impl/LogKitLogger.java"/>
|
---|
| 239 | <exclude name="org/apache/commons/logging/impl/ServletContextCleaner.java"/>
|
---|
[7019] | 240 | </javac>
|
---|
| 241 | <!-- JMapViewer/JOSM -->
|
---|
[7868] | 242 | <javac srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
|
---|
[7068] | 243 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
|
---|
[7021] | 244 | <compilerarg value="-Xlint:cast"/>
|
---|
[4166] | 245 | <compilerarg value="-Xlint:deprecation"/>
|
---|
[7022] | 246 | <compilerarg value="-Xlint:dep-ann"/>
|
---|
| 247 | <compilerarg value="-Xlint:divzero"/>
|
---|
| 248 | <compilerarg value="-Xlint:empty"/>
|
---|
| 249 | <compilerarg value="-Xlint:finally"/>
|
---|
| 250 | <compilerarg value="-Xlint:overrides"/>
|
---|
| 251 | <!--<compilerarg value="-Xlint:rawtypes"/>-->
|
---|
| 252 | <compilerarg value="-Xlint:static"/>
|
---|
| 253 | <compilerarg value="-Xlint:try"/>
|
---|
[4166] | 254 | <compilerarg value="-Xlint:unchecked"/>
|
---|
[7367] | 255 | <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
|
---|
[7351] | 256 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
[4166] | 257 | </javac>
|
---|
[6756] | 258 | <copy todir="build" failonerror="no" includeemptydirs="no">
|
---|
| 259 | <fileset dir="resources"/>
|
---|
| 260 | </copy>
|
---|
[4166] | 261 | </target>
|
---|
| 262 | <target name="init">
|
---|
[5392] | 263 | <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
|
---|
| 264 | <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
|
---|
| 265 | </uptodate>
|
---|
[7215] | 266 | <uptodate property="jaxb.notRequired" targetfile="${src.dir}/org/openstreetmap/josm/data/imagery/types/package-info.java" >
|
---|
| 267 | <srcfiles dir="data_nodist" includes="wms-cache.xsd"/>
|
---|
| 268 | </uptodate>
|
---|
[4166] | 269 | <mkdir dir="build"/>
|
---|
| 270 | <mkdir dir="dist"/>
|
---|
| 271 | </target>
|
---|
[5263] | 272 | <target name="javadoc">
|
---|
| 273 | <javadoc destdir="javadoc"
|
---|
[7133] | 274 | sourcepath="${src.dir}"
|
---|
[6830] | 275 | encoding="UTF-8"
|
---|
[5263] | 276 | packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
|
---|
| 277 | windowtitle="JOSM"
|
---|
| 278 | use="true"
|
---|
[5481] | 279 | private="true"
|
---|
[5263] | 280 | linksource="true"
|
---|
| 281 | author="false">
|
---|
[7001] | 282 | <link href="http://docs.oracle.com/javase/7/docs/api"/>
|
---|
[5263] | 283 | <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
|
---|
[6955] | 284 | <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
|
---|
[5263] | 285 | </javadoc>
|
---|
| 286 | </target>
|
---|
[4166] | 287 | <target name="clean">
|
---|
| 288 | <delete dir="build"/>
|
---|
| 289 | <delete dir="dist"/>
|
---|
[4252] | 290 | <delete dir="${mapcss.dir}/parsergen"/>
|
---|
[7133] | 291 | <delete dir="${imagerytypes.dir}"/>
|
---|
[4166] | 292 | </target>
|
---|
| 293 | <path id="test.classpath">
|
---|
| 294 | <fileset dir="${test.dir}/lib">
|
---|
| 295 | <include name="**/*.jar"/>
|
---|
| 296 | </fileset>
|
---|
| 297 | <pathelement path="dist/josm-custom.jar"/>
|
---|
[8157] | 298 | <pathelement path="tools/groovy-all-2.4.3.jar"/>
|
---|
[4166] | 299 | </path>
|
---|
[7068] | 300 | <macrodef name="init-test-preferences">
|
---|
| 301 | <attribute name="testfamily"/>
|
---|
| 302 | <sequential>
|
---|
| 303 | <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
|
---|
| 304 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
| 305 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
| 306 | </sequential>
|
---|
| 307 | </macrodef>
|
---|
[4166] | 308 | <target name="test-init">
|
---|
[6121] | 309 | <mkdir dir="${test.dir}/build"/>
|
---|
[7068] | 310 | <mkdir dir="${test.dir}/build/unit"/>
|
---|
| 311 | <mkdir dir="${test.dir}/build/functional"/>
|
---|
| 312 | <mkdir dir="${test.dir}/build/performance"/>
|
---|
[4166] | 313 | <mkdir dir="${test.dir}/report"/>
|
---|
[7068] | 314 | <init-test-preferences testfamily="unit"/>
|
---|
| 315 | <init-test-preferences testfamily="functional"/>
|
---|
| 316 | <init-test-preferences testfamily="performance"/>
|
---|
[4166] | 317 | </target>
|
---|
| 318 | <target name="test-clean">
|
---|
[6121] | 319 | <delete dir="${test.dir}/build"/>
|
---|
[4166] | 320 | <delete dir="${test.dir}/report"/>
|
---|
[6133] | 321 | <delete file="${test.dir}/jacoco.exec" />
|
---|
[7068] | 322 | <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
|
---|
| 323 | <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
|
---|
| 324 | <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
|
---|
| 325 | <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
|
---|
| 326 | <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
|
---|
| 327 | <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
|
---|
[4166] | 328 | </target>
|
---|
[7068] | 329 | <macrodef name="call-groovyc">
|
---|
| 330 | <attribute name="testfamily"/>
|
---|
| 331 | <element name="cp-elements"/>
|
---|
| 332 | <sequential>
|
---|
| 333 | <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
|
---|
| 334 | <classpath>
|
---|
| 335 | <cp-elements/>
|
---|
| 336 | </classpath>
|
---|
[7367] | 337 | <javac target="1.7" source="1.7" debug="on" encoding="UTF-8">
|
---|
[7068] | 338 | <compilerarg value="-Xlint:all"/>
|
---|
| 339 | <compilerarg value="-Xlint:-serial"/>
|
---|
| 340 | </javac>
|
---|
| 341 | </groovyc>
|
---|
| 342 | </sequential>
|
---|
| 343 | </macrodef>
|
---|
[4166] | 344 | <target name="test-compile" depends="test-init,dist">
|
---|
[8156] | 345 | <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.4.3.jar"/>
|
---|
[7068] | 346 | <call-groovyc testfamily="unit">
|
---|
| 347 | <cp-elements>
|
---|
| 348 | <path refid="test.classpath"/>
|
---|
| 349 | </cp-elements>
|
---|
| 350 | </call-groovyc>
|
---|
| 351 | <call-groovyc testfamily="functional">
|
---|
| 352 | <cp-elements>
|
---|
| 353 | <path refid="test.classpath"/>
|
---|
| 354 | <pathelement path="${test.dir}/build/unit"/>
|
---|
| 355 | </cp-elements>
|
---|
| 356 | </call-groovyc>
|
---|
| 357 | <call-groovyc testfamily="performance">
|
---|
| 358 | <cp-elements>
|
---|
| 359 | <path refid="test.classpath"/>
|
---|
| 360 | <pathelement path="${test.dir}/build/unit"/>
|
---|
| 361 | </cp-elements>
|
---|
| 362 | </call-groovyc>
|
---|
[4166] | 363 | </target>
|
---|
[7068] | 364 | <macrodef name="call-junit">
|
---|
| 365 | <attribute name="testfamily"/>
|
---|
| 366 | <sequential>
|
---|
| 367 | <echo message="Running @{testfamily} tests with JUnit"/>
|
---|
| 368 | <jacoco:coverage destfile="${test.dir}/jacoco.exec">
|
---|
| 369 | <junit printsummary="yes" fork="true" forkmode="once">
|
---|
[7367] | 370 | <jvmarg value="-Dfile.encoding=UTF-8"/>
|
---|
[7068] | 371 | <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
|
---|
| 372 | <sysproperty key="josm.test.data" value="${test.dir}/data"/>
|
---|
| 373 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
| 374 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
| 375 | <classpath>
|
---|
| 376 | <path refid="test.classpath"/>
|
---|
| 377 | <pathelement path="${test.dir}/build/unit"/>
|
---|
| 378 | <pathelement path="${test.dir}/build/@{testfamily}"/>
|
---|
| 379 | <pathelement path="${test.dir}/config"/>
|
---|
| 380 | </classpath>
|
---|
| 381 | <formatter type="plain"/>
|
---|
| 382 | <formatter type="xml"/>
|
---|
| 383 | <batchtest fork="yes" todir="${test.dir}/report">
|
---|
| 384 | <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test.class"/>
|
---|
| 385 | </batchtest>
|
---|
| 386 | </junit>
|
---|
| 387 | </jacoco:coverage>
|
---|
| 388 | </sequential>
|
---|
| 389 | </macrodef>
|
---|
| 390 | <target name="test" depends="test-compile"
|
---|
[7133] | 391 | description="Run unit, functional and performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
[6133] | 392 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
|
---|
[7068] | 393 | <call-junit testfamily="unit"/>
|
---|
| 394 | <call-junit testfamily="functional"/>
|
---|
| 395 | <call-junit testfamily="performance"/>
|
---|
[4166] | 396 | </target>
|
---|
| 397 | <target name="test-html" depends="test" description="Generate HTML test reports">
|
---|
| 398 | <!-- May require additional ant dependencies like ant-trax package -->
|
---|
| 399 | <junitreport todir="${test.dir}/report">
|
---|
| 400 | <fileset dir="${test.dir}/report">
|
---|
| 401 | <include name="TEST-*.xml"/>
|
---|
| 402 | </fileset>
|
---|
| 403 | <report todir="${test.dir}/report/html"/>
|
---|
| 404 | </junitreport>
|
---|
[6133] | 405 | <jacoco:report>
|
---|
| 406 | <executiondata>
|
---|
| 407 | <file file="${test.dir}/jacoco.exec"/>
|
---|
| 408 | </executiondata>
|
---|
| 409 | <structure name="JOSM Test Coverage">
|
---|
| 410 | <classfiles>
|
---|
| 411 | <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
|
---|
| 412 | </classfiles>
|
---|
| 413 | <sourcefiles encoding="UTF-8">
|
---|
| 414 | <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
|
---|
| 415 | </sourcefiles>
|
---|
| 416 | </structure>
|
---|
[6134] | 417 | <html destdir="${test.dir}/report/jacoco"/>
|
---|
[6133] | 418 | </jacoco:report>
|
---|
[4166] | 419 | </target>
|
---|
| 420 | <target name="dist-optimized" depends="dist">
|
---|
| 421 | <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
|
---|
| 422 | <proguard>
|
---|
[7367] | 423 | -injars dist/josm-custom.jar
|
---|
| 424 | -outjars dist/josm-custom-optimized.jar
|
---|
[4166] | 425 |
|
---|
[7367] | 426 | -libraryjars ${java.home}/lib/rt.jar
|
---|
| 427 | -libraryjars ${java.home}/lib/jce.jar
|
---|
[4166] | 428 |
|
---|
[7367] | 429 | -dontoptimize
|
---|
| 430 | -dontobfuscate
|
---|
[4166] | 431 |
|
---|
[7367] | 432 | # These options probably are not necessary (and make processing a bit slower)
|
---|
| 433 | -dontskipnonpubliclibraryclasses
|
---|
| 434 | -dontskipnonpubliclibraryclassmembers
|
---|
[4166] | 435 |
|
---|
[7367] | 436 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
| 437 | public static void main(java.lang.String[]);
|
---|
| 438 | }
|
---|
| 439 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
|
---|
[4166] | 440 |
|
---|
[7367] | 441 | -keep class JOSM
|
---|
| 442 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
| 443 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
| 444 | -keep class org.w3._2001.xmlschema.Adapter1
|
---|
| 445 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
[8172] | 446 | -keep class org.apache.commons.logging.impl.*
|
---|
[4166] | 447 |
|
---|
[7367] | 448 | -keepclassmembers enum * {
|
---|
| 449 | public static **[] values();
|
---|
| 450 | public static ** valueOf(java.lang.String);
|
---|
| 451 | }
|
---|
[4166] | 452 |
|
---|
[7367] | 453 | # Keep unused public methods (can be useful for plugins)
|
---|
| 454 | -keepclassmembers class * {
|
---|
| 455 | public protected *;
|
---|
| 456 | }
|
---|
[4838] | 457 |
|
---|
[7367] | 458 | # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
|
---|
| 459 | # This note should not be a problem as we don't use obfuscation
|
---|
| 460 | -dontnote
|
---|
[6133] | 461 | </proguard>
|
---|
[4166] | 462 | </target>
|
---|
| 463 | <target name="check-plugins" depends="dist-optimized">
|
---|
| 464 | <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
|
---|
| 465 | <local name="dir"/>
|
---|
| 466 | <local name="plugins"/>
|
---|
| 467 | <property name="dir" value="plugin-check"/>
|
---|
| 468 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
|
---|
[8156] | 469 | <classpath path="tools/animal-sniffer-ant-tasks-1.14.jar"/>
|
---|
[4166] | 470 | </typedef>
|
---|
| 471 | <mkdir dir="${dir}"/>
|
---|
| 472 | <!-- List of deprecated plugins -->
|
---|
[7133] | 473 | <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
|
---|
[4166] | 474 | <filterchain>
|
---|
| 475 | <linecontains>
|
---|
| 476 | <contains value="new DeprecatedPlugin("/>
|
---|
| 477 | </linecontains>
|
---|
| 478 | <tokenfilter>
|
---|
| 479 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
|
---|
| 480 | </tokenfilter>
|
---|
| 481 | <striplinebreaks/>
|
---|
| 482 | <tokenfilter>
|
---|
| 483 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
| 484 | </tokenfilter>
|
---|
| 485 | </filterchain>
|
---|
| 486 | </loadfile>
|
---|
[5498] | 487 | <!-- Download list of plugins -->
|
---|
[4166] | 488 | <loadresource property="plugins">
|
---|
[6955] | 489 | <url url="https://josm.openstreetmap.de/plugin"/>
|
---|
[4166] | 490 | <filterchain>
|
---|
| 491 | <linecontainsregexp negate="true">
|
---|
| 492 | <regexp pattern="^\t.*"/>
|
---|
| 493 | </linecontainsregexp>
|
---|
| 494 | <linecontainsregexp negate="true">
|
---|
| 495 | <regexp pattern="${deprecated-plugins}"/>
|
---|
| 496 | </linecontainsregexp>
|
---|
| 497 | <tokenfilter>
|
---|
| 498 | <replaceregex pattern="^.*;" replace="" flags="gi"/>
|
---|
| 499 | </tokenfilter>
|
---|
| 500 | </filterchain>
|
---|
[6133] | 501 | </loadresource>
|
---|
| 502 | <!-- Delete files that are not in plugin list (like old plugins) -->
|
---|
| 503 | <loadresource property="file-list">
|
---|
| 504 | <propertyresource name="plugins"/>
|
---|
| 505 | <filterchain>
|
---|
| 506 | <tokenfilter>
|
---|
| 507 | <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
|
---|
| 508 | </tokenfilter>
|
---|
| 509 | <striplinebreaks/>
|
---|
| 510 | <tokenfilter>
|
---|
| 511 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
| 512 | </tokenfilter>
|
---|
| 513 | </filterchain>
|
---|
| 514 | </loadresource>
|
---|
| 515 | <delete>
|
---|
| 516 | <restrict>
|
---|
| 517 | <fileset dir="${dir}"/>
|
---|
| 518 | <not>
|
---|
| 519 | <name regex="${file-list}"/>
|
---|
| 520 | </not>
|
---|
| 521 | </restrict>
|
---|
| 522 | </delete>
|
---|
| 523 | <!-- Download plugins -->
|
---|
[4166] | 524 | <copy todir="${dir}" flatten="true">
|
---|
| 525 | <resourcelist>
|
---|
| 526 | <string value="${plugins}"/>
|
---|
| 527 | </resourcelist>
|
---|
| 528 | </copy>
|
---|
| 529 | <!-- Check plugins -->
|
---|
[5498] | 530 | <as:build-signatures destfile="${dir}/api.sig">
|
---|
| 531 | <path>
|
---|
| 532 | <fileset file="dist/josm-custom-optimized.jar"/>
|
---|
| 533 | <fileset file="${java.home}/lib/rt.jar"/>
|
---|
| 534 | <fileset file="${java.home}/lib/jce.jar"/>
|
---|
| 535 | </path>
|
---|
[6133] | 536 | </as:build-signatures>
|
---|
[4166] | 537 | <as:check-signature signature="${dir}/api.sig">
|
---|
[7367] | 538 | <ignore classname="au.edu.*"/>
|
---|
| 539 | <ignore classname="au.com.*"/>
|
---|
| 540 | <ignore classname="com.*"/>
|
---|
[7934] | 541 | <ignore classname="de.miethxml.*"/>
|
---|
[8090] | 542 | <ignore classname="javafx.*"/>
|
---|
[7367] | 543 | <ignore classname="javax.*"/>
|
---|
| 544 | <ignore classname="jogamp.*"/>
|
---|
| 545 | <ignore classname="junit.*"/>
|
---|
| 546 | <ignore classname="net.sf.*"/>
|
---|
| 547 | <ignore classname="nu.xom.*"/>
|
---|
| 548 | <ignore classname="org.apache.*"/>
|
---|
| 549 | <ignore classname="org.codehaus.*"/>
|
---|
| 550 | <ignore classname="org.dom4j.*"/>
|
---|
| 551 | <ignore classname="org.hsqldb.*"/>
|
---|
| 552 | <ignore classname="org.ibex.*"/>
|
---|
[7934] | 553 | <ignore classname="org.iso_relax.*"/>
|
---|
[7367] | 554 | <ignore classname="org.jaitools.*"/>
|
---|
| 555 | <ignore classname="org.jaxen.*"/>
|
---|
| 556 | <ignore classname="org.jdom2.*"/>
|
---|
[4166] | 557 | <ignore classname="org.jgraph.*"/>
|
---|
[7367] | 558 | <ignore classname="org.joda.time.*"/>
|
---|
[4166] | 559 | <ignore classname="org.jvnet.staxex.*"/>
|
---|
[7367] | 560 | <ignore classname="org.kxml2.*"/>
|
---|
[8090] | 561 | <ignore classname="org.objectweb.*"/>
|
---|
[7367] | 562 | <ignore classname="org.python.*"/>
|
---|
| 563 | <ignore classname="org.slf4j.*"/>
|
---|
[8173] | 564 | <!-- plugins used by another ones -->
|
---|
[7494] | 565 | <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
|
---|
[7934] | 566 | <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
|
---|
[7494] | 567 | <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
|
---|
| 568 | <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
|
---|
| 569 | <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
|
---|
[4166] | 570 | <path path="${dir}"/>
|
---|
| 571 | </as:check-signature>
|
---|
| 572 | </target>
|
---|
[4838] | 573 |
|
---|
| 574 | <target name="findbugs" depends="dist">
|
---|
[6133] | 575 | <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
|
---|
[4838] | 576 | <path id="findbugs-classpath">
|
---|
| 577 | <fileset dir="tools/findbugs/">
|
---|
| 578 | <include name="*.jar"/>
|
---|
| 579 | </fileset>
|
---|
| 580 | </path>
|
---|
[6133] | 581 | <property name="findbugs-classpath" refid="findbugs-classpath"/>
|
---|
| 582 | <findbugs output="xml"
|
---|
[4838] | 583 | outputFile="findbugs-josm.xml"
|
---|
[6133] | 584 | classpath="${findbugs-classpath}"
|
---|
| 585 | pluginList=""
|
---|
| 586 | excludeFilter="tools/findbugs/josm-filter.xml"
|
---|
| 587 | effort="max"
|
---|
| 588 | >
|
---|
| 589 | <sourcePath path="${basedir}/src" />
|
---|
| 590 | <class location="${basedir}/dist/josm-custom.jar" />
|
---|
| 591 | </findbugs>
|
---|
[4838] | 592 | </target>
|
---|
[5323] | 593 | <target name="run" depends="dist">
|
---|
| 594 | <java jar="dist/josm-custom.jar" fork="true">
|
---|
| 595 | <arg value="--set=expert=true"/>
|
---|
| 596 | <arg value="--set=remotecontrol.enabled=true"/>
|
---|
| 597 | <arg value="--set=debug.edt-checker.enable=false"/>
|
---|
| 598 | <jvmarg value="-Djosm.home=/tmp/.josm/"/>
|
---|
| 599 | </java>
|
---|
| 600 | </target>
|
---|
[4166] | 601 | </project>
|
---|