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