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