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