source: josm/trunk/build.xml@ 5318

Last change on this file since 5318 was 5263, checked in by bastiK, 12 years ago

add javadoc ant task

File size: 14.5 KB
Line 
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" location="test"/>
14 <property name="src.dir" location="src"/>
15 <property name="build.dir" location="build"/>
16 <property name="javacc.home" location="tools"/>
17 <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
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>
24 <!-- Java classpath addition (all jar files to compile tests with this) -->
25 <path id="classpath">
26 <fileset dir="lib">
27 <include name="**/*.jar"/>
28 </fileset>
29 </path>
30
31 <!--
32 ** Used by Eclipse ant builder for updating
33 ** the REVISION file used by JOSM
34 -->
35 <target name="create-revision-eclipse">
36 <property name="revision.dir" value="bin"/>
37 <antcall target="create-revision"/>
38 </target>
39 <!--
40 ** Creates the REVISION file to be included in the distribution
41 -->
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 <property name="version.entry.commit.revision" value="UNKNOWN"/>
56 <mkdir dir="${revision.dir}"/>
57 <echo file="${revision.dir}/REVISION">
58# automatically generated by JOSM build.xml - do not edit
59Revision: ${version.entry.commit.revision}
60Is-Local-Build: true
61Build-Date: ${build.tstamp}
62</echo>
63 </target>
64 <target name="dist" depends="compile,create-revision">
65 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
66 <env key="LANG" value="C"/>
67 <arg value="info"/>
68 <arg value="--xml"/>
69 <arg value="."/>
70 </exec>
71 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
72 <delete file="REVISION"/>
73 <property name="version.entry.commit.revision" value="UNKNOWN"/>
74 <property name="version.entry.commit.date" value="UNKNOWN"/>
75 <echo>Revision ${version.entry.commit.revision}</echo>
76 <copy file="CONTRIBUTION" todir="build"/>
77 <copy file="README" todir="build"/>
78 <copy file="LICENSE" todir="build"/>
79 <!-- create josm-custom.jar -->
80 <delete file="dist/josm-custom.jar"/>
81 <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
82 <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
83 <manifest>
84 <attribute name="Main-class" value="JOSM"/>
85 <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
86 <attribute name="Main-Date" value="${version.entry.commit.date}"/>
87 </manifest>
88 <zipfileset dir="images" prefix="images"/>
89 <zipfileset dir="data" prefix="data"/>
90 <zipfileset dir="styles" prefix="styles"/>
91 <zipfileset dir="src/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
92 <!-- All jar files necessary to run only JOSM (no tests) -->
93 <!-- <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar"/> -->
94 <!-- <zipfileset src="lib/signpost-core-1.2.1.1.jar"/> -->
95 </jar>
96 </target>
97 <target name="distmac" depends="dist">
98 <!-- modify MacOS X Info.plist file to hold the SVN version number -->
99 <copy file="macosx/JOSM.app/Contents/Info.plist" todir="build"/>
100 <replace file="build/Info.plist" token="@SVNVersion@" value="${version.entry.commit.revision}"/>
101 <!-- create ZIP file with MacOS X application bundle -->
102 <zip destfile="dist/josm-custom-macosx.zip" update="true">
103 <zipfileset dir="build" includes="CONTRIBUTION README LICENSE"/>
104 <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"/>
105 <zipfileset dir="build" includes="Info.plist" prefix="JOSM.app/Contents"/>
106 <zipfileset dir="dist" includes="josm-custom.jar" prefix="JOSM.app/Contents/Resources/Java"/>
107 <zipfileset dir="macosx" includes="JOSM.app/Contents/MacOS/JOSM" filemode="755"/>
108 </zip>
109 </target>
110 <target name="javacc">
111 <mkdir dir="${mapcss.dir}/parsergen"/>
112 <exec append="false" executable="java" failifexecutionfails="true">
113 <arg value="-cp"/>
114 <arg value="${javacc.home}/javacc.jar"/>
115 <arg value="javacc"/>
116 <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
117 <arg value="${mapcss.dir}/MapCSSParser.jj"/>
118 </exec>
119<!-- <javacc target="${mapcss.dir}/MapCSSParser.jj" javacchome="${javacc.home}" outputdirectory="${mapcss.dir}/parsergen"/>-->
120 </target>
121 <target name="compile" depends="javacc,init">
122 <javac srcdir="src" includes="com/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.5" source="1.5" debug="on" encoding="iso-8859-1"/>
123 <javac srcdir="src" excludes="com/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.5" source="1.5" debug="on" encoding="UTF-8">
124 <compilerarg value="-Xlint:deprecation"/>
125 <compilerarg value="-Xlint:unchecked"/>
126 </javac>
127 </target>
128 <target name="init">
129 <mkdir dir="build"/>
130 <mkdir dir="dist"/>
131 </target>
132 <target name="javadoc">
133 <javadoc destdir="javadoc"
134 sourcepath="src"
135 packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
136 windowtitle="JOSM"
137 use="true"
138 linksource="true"
139 author="false">
140 <link href="http://docs.oracle.com/javase/6/docs/api"/>
141 <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
142 <bottom><![CDATA[<a href="http://josm.openstreetmap.de/">JOSM</a>]]></bottom>
143 </javadoc>
144 </target>
145 <target name="clean">
146 <delete dir="build"/>
147 <delete dir="dist"/>
148 <delete dir="${mapcss.dir}/parsergen"/>
149 </target>
150 <path id="test.classpath">
151 <fileset dir="${test.dir}/lib">
152 <include name="**/*.jar"/>
153 </fileset>
154 <fileset dir="lib">
155 <include name="**/*.jar"/>
156 </fileset>
157 <pathelement path="dist/josm-custom.jar"/>
158 </path>
159 <target name="test-init">
160 <mkdir dir="${test.dir}/${build.dir}"/>
161 <mkdir dir="${test.dir}/report"/>
162 </target>
163 <target name="test-clean">
164 <delete dir="${test.dir}/${build.dir}"/>
165 <delete dir="${test.dir}/report"/>
166 </target>
167 <target name="test-compile" depends="test-init,dist">
168 <javac srcdir="${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}" 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}" target="1.5" source="1.5" debug="on" encoding="UTF-8">
173 <compilerarg value="-Xlint:deprecation"/>
174 <compilerarg value="-Xlint:unchecked"/>
175 </javac>
176 </target>
177 <target name="test" depends="test-compile">
178 <junit printsummary="yes">
179 <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
180 <sysproperty key="java.awt.headless" value="true"/>
181 <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
182 <classpath>
183 <path refid="test.classpath"/>
184 <pathelement path="${test.dir}/${build.dir}"/>
185 <pathelement path="${test.dir}/config"/>
186 </classpath>
187 <formatter type="plain"/>
188 <formatter type="xml"/>
189 <batchtest fork="yes" todir="${test.dir}/report">
190 <fileset dir="${test.dir}/unit" includes="**/*.java"/>
191 </batchtest>
192 </junit>
193 </target>
194 <target name="test-html" depends="test" description="Generate HTML test reports">
195 <!-- May require additional ant dependencies like ant-trax package -->
196 <junitreport todir="${test.dir}/report">
197 <fileset dir="${test.dir}/report">
198 <include name="TEST-*.xml"/>
199 </fileset>
200 <report todir="${test.dir}/report/html"/>
201 </junitreport>
202 </target>
203 <target name="dist-optimized" depends="dist">
204 <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
205 <proguard>
206 -injars dist/josm-custom.jar
207 -outjars dist/josm-custom-optimized.jar
208
209 -libraryjars ${java.home}/lib/rt.jar
210 -libraryjars ${java.home}/lib/jce.jar
211
212 -dontoptimize
213 -dontobfuscate
214
215 # These options probably are not necessary (and make processing a bit slower)
216 -dontskipnonpubliclibraryclasses
217 -dontskipnonpubliclibraryclassmembers
218
219 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
220 public static void main(java.lang.String[]);
221 }
222 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
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.data.imagery.types.Adapter1
228 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
229
230 -keepclassmembers enum * {
231 public static **[] values();
232 public static ** valueOf(java.lang.String);
233 }
234
235 # Keep unused public methods (can be useful for plugins)
236 -keepclassmembers class * {
237 public protected *;
238 }
239
240 # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'. This notes should not be a problem as we don't use obfuscation
241 -dontnote
242 </proguard>
243 </target>
244 <target name="check-plugins" depends="dist-optimized">
245 <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
246 <local name="dir"/>
247 <local name="plugins"/>
248 <property name="dir" value="plugin-check"/>
249 <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
250 <classpath path="tools/animal-sniffer-ant-tasks-1.7.jar"/>
251 </typedef>
252 <delete dir="${dir}"/>
253 <mkdir dir="${dir}"/>
254 <as:build-signatures destfile="${dir}/api.sig">
255 <path>
256 <fileset file="dist/josm-custom-optimized.jar"/>
257 <fileset file="${java.home}/lib/rt.jar"/>
258 <fileset file="${java.home}/lib/jce.jar"/>
259 </path>
260 </as:build-signatures>
261 <!-- List of deprecated plugins -->
262 <loadfile property="deprecated-plugins" srcFile="src/org/openstreetmap/josm/plugins/PluginHandler.java">
263 <filterchain>
264 <linecontains>
265 <contains value="new DeprecatedPlugin("/>
266 </linecontains>
267 <tokenfilter>
268 <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
269 </tokenfilter>
270 <striplinebreaks/>
271 <tokenfilter>
272 <replaceregex pattern="\|$" replace="" flags="gi"/>
273 </tokenfilter>
274 </filterchain>
275 </loadfile>
276 <!-- Download plugins -->
277 <loadresource property="plugins">
278 <url url="http://josm.openstreetmap.de/plugin"/>
279 <filterchain>
280 <linecontainsregexp negate="true">
281 <regexp pattern="^\t.*"/>
282 </linecontainsregexp>
283 <linecontainsregexp negate="true">
284 <regexp pattern="${deprecated-plugins}"/>
285 </linecontainsregexp>
286 <tokenfilter>
287 <replaceregex pattern="^.*;" replace="" flags="gi"/>
288 </tokenfilter>
289 </filterchain>
290 </loadresource>
291 <copy todir="${dir}" flatten="true">
292 <resourcelist>
293 <string value="${plugins}"/>
294 </resourcelist>
295 </copy>
296 <!-- Check plugins -->
297 <as:check-signature signature="${dir}/api.sig">
298 <ignore classname="org.jgraph.*"/>
299 <ignore classname="com.touchgraph.*"/>
300 <ignore classname="com.sun.xml.fastinfoset.*"/>
301 <ignore classname="javax.jms.*"/>
302 <ignore classname="org.jvnet.staxex.*"/>
303 <ignore classname="javax.mail.*"/>
304 <ignore classname="com.sun.jdmk.*"/>
305 <ignore classname="org.apache.avalon.framework.logger.Logger"/>
306 <ignore classname="org.apache.log.*"/>
307 <ignore classname="junit.*"/>
308 <path path="${dir}"/>
309 </as:check-signature>
310 </target>
311
312 <target name="findbugs" depends="dist">
313 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
314 <path id="findbugs-classpath">
315 <fileset dir="tools/findbugs/">
316 <include name="*.jar"/>
317 </fileset>
318 </path>
319 <property name="findbugs-classpath" refid="findbugs-classpath"/>
320 <findbugs output="xml"
321 outputFile="findbugs-josm.xml"
322 classpath="${findbugs-classpath}"
323 pluginList=""
324 excludeFilter="tools/findbugs/josm-filter.xml"
325 effort="max"
326 >
327 <sourcePath path="${basedir}/src" />
328 <class location="${basedir}/dist/josm-custom.jar" />
329 </findbugs>
330 </target>
331
332</project>
Note: See TracBrowser for help on using the repository browser.