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