[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 | <schemavalidate file="styles/standard/elemstyles.xml" >
|
---|
| 106 | <schema namespace="http://josm.openstreetmap.de/mappaint-style-1.0" file="data/mappaint-style.xsd" />
|
---|
| 107 | </schemavalidate>
|
---|
| 108 | </target>
|
---|
[6540] | 109 | <!--
|
---|
| 110 | ** Main target that builds JOSM and checks XML against schemas
|
---|
| 111 | -->
|
---|
[6208] | 112 | <target name="dist" depends="compile,create-revision,check-schemas">
|
---|
[4166] | 113 | <echo>Revision ${version.entry.commit.revision}</echo>
|
---|
| 114 | <copy file="CONTRIBUTION" todir="build"/>
|
---|
| 115 | <copy file="README" todir="build"/>
|
---|
| 116 | <copy file="LICENSE" todir="build"/>
|
---|
| 117 | <!-- create josm-custom.jar -->
|
---|
| 118 | <delete file="dist/josm-custom.jar"/>
|
---|
| 119 | <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
|
---|
| 120 | <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
|
---|
| 121 | <manifest>
|
---|
| 122 | <attribute name="Main-class" value="JOSM"/>
|
---|
| 123 | <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
|
---|
| 124 | <attribute name="Main-Date" value="${version.entry.commit.date}"/>
|
---|
[6341] | 125 | <attribute name="Permissions" value="all-permissions"/>
|
---|
| 126 | <attribute name="Codebase" value="josm.openstreetmap.de"/>
|
---|
| 127 | <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
|
---|
[4166] | 128 | </manifest>
|
---|
| 129 | <zipfileset dir="images" prefix="images"/>
|
---|
| 130 | <zipfileset dir="data" prefix="data"/>
|
---|
| 131 | <zipfileset dir="styles" prefix="styles"/>
|
---|
[7133] | 132 | <zipfileset dir="${src.dir}/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
|
---|
[4166] | 133 | <!-- All jar files necessary to run only JOSM (no tests) -->
|
---|
[4231] | 134 | <!-- <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar"/> -->
|
---|
| 135 | <!-- <zipfileset src="lib/signpost-core-1.2.1.1.jar"/> -->
|
---|
[4166] | 136 | </jar>
|
---|
| 137 | </target>
|
---|
[7001] | 138 | <!-- Mac OS X target -->
|
---|
| 139 | <target name="mac">
|
---|
[6217] | 140 | <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
|
---|
| 141 | <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="tools/appbundler-1.0ea.jar"/>
|
---|
| 142 | <!-- create MacOS X application bundle -->
|
---|
[6945] | 143 | <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
|
---|
[6216] | 144 | mainclassname="org.openstreetmap.josm.gui.MainApplication"
|
---|
[6217] | 145 | copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
|
---|
[6216] | 146 | applicationCategory="public.app-category.utilities"
|
---|
| 147 | shortversion="${version.entry.commit.revision} SVN"
|
---|
| 148 | version="${version.entry.commit.revision} SVN"
|
---|
| 149 | icon="macosx/JOSM.app/Contents/Resources/JOSM.icns"
|
---|
[6217] | 150 | highResolutionCapable="true">
|
---|
[6216] | 151 |
|
---|
| 152 | <arch name="x86_64"/>
|
---|
| 153 | <arch name="i386"/>
|
---|
| 154 |
|
---|
[6945] | 155 | <classpath file="${bundle.jar}"/>
|
---|
[6216] | 156 |
|
---|
[7287] | 157 | <option value="-Xmx1024m"/>
|
---|
[6216] | 158 |
|
---|
| 159 | <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
|
---|
| 160 | <option value="-Xdock:name=JOSM"/>
|
---|
| 161 |
|
---|
| 162 | <!-- OSX specific options, optional -->
|
---|
| 163 | <option value="-Dapple.laf.useScreenMenuBar=true"/>
|
---|
| 164 | <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
|
---|
| 165 | <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
|
---|
| 166 | <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
|
---|
| 167 | <option value="-Dcom.apple.smallTabs=true"/>
|
---|
| 168 | </bundleapp>
|
---|
[6217] | 169 |
|
---|
| 170 | <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
|
---|
| 171 | <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/>
|
---|
| 172 |
|
---|
[6945] | 173 | <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
|
---|
[7287] | 174 | <!-- remove empty CFBundleDocumentTypes definition -->
|
---|
| 175 | <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/>
|
---|
| 176 | <!-- insert our own keys -->
|
---|
| 177 | <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" />
|
---|
[6217] | 178 | </xmltask>
|
---|
| 179 |
|
---|
[6216] | 180 | <!-- create ZIP file with MacOS X application bundle -->
|
---|
[7001] | 181 | <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
|
---|
[6945] | 182 | <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
|
---|
| 183 | <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
|
---|
[6216] | 184 | </zip>
|
---|
[6217] | 185 | </target>
|
---|
[7001] | 186 | <target name="distmac" depends="dist">
|
---|
| 187 | <antcall target="mac">
|
---|
[6945] | 188 | <param name="bundle.outdir" value="dist"/>
|
---|
| 189 | <param name="bundle.jar" value="dist/josm-custom.jar"/>
|
---|
| 190 | </antcall>
|
---|
| 191 | </target>
|
---|
[5392] | 192 | <target name="javacc" depends="init" unless="javacc.notRequired">
|
---|
[4252] | 193 | <mkdir dir="${mapcss.dir}/parsergen"/>
|
---|
[4257] | 194 | <exec append="false" executable="java" failifexecutionfails="true">
|
---|
| 195 | <arg value="-cp"/>
|
---|
| 196 | <arg value="${javacc.home}/javacc.jar"/>
|
---|
| 197 | <arg value="javacc"/>
|
---|
[7043] | 198 | <arg value="-DEBUG_PARSER=false"/>
|
---|
| 199 | <arg value="-DEBUG_TOKEN_MANAGER=false"/>
|
---|
[7001] | 200 | <arg value="-JDK_VERSION=1.7"/>
|
---|
[6446] | 201 | <arg value="-GRAMMAR_ENCODING=UTF-8"/>
|
---|
[4257] | 202 | <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
|
---|
| 203 | <arg value="${mapcss.dir}/MapCSSParser.jj"/>
|
---|
| 204 | </exec>
|
---|
[4252] | 205 | </target>
|
---|
[7209] | 206 | <target name="-jaxb_win" if="isWindows">
|
---|
| 207 | <property name="xjc" value="${java.home}\..\bin\xjc.exe" />
|
---|
[7133] | 208 | </target>
|
---|
[7209] | 209 | <target name="-jaxb_nix" unless="isWindows">
|
---|
| 210 | <property name="xjc" value="${java.home}/../bin/xjc" />
|
---|
| 211 | </target>
|
---|
| 212 | <target name="jaxb" depends="init, -jaxb_win, -jaxb_nix" unless="jaxb.notRequired">
|
---|
| 213 | <exec executable="${xjc}" failonerror="true">
|
---|
| 214 | <arg value="-d"/>
|
---|
| 215 | <arg value="${src.dir}"/>
|
---|
| 216 | <arg value="-encoding"/>
|
---|
| 217 | <arg value="UTF-8"/>
|
---|
| 218 | <arg value="data_nodist/wms-cache.xsd"/>
|
---|
| 219 | </exec>
|
---|
| 220 | </target>
|
---|
[7133] | 221 | <target name="compile" depends="init,javacc,jaxb">
|
---|
[7068] | 222 | <!-- COTS -->
|
---|
[7133] | 223 | <javac srcdir="${src.dir}" includes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**" nowarn="on"
|
---|
[7068] | 224 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="iso-8859-1">
|
---|
[7019] | 225 | <!-- get rid of "internal proprietary API" warning -->
|
---|
[7068] | 226 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
[7019] | 227 | </javac>
|
---|
| 228 | <!-- JMapViewer/JOSM -->
|
---|
[7133] | 229 | <javac srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/codec/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
|
---|
[7068] | 230 | destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
|
---|
[7021] | 231 | <compilerarg value="-Xlint:cast"/>
|
---|
[4166] | 232 | <compilerarg value="-Xlint:deprecation"/>
|
---|
[7022] | 233 | <compilerarg value="-Xlint:dep-ann"/>
|
---|
| 234 | <compilerarg value="-Xlint:divzero"/>
|
---|
| 235 | <compilerarg value="-Xlint:empty"/>
|
---|
| 236 | <compilerarg value="-Xlint:finally"/>
|
---|
| 237 | <compilerarg value="-Xlint:overrides"/>
|
---|
| 238 | <!--<compilerarg value="-Xlint:rawtypes"/>-->
|
---|
| 239 | <compilerarg value="-Xlint:static"/>
|
---|
| 240 | <compilerarg value="-Xlint:try"/>
|
---|
[4166] | 241 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 242 | </javac>
|
---|
[6756] | 243 | <copy todir="build" failonerror="no" includeemptydirs="no">
|
---|
| 244 | <fileset dir="resources"/>
|
---|
| 245 | </copy>
|
---|
[4166] | 246 | </target>
|
---|
| 247 | <target name="init">
|
---|
[5392] | 248 | <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
|
---|
| 249 | <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
|
---|
| 250 | </uptodate>
|
---|
[7215] | 251 | <uptodate property="jaxb.notRequired" targetfile="${src.dir}/org/openstreetmap/josm/data/imagery/types/package-info.java" >
|
---|
| 252 | <srcfiles dir="data_nodist" includes="wms-cache.xsd"/>
|
---|
| 253 | </uptodate>
|
---|
[4166] | 254 | <mkdir dir="build"/>
|
---|
| 255 | <mkdir dir="dist"/>
|
---|
| 256 | </target>
|
---|
[5263] | 257 | <target name="javadoc">
|
---|
| 258 | <javadoc destdir="javadoc"
|
---|
[7133] | 259 | sourcepath="${src.dir}"
|
---|
[6830] | 260 | encoding="UTF-8"
|
---|
[5263] | 261 | packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
|
---|
| 262 | windowtitle="JOSM"
|
---|
| 263 | use="true"
|
---|
[5481] | 264 | private="true"
|
---|
[5263] | 265 | linksource="true"
|
---|
| 266 | author="false">
|
---|
[7001] | 267 | <link href="http://docs.oracle.com/javase/7/docs/api"/>
|
---|
[5263] | 268 | <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
|
---|
[6955] | 269 | <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
|
---|
[5263] | 270 | </javadoc>
|
---|
| 271 | </target>
|
---|
[4166] | 272 | <target name="clean">
|
---|
| 273 | <delete dir="build"/>
|
---|
| 274 | <delete dir="dist"/>
|
---|
[4252] | 275 | <delete dir="${mapcss.dir}/parsergen"/>
|
---|
[7133] | 276 | <delete dir="${imagerytypes.dir}"/>
|
---|
[4166] | 277 | </target>
|
---|
| 278 | <path id="test.classpath">
|
---|
| 279 | <fileset dir="${test.dir}/lib">
|
---|
| 280 | <include name="**/*.jar"/>
|
---|
| 281 | </fileset>
|
---|
| 282 | <fileset dir="lib">
|
---|
| 283 | <include name="**/*.jar"/>
|
---|
| 284 | </fileset>
|
---|
| 285 | <pathelement path="dist/josm-custom.jar"/>
|
---|
[7208] | 286 | <pathelement path="tools/groovy-all-2.3.2.jar"/>
|
---|
[4166] | 287 | </path>
|
---|
[7068] | 288 | <macrodef name="init-test-preferences">
|
---|
| 289 | <attribute name="testfamily"/>
|
---|
| 290 | <sequential>
|
---|
| 291 | <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
|
---|
| 292 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
| 293 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
| 294 | </sequential>
|
---|
| 295 | </macrodef>
|
---|
[4166] | 296 | <target name="test-init">
|
---|
[6121] | 297 | <mkdir dir="${test.dir}/build"/>
|
---|
[7068] | 298 | <mkdir dir="${test.dir}/build/unit"/>
|
---|
| 299 | <mkdir dir="${test.dir}/build/functional"/>
|
---|
| 300 | <mkdir dir="${test.dir}/build/performance"/>
|
---|
[4166] | 301 | <mkdir dir="${test.dir}/report"/>
|
---|
[7068] | 302 | <init-test-preferences testfamily="unit"/>
|
---|
| 303 | <init-test-preferences testfamily="functional"/>
|
---|
| 304 | <init-test-preferences testfamily="performance"/>
|
---|
[4166] | 305 | </target>
|
---|
| 306 | <target name="test-clean">
|
---|
[6121] | 307 | <delete dir="${test.dir}/build"/>
|
---|
[4166] | 308 | <delete dir="${test.dir}/report"/>
|
---|
[6133] | 309 | <delete file="${test.dir}/jacoco.exec" />
|
---|
[7068] | 310 | <delete file="${test.dir}/config/unit-josm.home/preferences.xml" />
|
---|
| 311 | <delete file="${test.dir}/config/functional-josm.home/preferences.xml" />
|
---|
| 312 | <delete file="${test.dir}/config/performance-josm.home/preferences.xml" />
|
---|
| 313 | <delete dir="${test.dir}/config/unit-josm.home/cache" failonerror="false"/>
|
---|
| 314 | <delete dir="${test.dir}/config/functional-josm.home/cache" failonerror="false"/>
|
---|
| 315 | <delete dir="${test.dir}/config/performance-josm.home/cache" failonerror="false"/>
|
---|
[4166] | 316 | </target>
|
---|
[7068] | 317 | <macrodef name="call-groovyc">
|
---|
| 318 | <attribute name="testfamily"/>
|
---|
| 319 | <element name="cp-elements"/>
|
---|
| 320 | <sequential>
|
---|
| 321 | <groovyc srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}" encoding="UTF-8">
|
---|
| 322 | <classpath>
|
---|
| 323 | <cp-elements/>
|
---|
| 324 | </classpath>
|
---|
| 325 | <javac target="1.7" source="1.7" debug="on">
|
---|
| 326 | <compilerarg value="-Xlint:all"/>
|
---|
| 327 | <compilerarg value="-Xlint:-serial"/>
|
---|
| 328 | </javac>
|
---|
| 329 | </groovyc>
|
---|
| 330 | </sequential>
|
---|
| 331 | </macrodef>
|
---|
[4166] | 332 | <target name="test-compile" depends="test-init,dist">
|
---|
[7208] | 333 | <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.3.2.jar"/>
|
---|
[7068] | 334 | <call-groovyc testfamily="unit">
|
---|
| 335 | <cp-elements>
|
---|
| 336 | <path refid="test.classpath"/>
|
---|
| 337 | </cp-elements>
|
---|
| 338 | </call-groovyc>
|
---|
| 339 | <call-groovyc testfamily="functional">
|
---|
| 340 | <cp-elements>
|
---|
| 341 | <path refid="test.classpath"/>
|
---|
| 342 | <pathelement path="${test.dir}/build/unit"/>
|
---|
| 343 | </cp-elements>
|
---|
| 344 | </call-groovyc>
|
---|
| 345 | <call-groovyc testfamily="performance">
|
---|
| 346 | <cp-elements>
|
---|
| 347 | <path refid="test.classpath"/>
|
---|
| 348 | <pathelement path="${test.dir}/build/unit"/>
|
---|
| 349 | </cp-elements>
|
---|
| 350 | </call-groovyc>
|
---|
[4166] | 351 | </target>
|
---|
[7068] | 352 | <macrodef name="call-junit">
|
---|
| 353 | <attribute name="testfamily"/>
|
---|
| 354 | <sequential>
|
---|
| 355 | <echo message="Running @{testfamily} tests with JUnit"/>
|
---|
| 356 | <jacoco:coverage destfile="${test.dir}/jacoco.exec">
|
---|
| 357 | <junit printsummary="yes" fork="true" forkmode="once">
|
---|
| 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>
|
---|
| 410 | -injars dist/josm-custom.jar
|
---|
| 411 | -outjars dist/josm-custom-optimized.jar
|
---|
| 412 |
|
---|
| 413 | -libraryjars ${java.home}/lib/rt.jar
|
---|
| 414 | -libraryjars ${java.home}/lib/jce.jar
|
---|
| 415 |
|
---|
| 416 | -dontoptimize
|
---|
| 417 | -dontobfuscate
|
---|
| 418 |
|
---|
[4730] | 419 | # These options probably are not necessary (and make processing a bit slower)
|
---|
[4166] | 420 | -dontskipnonpubliclibraryclasses
|
---|
[4730] | 421 | -dontskipnonpubliclibraryclassmembers
|
---|
[4166] | 422 |
|
---|
| 423 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
| 424 | public static void main(java.lang.String[]);
|
---|
| 425 | }
|
---|
[4730] | 426 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
|
---|
[4166] | 427 |
|
---|
| 428 | -keep class JOSM
|
---|
| 429 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
| 430 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
[4730] | 431 | -keep class org.openstreetmap.josm.data.imagery.types.Adapter1
|
---|
| 432 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
[4166] | 433 |
|
---|
| 434 | -keepclassmembers enum * {
|
---|
| 435 | public static **[] values();
|
---|
| 436 | public static ** valueOf(java.lang.String);
|
---|
| 437 | }
|
---|
| 438 |
|
---|
[4730] | 439 | # Keep unused public methods (can be useful for plugins)
|
---|
[4166] | 440 | -keepclassmembers class * {
|
---|
| 441 | public protected *;
|
---|
| 442 | }
|
---|
[4838] | 443 |
|
---|
[4730] | 444 | # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'. This notes should not be a problem as we don't use obfuscation
|
---|
| 445 | -dontnote
|
---|
[6133] | 446 | </proguard>
|
---|
[4166] | 447 | </target>
|
---|
| 448 | <target name="check-plugins" depends="dist-optimized">
|
---|
| 449 | <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
|
---|
| 450 | <local name="dir"/>
|
---|
| 451 | <local name="plugins"/>
|
---|
| 452 | <property name="dir" value="plugin-check"/>
|
---|
| 453 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
|
---|
[5498] | 454 | <classpath path="tools/animal-sniffer-ant-tasks-1.8.jar"/>
|
---|
[4166] | 455 | </typedef>
|
---|
| 456 | <mkdir dir="${dir}"/>
|
---|
| 457 | <!-- List of deprecated plugins -->
|
---|
[7133] | 458 | <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
|
---|
[4166] | 459 | <filterchain>
|
---|
| 460 | <linecontains>
|
---|
| 461 | <contains value="new DeprecatedPlugin("/>
|
---|
| 462 | </linecontains>
|
---|
| 463 | <tokenfilter>
|
---|
| 464 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
|
---|
| 465 | </tokenfilter>
|
---|
| 466 | <striplinebreaks/>
|
---|
| 467 | <tokenfilter>
|
---|
| 468 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
| 469 | </tokenfilter>
|
---|
| 470 | </filterchain>
|
---|
| 471 | </loadfile>
|
---|
[5498] | 472 | <!-- Download list of plugins -->
|
---|
[4166] | 473 | <loadresource property="plugins">
|
---|
[6955] | 474 | <url url="https://josm.openstreetmap.de/plugin"/>
|
---|
[4166] | 475 | <filterchain>
|
---|
| 476 | <linecontainsregexp negate="true">
|
---|
| 477 | <regexp pattern="^\t.*"/>
|
---|
| 478 | </linecontainsregexp>
|
---|
| 479 | <linecontainsregexp negate="true">
|
---|
| 480 | <regexp pattern="${deprecated-plugins}"/>
|
---|
| 481 | </linecontainsregexp>
|
---|
| 482 | <tokenfilter>
|
---|
| 483 | <replaceregex pattern="^.*;" replace="" flags="gi"/>
|
---|
| 484 | </tokenfilter>
|
---|
| 485 | </filterchain>
|
---|
[6133] | 486 | </loadresource>
|
---|
| 487 | <!-- Delete files that are not in plugin list (like old plugins) -->
|
---|
| 488 | <loadresource property="file-list">
|
---|
| 489 | <propertyresource name="plugins"/>
|
---|
| 490 | <filterchain>
|
---|
| 491 | <tokenfilter>
|
---|
| 492 | <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
|
---|
| 493 | </tokenfilter>
|
---|
| 494 | <striplinebreaks/>
|
---|
| 495 | <tokenfilter>
|
---|
| 496 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
| 497 | </tokenfilter>
|
---|
| 498 | </filterchain>
|
---|
| 499 | </loadresource>
|
---|
| 500 | <delete>
|
---|
| 501 | <restrict>
|
---|
| 502 | <fileset dir="${dir}"/>
|
---|
| 503 | <not>
|
---|
| 504 | <name regex="${file-list}"/>
|
---|
| 505 | </not>
|
---|
| 506 | </restrict>
|
---|
| 507 | </delete>
|
---|
| 508 | <!-- Download plugins -->
|
---|
[4166] | 509 | <copy todir="${dir}" flatten="true">
|
---|
| 510 | <resourcelist>
|
---|
| 511 | <string value="${plugins}"/>
|
---|
| 512 | </resourcelist>
|
---|
| 513 | </copy>
|
---|
| 514 | <!-- Check plugins -->
|
---|
[5498] | 515 | <as:build-signatures destfile="${dir}/api.sig">
|
---|
| 516 | <path>
|
---|
| 517 | <fileset file="dist/josm-custom-optimized.jar"/>
|
---|
| 518 | <fileset file="${java.home}/lib/rt.jar"/>
|
---|
| 519 | <fileset file="${java.home}/lib/jce.jar"/>
|
---|
| 520 | </path>
|
---|
[6133] | 521 | </as:build-signatures>
|
---|
[4166] | 522 | <as:check-signature signature="${dir}/api.sig">
|
---|
| 523 | <ignore classname="org.jgraph.*"/>
|
---|
| 524 | <ignore classname="com.touchgraph.*"/>
|
---|
| 525 | <ignore classname="com.sun.xml.fastinfoset.*"/>
|
---|
| 526 | <ignore classname="javax.jms.*"/>
|
---|
| 527 | <ignore classname="org.jvnet.staxex.*"/>
|
---|
| 528 | <ignore classname="javax.mail.*"/>
|
---|
| 529 | <ignore classname="com.sun.jdmk.*"/>
|
---|
| 530 | <ignore classname="org.apache.avalon.framework.logger.Logger"/>
|
---|
| 531 | <ignore classname="org.apache.log.*"/>
|
---|
| 532 | <ignore classname="junit.*"/>
|
---|
| 533 | <path path="${dir}"/>
|
---|
| 534 | </as:check-signature>
|
---|
| 535 | </target>
|
---|
[4838] | 536 |
|
---|
| 537 | <target name="findbugs" depends="dist">
|
---|
[6133] | 538 | <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
|
---|
[4838] | 539 | <path id="findbugs-classpath">
|
---|
| 540 | <fileset dir="tools/findbugs/">
|
---|
| 541 | <include name="*.jar"/>
|
---|
| 542 | </fileset>
|
---|
| 543 | </path>
|
---|
[6133] | 544 | <property name="findbugs-classpath" refid="findbugs-classpath"/>
|
---|
| 545 | <findbugs output="xml"
|
---|
[4838] | 546 | outputFile="findbugs-josm.xml"
|
---|
[6133] | 547 | classpath="${findbugs-classpath}"
|
---|
| 548 | pluginList=""
|
---|
| 549 | excludeFilter="tools/findbugs/josm-filter.xml"
|
---|
| 550 | effort="max"
|
---|
| 551 | >
|
---|
| 552 | <sourcePath path="${basedir}/src" />
|
---|
| 553 | <class location="${basedir}/dist/josm-custom.jar" />
|
---|
| 554 | </findbugs>
|
---|
[4838] | 555 | </target>
|
---|
[5323] | 556 | <target name="run" depends="dist">
|
---|
| 557 | <java jar="dist/josm-custom.jar" fork="true">
|
---|
| 558 | <arg value="--set=expert=true"/>
|
---|
| 559 | <arg value="--set=remotecontrol.enabled=true"/>
|
---|
| 560 | <arg value="--set=debug.edt-checker.enable=false"/>
|
---|
| 561 | <jvmarg value="-Djosm.home=/tmp/.josm/"/>
|
---|
| 562 | </java>
|
---|
| 563 | </target>
|
---|
[4838] | 564 |
|
---|
[4166] | 565 | </project>
|
---|