source: josm/trunk/build.xml@ 4246

Last change on this file since 4246 was 4243, checked in by stoecker, 13 years ago

fix track coloring and NMEA import

File size: 12.3 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" 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
56Revision: ${version.entry.commit.revision}
57Is-Local-Build: true
58Build-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) -->
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" includes="com/drew/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.5" source="1.5" debug="on" encoding="iso-8859-1"/>
109 <javac srcdir="src" excludes="com/drew/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.5" source="1.5" debug="on" encoding="UTF-8">
110 <compilerarg value="-Xlint:deprecation"/>
111 <compilerarg value="-Xlint:unchecked"/>
112 </javac>
113 </target>
114 <target name="init">
115 <mkdir dir="build"/>
116 <mkdir dir="dist"/>
117 </target>
118 <target name="clean">
119 <delete dir="build"/>
120 <delete dir="dist"/>
121 </target>
122 <target name="javacc">
123 <exec executable="javacc">
124 <arg value="-debug_parser=false"/>
125 <arg value="-debug_lookahead=false"/>
126 <arg value="-debug_token_manager=false"/>
127 <arg value="-output_directory=${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss/parser"/>
128 <arg value="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss/parser/MapCSSParser.jj"/>
129 </exec>
130 </target>
131 <path id="test.classpath">
132 <fileset dir="${test.dir}/lib">
133 <include name="**/*.jar"/>
134 </fileset>
135 <fileset dir="lib">
136 <include name="**/*.jar"/>
137 </fileset>
138 <pathelement path="dist/josm-custom.jar"/>
139 </path>
140 <target name="test-init">
141 <mkdir dir="${test.dir}/${build.dir}"/>
142 <mkdir dir="${test.dir}/report"/>
143 </target>
144 <target name="test-clean">
145 <delete dir="${test.dir}/${build.dir}"/>
146 <delete dir="${test.dir}/report"/>
147 </target>
148 <target name="test-compile" depends="test-init,dist">
149 <javac srcdir="${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}" target="1.5" source="1.5" debug="on" encoding="UTF-8">
150 <compilerarg value="-Xlint:deprecation"/>
151 <compilerarg value="-Xlint:unchecked"/>
152 </javac>
153 <javac srcdir="${test.dir}/functional" classpathref="test.classpath" destdir="${test.dir}/${build.dir}" target="1.5" source="1.5" debug="on" encoding="UTF-8">
154 <compilerarg value="-Xlint:deprecation"/>
155 <compilerarg value="-Xlint:unchecked"/>
156 </javac>
157 </target>
158 <target name="test" depends="test-compile">
159 <junit printsummary="yes">
160 <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
161 <sysproperty key="java.awt.headless" value="true"/>
162 <classpath>
163 <path refid="test.classpath"/>
164 <pathelement path="${test.dir}/${build.dir}"/>
165 <pathelement path="${test.dir}/config"/>
166 </classpath>
167 <formatter type="plain"/>
168 <formatter type="xml"/>
169 <batchtest fork="yes" todir="${test.dir}/report">
170 <fileset dir="${test.dir}/unit" includes="**/*.java"/>
171 </batchtest>
172 </junit>
173 </target>
174 <target name="test-html" depends="test" description="Generate HTML test reports">
175 <!-- May require additional ant dependencies like ant-trax package -->
176 <junitreport todir="${test.dir}/report">
177 <fileset dir="${test.dir}/report">
178 <include name="TEST-*.xml"/>
179 </fileset>
180 <report todir="${test.dir}/report/html"/>
181 </junitreport>
182 </target>
183 <target name="dist-optimized" depends="dist">
184 <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
185 <proguard>
186 -injars dist/josm-custom.jar
187 -outjars dist/josm-custom-optimized.jar
188
189 -libraryjars ${java.home}/lib/rt.jar
190 -libraryjars ${java.home}/lib/jce.jar
191
192 -dontoptimize
193 -dontobfuscate
194
195 -dontskipnonpubliclibraryclasses
196
197 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
198 public static void main(java.lang.String[]);
199 }
200
201 -keep class JOSM
202 -keep class * extends org.openstreetmap.josm.io.FileImporter
203 -keep class * extends org.openstreetmap.josm.io.FileExporter
204 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
205
206 -keepclassmembers enum * {
207 public static **[] values();
208 public static ** valueOf(java.lang.String);
209 }
210
211 -keepclassmembers class * {
212 public protected *;
213 }
214 </proguard>
215 </target>
216 <target name="check-plugins" depends="dist-optimized">
217 <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
218 <local name="dir"/>
219 <local name="plugins"/>
220 <property name="dir" value="plugin-check"/>
221 <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
222 <classpath path="tools/animal-sniffer-ant-tasks-1.5.jar"/>
223 </typedef>
224 <delete dir="${dir}"/>
225 <mkdir dir="${dir}"/>
226 <as:build-signatures destfile="${dir}/api.sig">
227 <path>
228 <fileset file="dist/josm-custom-optimized.jar"/>
229 <fileset file="${java.home}/lib/rt.jar"/>
230 <fileset file="${java.home}/lib/jce.jar"/>
231 </path>
232 </as:build-signatures>
233 <!-- List of deprecated plugins -->
234 <loadfile property="deprecated-plugins" srcFile="src/org/openstreetmap/josm/plugins/PluginHandler.java">
235 <filterchain>
236 <linecontains>
237 <contains value="new DeprecatedPlugin("/>
238 </linecontains>
239 <tokenfilter>
240 <replaceregex pattern=".*new DeprecatedPlugin\(&quot;(.+?)&quot;.*" replace="\1|" flags="gi"/>
241 </tokenfilter>
242 <striplinebreaks/>
243 <tokenfilter>
244 <replaceregex pattern="\|$" replace="" flags="gi"/>
245 </tokenfilter>
246 </filterchain>
247 </loadfile>
248 <!-- Download plugins -->
249 <loadresource property="plugins">
250 <url url="http://josm.openstreetmap.de/plugin"/>
251 <filterchain>
252 <linecontainsregexp negate="true">
253 <regexp pattern="^\t.*"/>
254 </linecontainsregexp>
255 <linecontainsregexp negate="true">
256 <regexp pattern="${deprecated-plugins}"/>
257 </linecontainsregexp>
258 <tokenfilter>
259 <replaceregex pattern="^.*;" replace="" flags="gi"/>
260 </tokenfilter>
261 </filterchain>
262 </loadresource>
263 <copy todir="${dir}" flatten="true">
264 <resourcelist>
265 <string value="${plugins}"/>
266 </resourcelist>
267 </copy>
268 <!-- Check plugins -->
269 <as:check-signature signature="${dir}/api.sig">
270 <ignore classname="org.jgraph.*"/>
271 <ignore classname="com.touchgraph.*"/>
272 <ignore classname="com.sun.xml.fastinfoset.*"/>
273 <ignore classname="javax.jms.*"/>
274 <ignore classname="org.jvnet.staxex.*"/>
275 <ignore classname="javax.mail.*"/>
276 <ignore classname="com.sun.jdmk.*"/>
277 <ignore classname="org.apache.avalon.framework.logger.Logger"/>
278 <ignore classname="org.apache.log.*"/>
279 <ignore classname="junit.*"/>
280 <path path="${dir}"/>
281 </as:check-signature>
282 </target>
283</project>
Note: See TracBrowser for help on using the repository browser.