source: josm/trunk/build.xml@ 4022

Last change on this file since 4022 was 3875, checked in by stoecker, 14 years ago

remove non-offical styles

File size: 10.8 KB
RevLine 
[3162]1<!-- ** build.xml - main ant file for JOSM
[2369]2**
3** To build run
4** ant clean
5** ant dist
[3091]6** This will create 'josm-custom.jar' in directory 'dist'. See also
[2369]7** https://josm.openstreetmap.de/wiki/CreateBuild
[3091]8**
9**
[2369]10-->
[3162]11<project name="josm" default="dist" basedir="." xmlns:as="antlib:org.codehaus.mojo.animal_sniffer">
[1751]12 <property name="test.dir" value="test" />
13 <property name="src.dir" value="src" />
14 <property name="build.dir" value="build"/>
[2618]15 <!-- build parameter: compression level (ant -Dclevel=N)
[2507]16 N ranges from 0 (no compression) to 9 (maximum compression)
17 default: 9 -->
[2618]18 <condition property="clevel" value="${clevel}" else="9">
19 <isset property="clevel" />
20 </condition>
[1751]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>
[2453]28
[2618]29
[2358]30 <!--
[3091]31 ** Used by Eclipse ant builder for updating
[2453]32 ** the REVISION file used by JOSM
[2618]33 -->
[2453]34 <target name="create-revision-eclipse">
35 <property name="revision.dir" value="bin"/>
36 <antcall target="create-revision" />
37 </target>
38
39 <!--
[2358]40 ** Creates the REVISION file to be included in the distribution
[2618]41 -->
[2358]42 <target name="create-revision">
[2453]43 <property name="revision.dir" value="${build.dir}"/>
44 <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false">
[2618]45 <env key="LANG" value="C"/>
46 <arg value="info"/>
47 <arg value="--xml"/>
48 <arg value="."/>
[2453]49 </exec>
50 <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
51 <delete file="REVISION.XML" />
[2358]52 <tstamp>
[2618]53 <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
[2360]54 </tstamp>
[1751]55
[2360]56 <property name="version.entry.commit.revision" value="UNKNOWN"/>
[2453]57 <mkdir dir="${revision.dir}" />
58 <echo file="${revision.dir}/REVISION">
[3091]59# automatically generated by JOSM build.xml - do not edit
[2358]60Revision: ${version.entry.commit.revision}
61Is-Local-Build: true
[3091]62Build-Date: ${build.tstamp}
[2618]63</echo>
[2358]64 </target>
[1751]65
[2618]66
[2358]67 <target name="dist" depends="compile,create-revision">
68
[1751]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"/>
[2618]79 <echo>Revision ${version.entry.commit.revision}</echo>
[1751]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"/>
[2397]86 <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
[2618]87 <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
[1751]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" />
[2507]94 <zipfileset dir="data" prefix="data" />
[3864]95 <zipfileset dir="styles" prefix="styles" />
[3744]96 <zipfileset dir="src/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images" />
[1751]97
98 <!-- All jar files necessary to run only JOSM (no tests) -->
99 <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar" />
[3425]100 <zipfileset src="lib/signpost-core-1.2.1.1.jar" />
[1751]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>
[3579]117
[1751]118 <target name="compile" depends="init">
119 <javac srcdir="src" classpathref="classpath" destdir="build"
[3509]120 target="1.5" source="1.5" debug="on" encoding="UTF-8">
[1751]121 <compilerarg value="-Xlint:deprecation"/>
[1941]122 <compilerarg value="-Xlint:unchecked"/>
[1751]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>
[3875]135
136 <target name="javacc">
[3856]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>
[3875]144 </target>
[1751]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>
[3579]153 <pathelement path="dist/josm-custom.jar"/>
[1751]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
[3579]166 <target name="test-compile" depends="test-init,dist">
167 <javac srcdir="${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
[3509]168 target="1.5" source="1.5" debug="on" encoding="UTF-8">
[1751]169 <compilerarg value="-Xlint:deprecation"/>
[1941]170 <compilerarg value="-Xlint:unchecked"/>
[1751]171 </javac>
[3579]172 <javac srcdir="${test.dir}/functional" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
[3509]173 target="1.5" source="1.5" debug="on" encoding="UTF-8">
[2618]174 <compilerarg value="-Xlint:deprecation"/>
175 <compilerarg value="-Xlint:unchecked"/>
176 </javac>
[1751]177 </target>
178
[2618]179 <target name="test" depends="test-compile">
180 <junit printsummary="yes">
181 <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
[3580]182 <sysproperty key="java.awt.headless" value="true"/>
[2618]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"/>
[3026]189 <formatter type="xml"/>
190 <batchtest fork="yes" todir="${test.dir}/report">
[2618]191 <fileset dir="${test.dir}/unit" includes="**/*.java"/>
192 </batchtest>
193 </junit>
194 </target>
[1751]195
[3829]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
[3091]206 <target name="dist-optimized" depends="dist">
207 <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar" />
208 <proguard>
209 -injars dist/josm-custom.jar
210 -outjars dist/josm-custom-optimized.jar
211
212 -libraryjars ${java.home}/lib/rt.jar
213 -libraryjars ${java.home}/lib/jce.jar
214
215 -dontoptimize
216 -dontobfuscate
[3579]217
[3442]218 -dontskipnonpubliclibraryclasses
[3091]219
220 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
221 public static void main(java.lang.String[]);
222 }
223
224 -keep class JOSM
225 -keep class * extends org.openstreetmap.josm.io.FileImporter
226 -keep class * extends org.openstreetmap.josm.io.FileExporter
227 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
228
229 -keepclassmembers enum * {
230 public static **[] values();
231 public static ** valueOf(java.lang.String);
232 }
233
234 -keepclassmembers class * {
235 public protected *;
236 }
237 </proguard>
238 </target>
239
[3162]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" />
[3649]260 <fileset file="${java.home}/lib/jce.jar" />
[3162]261 </path>
262 </as:build-signatures>
[3830]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>
[3833]273 <striplinebreaks/>
274 <tokenfilter>
275 <replaceregex pattern='\|$' replace="" flags="gi"/>
276 </tokenfilter>
[3830]277 </filterchain>
278 </loadfile>
279
[3162]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">
[3830]288 <regexp pattern="${deprecated-plugins}"/>
[3162]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.*"/>
[3649]311 <ignore classname="org.apache.avalon.framework.logger.Logger"/>
312 <ignore classname="org.apache.log.*"/>
313 <ignore classname="junit.*"/>
[3162]314 <path path="${dir}"/>
315 </as:check-signature>
316
317 </target>
318
319
[1751]320</project>
Note: See TracBrowser for help on using the repository browser.