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