[4166] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
| 2 | <!-- ** build.xml - main ant file for JOSM
|
---|
| 3 | **
|
---|
| 4 | ** To build run
|
---|
| 5 | ** ant clean
|
---|
| 6 | ** ant dist
|
---|
| 7 | ** This will create 'josm-custom.jar' in directory 'dist'. See also
|
---|
| 8 | ** https://josm.openstreetmap.de/wiki/CreateBuild
|
---|
| 9 | **
|
---|
| 10 | **
|
---|
| 11 | -->
|
---|
| 12 | <project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" basedir=".">
|
---|
| 13 | <property name="test.dir" value="test"/>
|
---|
| 14 | <property name="src.dir" value="src"/>
|
---|
| 15 | <property name="build.dir" value="build"/>
|
---|
| 16 | <!-- build parameter: compression level (ant -Dclevel=N)
|
---|
| 17 | N ranges from 0 (no compression) to 9 (maximum compression)
|
---|
| 18 | default: 9 -->
|
---|
| 19 | <condition property="clevel" value="${clevel}" else="9">
|
---|
| 20 | <isset property="clevel"/>
|
---|
| 21 | </condition>
|
---|
| 22 | <!-- Java classpath addition (all jar files to compile tests with this) -->
|
---|
| 23 | <path id="classpath">
|
---|
| 24 | <fileset dir="lib">
|
---|
| 25 | <include name="**/*.jar"/>
|
---|
| 26 | </fileset>
|
---|
| 27 | </path>
|
---|
| 28 | <!--
|
---|
| 29 | ** Used by Eclipse ant builder for updating
|
---|
| 30 | ** the REVISION file used by JOSM
|
---|
| 31 | -->
|
---|
| 32 | <target name="create-revision-eclipse">
|
---|
| 33 | <property name="revision.dir" value="bin"/>
|
---|
| 34 | <antcall target="create-revision"/>
|
---|
| 35 | </target>
|
---|
| 36 | <!--
|
---|
| 37 | ** Creates the REVISION file to be included in the distribution
|
---|
| 38 | -->
|
---|
| 39 | <target name="create-revision">
|
---|
| 40 | <property name="revision.dir" value="${build.dir}"/>
|
---|
| 41 | <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false">
|
---|
| 42 | <env key="LANG" value="C"/>
|
---|
| 43 | <arg value="info"/>
|
---|
| 44 | <arg value="--xml"/>
|
---|
| 45 | <arg value="."/>
|
---|
| 46 | </exec>
|
---|
| 47 | <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 48 | <delete file="REVISION.XML"/>
|
---|
| 49 | <tstamp>
|
---|
| 50 | <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
|
---|
| 51 | </tstamp>
|
---|
| 52 | <property name="version.entry.commit.revision" value="UNKNOWN"/>
|
---|
| 53 | <mkdir dir="${revision.dir}"/>
|
---|
| 54 | <echo file="${revision.dir}/REVISION">
|
---|
| 55 | # automatically generated by JOSM build.xml - do not edit
|
---|
| 56 | Revision: ${version.entry.commit.revision}
|
---|
| 57 | Is-Local-Build: true
|
---|
| 58 | Build-Date: ${build.tstamp}
|
---|
| 59 | </echo>
|
---|
| 60 | </target>
|
---|
| 61 | <target name="dist" depends="compile,create-revision">
|
---|
| 62 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
| 63 | <env key="LANG" value="C"/>
|
---|
| 64 | <arg value="info"/>
|
---|
| 65 | <arg value="--xml"/>
|
---|
| 66 | <arg value="."/>
|
---|
| 67 | </exec>
|
---|
| 68 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 69 | <delete file="REVISION"/>
|
---|
| 70 | <property name="version.entry.commit.revision" value="UNKNOWN"/>
|
---|
| 71 | <property name="version.entry.commit.date" value="UNKNOWN"/>
|
---|
| 72 | <echo>Revision ${version.entry.commit.revision}</echo>
|
---|
| 73 | <copy file="CONTRIBUTION" todir="build"/>
|
---|
| 74 | <copy file="README" todir="build"/>
|
---|
| 75 | <copy file="LICENSE" todir="build"/>
|
---|
| 76 | <!-- create josm-custom.jar -->
|
---|
| 77 | <delete file="dist/josm-custom.jar"/>
|
---|
| 78 | <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
|
---|
| 79 | <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
|
---|
| 80 | <manifest>
|
---|
| 81 | <attribute name="Main-class" value="JOSM"/>
|
---|
| 82 | <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
|
---|
| 83 | <attribute name="Main-Date" value="${version.entry.commit.date}"/>
|
---|
| 84 | </manifest>
|
---|
| 85 | <zipfileset dir="images" prefix="images"/>
|
---|
| 86 | <zipfileset dir="data" prefix="data"/>
|
---|
| 87 | <zipfileset dir="styles" prefix="styles"/>
|
---|
| 88 | <zipfileset dir="src/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
|
---|
| 89 | <!-- All jar files necessary to run only JOSM (no tests) -->
|
---|
[4231] | 90 | <!-- <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar"/> -->
|
---|
| 91 | <!-- <zipfileset src="lib/signpost-core-1.2.1.1.jar"/> -->
|
---|
[4166] | 92 | </jar>
|
---|
| 93 | </target>
|
---|
| 94 | <target name="distmac" depends="dist">
|
---|
| 95 | <!-- modify MacOS X Info.plist file to hold the SVN version number -->
|
---|
| 96 | <copy file="macosx/JOSM.app/Contents/Info.plist" todir="build"/>
|
---|
| 97 | <replace file="build/Info.plist" token="@SVNVersion@" value="${version.entry.commit.revision}"/>
|
---|
| 98 | <!-- create ZIP file with MacOS X application bundle -->
|
---|
| 99 | <zip destfile="dist/josm-custom-macosx.zip" update="true">
|
---|
| 100 | <zipfileset dir="build" includes="CONTRIBUTION README LICENSE"/>
|
---|
| 101 | <zipfileset dir="macosx" includes="JOSM.app/Contents JOSM.app/Contents/MacOS JOSM.app/Contents/Resources JOSM.app/Contents/Resources/Java JOSM.app/Contents/PkgInfo JOSM.app/Contents/Resources/JOSM.icns"/>
|
---|
| 102 | <zipfileset dir="build" includes="Info.plist" prefix="JOSM.app/Contents"/>
|
---|
| 103 | <zipfileset dir="dist" includes="josm-custom.jar" prefix="JOSM.app/Contents/Resources/Java"/>
|
---|
| 104 | <zipfileset dir="macosx" includes="JOSM.app/Contents/MacOS/JOSM" filemode="755"/>
|
---|
| 105 | </zip>
|
---|
| 106 | </target>
|
---|
| 107 | <target name="compile" depends="init">
|
---|
[4232] | 108 | <javac srcdir="src" classpathref="classpath" destdir="build" target="1.5" source="1.5" debug="on" encoding="UTF-8">
|
---|
[4166] | 109 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 110 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 111 | </javac>
|
---|
| 112 | </target>
|
---|
| 113 | <target name="init">
|
---|
| 114 | <mkdir dir="build"/>
|
---|
| 115 | <mkdir dir="dist"/>
|
---|
| 116 | </target>
|
---|
| 117 | <target name="clean">
|
---|
| 118 | <delete dir="build"/>
|
---|
| 119 | <delete dir="dist"/>
|
---|
| 120 | </target>
|
---|
| 121 | <target name="javacc">
|
---|
| 122 | <exec executable="javacc">
|
---|
| 123 | <arg value="-debug_parser=false"/>
|
---|
| 124 | <arg value="-debug_lookahead=false"/>
|
---|
| 125 | <arg value="-debug_token_manager=false"/>
|
---|
| 126 | <arg value="-output_directory=${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss/parser"/>
|
---|
| 127 | <arg value="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss/parser/MapCSSParser.jj"/>
|
---|
| 128 | </exec>
|
---|
| 129 | </target>
|
---|
| 130 | <path id="test.classpath">
|
---|
| 131 | <fileset dir="${test.dir}/lib">
|
---|
| 132 | <include name="**/*.jar"/>
|
---|
| 133 | </fileset>
|
---|
| 134 | <fileset dir="lib">
|
---|
| 135 | <include name="**/*.jar"/>
|
---|
| 136 | </fileset>
|
---|
| 137 | <pathelement path="dist/josm-custom.jar"/>
|
---|
| 138 | </path>
|
---|
| 139 | <target name="test-init">
|
---|
| 140 | <mkdir dir="${test.dir}/${build.dir}"/>
|
---|
| 141 | <mkdir dir="${test.dir}/report"/>
|
---|
| 142 | </target>
|
---|
| 143 | <target name="test-clean">
|
---|
| 144 | <delete dir="${test.dir}/${build.dir}"/>
|
---|
| 145 | <delete dir="${test.dir}/report"/>
|
---|
| 146 | </target>
|
---|
| 147 | <target name="test-compile" depends="test-init,dist">
|
---|
| 148 | <javac srcdir="${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}" target="1.5" source="1.5" debug="on" encoding="UTF-8">
|
---|
| 149 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 150 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 151 | </javac>
|
---|
| 152 | <javac srcdir="${test.dir}/functional" classpathref="test.classpath" destdir="${test.dir}/${build.dir}" target="1.5" source="1.5" debug="on" encoding="UTF-8">
|
---|
| 153 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 154 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 155 | </javac>
|
---|
| 156 | </target>
|
---|
| 157 | <target name="test" depends="test-compile">
|
---|
| 158 | <junit printsummary="yes">
|
---|
| 159 | <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
|
---|
| 160 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
| 161 | <classpath>
|
---|
| 162 | <path refid="test.classpath"/>
|
---|
| 163 | <pathelement path="${test.dir}/${build.dir}"/>
|
---|
| 164 | <pathelement path="${test.dir}/config"/>
|
---|
| 165 | </classpath>
|
---|
| 166 | <formatter type="plain"/>
|
---|
| 167 | <formatter type="xml"/>
|
---|
| 168 | <batchtest fork="yes" todir="${test.dir}/report">
|
---|
| 169 | <fileset dir="${test.dir}/unit" includes="**/*.java"/>
|
---|
| 170 | </batchtest>
|
---|
| 171 | </junit>
|
---|
| 172 | </target>
|
---|
| 173 | <target name="test-html" depends="test" description="Generate HTML test reports">
|
---|
| 174 | <!-- May require additional ant dependencies like ant-trax package -->
|
---|
| 175 | <junitreport todir="${test.dir}/report">
|
---|
| 176 | <fileset dir="${test.dir}/report">
|
---|
| 177 | <include name="TEST-*.xml"/>
|
---|
| 178 | </fileset>
|
---|
| 179 | <report todir="${test.dir}/report/html"/>
|
---|
| 180 | </junitreport>
|
---|
| 181 | </target>
|
---|
| 182 | <target name="dist-optimized" depends="dist">
|
---|
| 183 | <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
|
---|
| 184 | <proguard>
|
---|
| 185 | -injars dist/josm-custom.jar
|
---|
| 186 | -outjars dist/josm-custom-optimized.jar
|
---|
| 187 |
|
---|
| 188 | -libraryjars ${java.home}/lib/rt.jar
|
---|
| 189 | -libraryjars ${java.home}/lib/jce.jar
|
---|
| 190 |
|
---|
| 191 | -dontoptimize
|
---|
| 192 | -dontobfuscate
|
---|
| 193 |
|
---|
| 194 | -dontskipnonpubliclibraryclasses
|
---|
| 195 |
|
---|
| 196 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
| 197 | public static void main(java.lang.String[]);
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 | -keep class JOSM
|
---|
| 201 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
| 202 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
| 203 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
| 204 |
|
---|
| 205 | -keepclassmembers enum * {
|
---|
| 206 | public static **[] values();
|
---|
| 207 | public static ** valueOf(java.lang.String);
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | -keepclassmembers class * {
|
---|
| 211 | public protected *;
|
---|
| 212 | }
|
---|
| 213 | </proguard>
|
---|
| 214 | </target>
|
---|
| 215 | <target name="check-plugins" depends="dist-optimized">
|
---|
| 216 | <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
|
---|
| 217 | <local name="dir"/>
|
---|
| 218 | <local name="plugins"/>
|
---|
| 219 | <property name="dir" value="plugin-check"/>
|
---|
| 220 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
|
---|
| 221 | <classpath path="tools/animal-sniffer-ant-tasks-1.5.jar"/>
|
---|
| 222 | </typedef>
|
---|
| 223 | <delete dir="${dir}"/>
|
---|
| 224 | <mkdir dir="${dir}"/>
|
---|
| 225 | <as:build-signatures destfile="${dir}/api.sig">
|
---|
| 226 | <path>
|
---|
| 227 | <fileset file="dist/josm-custom-optimized.jar"/>
|
---|
| 228 | <fileset file="${java.home}/lib/rt.jar"/>
|
---|
| 229 | <fileset file="${java.home}/lib/jce.jar"/>
|
---|
| 230 | </path>
|
---|
| 231 | </as:build-signatures>
|
---|
| 232 | <!-- List of deprecated plugins -->
|
---|
| 233 | <loadfile property="deprecated-plugins" srcFile="src/org/openstreetmap/josm/plugins/PluginHandler.java">
|
---|
| 234 | <filterchain>
|
---|
| 235 | <linecontains>
|
---|
| 236 | <contains value="new DeprecatedPlugin("/>
|
---|
| 237 | </linecontains>
|
---|
| 238 | <tokenfilter>
|
---|
| 239 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
|
---|
| 240 | </tokenfilter>
|
---|
| 241 | <striplinebreaks/>
|
---|
| 242 | <tokenfilter>
|
---|
| 243 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
| 244 | </tokenfilter>
|
---|
| 245 | </filterchain>
|
---|
| 246 | </loadfile>
|
---|
| 247 | <!-- Download plugins -->
|
---|
| 248 | <loadresource property="plugins">
|
---|
| 249 | <url url="http://josm.openstreetmap.de/plugin"/>
|
---|
| 250 | <filterchain>
|
---|
| 251 | <linecontainsregexp negate="true">
|
---|
| 252 | <regexp pattern="^\t.*"/>
|
---|
| 253 | </linecontainsregexp>
|
---|
| 254 | <linecontainsregexp negate="true">
|
---|
| 255 | <regexp pattern="${deprecated-plugins}"/>
|
---|
| 256 | </linecontainsregexp>
|
---|
| 257 | <tokenfilter>
|
---|
| 258 | <replaceregex pattern="^.*;" replace="" flags="gi"/>
|
---|
| 259 | </tokenfilter>
|
---|
| 260 | </filterchain>
|
---|
| 261 | </loadresource>
|
---|
| 262 | <copy todir="${dir}" flatten="true">
|
---|
| 263 | <resourcelist>
|
---|
| 264 | <string value="${plugins}"/>
|
---|
| 265 | </resourcelist>
|
---|
| 266 | </copy>
|
---|
| 267 | <!-- Check plugins -->
|
---|
| 268 | <as:check-signature signature="${dir}/api.sig">
|
---|
| 269 | <ignore classname="org.jgraph.*"/>
|
---|
| 270 | <ignore classname="com.touchgraph.*"/>
|
---|
| 271 | <ignore classname="com.sun.xml.fastinfoset.*"/>
|
---|
| 272 | <ignore classname="javax.jms.*"/>
|
---|
| 273 | <ignore classname="org.jvnet.staxex.*"/>
|
---|
| 274 | <ignore classname="javax.mail.*"/>
|
---|
| 275 | <ignore classname="com.sun.jdmk.*"/>
|
---|
| 276 | <ignore classname="org.apache.avalon.framework.logger.Logger"/>
|
---|
| 277 | <ignore classname="org.apache.log.*"/>
|
---|
| 278 | <ignore classname="junit.*"/>
|
---|
| 279 | <path path="${dir}"/>
|
---|
| 280 | </as:check-signature>
|
---|
| 281 | </target>
|
---|
| 282 | </project>
|
---|