source: josm/trunk/build.xml@ 3698

Last change on this file since 3698 was 3649, checked in by jttt, 14 years ago

Added classes to ignore to check-plugins task

File size: 9.7 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">
[3222]35 <copy file="styles/standard/elemstyles.xml" todir="data"/>
[2453]36 <property name="revision.dir" value="bin"/>
37 <antcall target="create-revision" />
38 </target>
39
40 <!--
[2358]41 ** Creates the REVISION file to be included in the distribution
[2618]42 -->
[2358]43 <target name="create-revision">
[2453]44 <property name="revision.dir" value="${build.dir}"/>
45 <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false">
[2618]46 <env key="LANG" value="C"/>
47 <arg value="info"/>
48 <arg value="--xml"/>
49 <arg value="."/>
[2453]50 </exec>
51 <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
52 <delete file="REVISION.XML" />
[2358]53 <tstamp>
[2618]54 <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
[2360]55 </tstamp>
[1751]56
[2360]57 <property name="version.entry.commit.revision" value="UNKNOWN"/>
[2453]58 <mkdir dir="${revision.dir}" />
59 <echo file="${revision.dir}/REVISION">
[3091]60# automatically generated by JOSM build.xml - do not edit
[2358]61Revision: ${version.entry.commit.revision}
62Is-Local-Build: true
[3091]63Build-Date: ${build.tstamp}
[2618]64</echo>
[2358]65 </target>
[1751]66
[2618]67
[2358]68 <target name="dist" depends="compile,create-revision">
69
[1751]70 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
71 <env key="LANG" value="C"/>
72 <arg value="info"/>
73 <arg value="--xml"/>
74 <arg value="."/>
75 </exec>
76 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
77 <delete file="REVISION"/>
78 <property name="version.entry.commit.revision" value="UNKNOWN"/>
79 <property name="version.entry.commit.date" value="UNKNOWN"/>
[2618]80 <echo>Revision ${version.entry.commit.revision}</echo>
[1751]81 <copy file="CONTRIBUTION" todir="build"/>
82 <copy file="README" todir="build"/>
83 <copy file="LICENSE" todir="build"/>
84
[2618]85 <!-- styles -->
[2827]86 <copy file="styles/standard/elemstyles.xml" todir="build/data"/>
[1751]87
88 <!-- create josm-custom.jar -->
89 <delete file="dist/josm-custom.jar"/>
[2397]90 <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
[2618]91 <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
[1751]92 <manifest>
93 <attribute name="Main-class" value="JOSM" />
94 <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
95 <attribute name="Main-Date" value="${version.entry.commit.date}"/>
96 </manifest>
97 <zipfileset dir="images" prefix="images" />
[2507]98 <zipfileset dir="data" prefix="data" />
[1751]99
100 <!-- All jar files necessary to run only JOSM (no tests) -->
101 <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar" />
[3425]102 <zipfileset src="lib/signpost-core-1.2.1.1.jar" />
[1751]103 </jar>
104 </target>
105
106 <target name="distmac" depends="dist">
107 <!-- modify MacOS X Info.plist file to hold the SVN version number -->
108 <copy file="macosx/JOSM.app/Contents/Info.plist" todir="build"/>
109 <replace file="build/Info.plist" token="@SVNVersion@" value="${version.entry.commit.revision}"/>
110 <!-- create ZIP file with MacOS X application bundle -->
111 <zip destfile="dist/josm-custom-macosx.zip" update="true">
112 <zipfileset dir="build" includes="CONTRIBUTION README LICENSE"/>
113 <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"/>
114 <zipfileset dir="build" includes="Info.plist" prefix="JOSM.app/Contents"/>
115 <zipfileset dir="dist" includes="josm-custom.jar" prefix="JOSM.app/Contents/Resources/Java"/>
116 <zipfileset dir="macosx" includes="JOSM.app/Contents/MacOS/JOSM" filemode="755"/>
117 </zip>
118 </target>
[3579]119
[1751]120 <target name="compile" depends="init">
121 <javac srcdir="src" classpathref="classpath" destdir="build"
[3509]122 target="1.5" source="1.5" debug="on" encoding="UTF-8">
[1751]123 <compilerarg value="-Xlint:deprecation"/>
[1941]124 <compilerarg value="-Xlint:unchecked"/>
[1751]125 </javac>
126 </target>
127
128 <target name="init">
129 <mkdir dir="build" />
130 <mkdir dir="dist" />
131 </target>
132
133 <target name="clean">
134 <delete dir="build" />
135 <delete dir="dist" />
136 </target>
137
138 <path id="test.classpath">
139 <fileset dir="${test.dir}/lib">
140 <include name="**/*.jar"/>
141 </fileset>
142 <fileset dir="lib">
143 <include name="**/*.jar"/>
144 </fileset>
[3579]145 <pathelement path="dist/josm-custom.jar"/>
[1751]146 </path>
147
148 <target name="test-init">
149 <mkdir dir="${test.dir}/${build.dir}" />
150 <mkdir dir="${test.dir}/report" />
151 </target>
152
153 <target name="test-clean">
154 <delete dir="${test.dir}/${build.dir}"/>
155 <delete dir="${test.dir}/report"/>
156 </target>
157
[3579]158 <target name="test-compile" depends="test-init,dist">
159 <javac srcdir="${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
[3509]160 target="1.5" source="1.5" debug="on" encoding="UTF-8">
[1751]161 <compilerarg value="-Xlint:deprecation"/>
[1941]162 <compilerarg value="-Xlint:unchecked"/>
[1751]163 </javac>
[3579]164 <javac srcdir="${test.dir}/functional" classpathref="test.classpath" destdir="${test.dir}/${build.dir}"
[3509]165 target="1.5" source="1.5" debug="on" encoding="UTF-8">
[2618]166 <compilerarg value="-Xlint:deprecation"/>
167 <compilerarg value="-Xlint:unchecked"/>
168 </javac>
[1751]169 </target>
170
[2618]171 <target name="test" depends="test-compile">
172 <junit printsummary="yes">
173 <sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
[3580]174 <sysproperty key="java.awt.headless" value="true"/>
[2618]175 <classpath>
176 <path refid="test.classpath"/>
177 <pathelement path="${test.dir}/${build.dir}"/>
178 <pathelement path="${test.dir}/config"/>
179 </classpath>
180 <formatter type="plain"/>
[3026]181 <formatter type="xml"/>
182 <batchtest fork="yes" todir="${test.dir}/report">
[2618]183 <fileset dir="${test.dir}/unit" includes="**/*.java"/>
184 </batchtest>
185 </junit>
186 </target>
[1751]187
[3091]188 <target name="dist-optimized" depends="dist">
189 <taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar" />
190 <proguard>
191 -injars dist/josm-custom.jar
192 -outjars dist/josm-custom-optimized.jar
193
194 -libraryjars ${java.home}/lib/rt.jar
195 -libraryjars ${java.home}/lib/jce.jar
196
197 -dontoptimize
198 -dontobfuscate
[3579]199
[3442]200 -dontskipnonpubliclibraryclasses
[3091]201
202 -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
203 public static void main(java.lang.String[]);
204 }
205
206 -keep class JOSM
207 -keep class * extends org.openstreetmap.josm.io.FileImporter
208 -keep class * extends org.openstreetmap.josm.io.FileExporter
209 -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
210
211 -keepclassmembers enum * {
212 public static **[] values();
213 public static ** valueOf(java.lang.String);
214 }
215
216 -keepclassmembers class * {
217 public protected *;
218 }
219 </proguard>
220 </target>
221
[3162]222 <target name="check-plugins" depends="dist-optimized">
223 <echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
224
225 <local name="dir"/>
226 <local name="plugins"/>
227
228 <property name="dir" value="plugin-check"/>
229
230 <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
231 <classpath path="tools/animal-sniffer-ant-tasks-1.5.jar" />
232 </typedef>
233
234 <delete dir="${dir}"/>
235
236 <mkdir dir="${dir}"/>
237
238 <as:build-signatures destfile="${dir}/api.sig">
239 <path>
240 <fileset file="dist/josm-custom-optimized.jar" />
241 <fileset file="${java.home}/lib/rt.jar" />
[3649]242 <fileset file="${java.home}/lib/jce.jar" />
[3162]243 </path>
244 </as:build-signatures>
245
246 <!-- Download plugins -->
247 <loadresource property="plugins">
248 <url url="http://josm.openstreetmap.de/plugin"/>
249 <filterchain>
250 <linecontainsregexp negate="true">
251 <regexp pattern="^\t.*"/>
252 </linecontainsregexp>
253 <linecontainsregexp negate="true">
254 <!-- List from PluginHandler.DEPRECATED_PLUGINS -->
255 <regexp pattern="mappaint|unglueplugin|ewmsplugin|ywms|tways-0.2|geotagged|landsat|namefinder|waypoints|slippy_map_chooser|tcx-support|usertools|AgPifoJ|utilsplugin"/>
256 </linecontainsregexp>
257 <tokenfilter>
258 <replaceregex pattern="^.*;" replace="" flags="gi"/>
259 </tokenfilter>
260 </filterchain>
261 </loadresource>
262
263 <copy todir="${dir}" flatten="true">
264 <resourcelist>
265 <string value="${plugins}"/>
266 </resourcelist>
267 </copy>
268
269 <!-- Check plugins -->
270 <as:check-signature signature="${dir}/api.sig">
271 <ignore classname="org.jgraph.*"/>
272 <ignore classname="com.touchgraph.*"/>
273 <ignore classname="com.sun.xml.fastinfoset.*"/>
274 <ignore classname="javax.jms.*"/>
275 <ignore classname="org.jvnet.staxex.*"/>
276 <ignore classname="javax.mail.*"/>
277 <ignore classname="com.sun.jdmk.*"/>
[3649]278 <ignore classname="org.apache.avalon.framework.logger.Logger"/>
279 <ignore classname="org.apache.log.*"/>
280 <ignore classname="junit.*"/>
[3162]281 <path path="${dir}"/>
282 </as:check-signature>
283
284 </target>
285
286
[1751]287</project>
Note: See TracBrowser for help on using the repository browser.