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