forked from JOSM/josm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
366 lines (355 loc) · 15.9 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<?xml version="1.0" encoding="utf-8"?>
<!-- ** build.xml - main ant file for JOSM
**
** To build run
** ant clean
** ant dist
** This will create 'josm-custom.jar' in directory 'dist'. See also
** https://josm.openstreetmap.de/wiki/CreateBuild
**
**
-->
<project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" basedir=".">
<property name="test.dir" location="test"/>
<property name="src.dir" location="src"/>
<property name="build.dir" location="build"/>
<property name="javacc.home" location="tools"/>
<property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
<!-- build parameter: compression level (ant -Dclevel=N)
N ranges from 0 (no compression) to 9 (maximum compression)
default: 9 -->
<condition property="clevel" value="${clevel}" else="9">
<isset property="clevel"/>
</condition>
<!-- Java classpath addition (all jar files to compile tests with this) -->
<path id="classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!--
** Used by Eclipse ant builder for updating
** the REVISION file used by JOSM
-->
<target name="create-revision-eclipse">
<property name="revision.dir" value="bin"/>
<antcall target="create-revision"/>
</target>
<!--
** Creates the REVISION file to be included in the distribution
-->
<target name="create-revision">
<property name="revision.dir" value="${build.dir}"/>
<exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false">
<env key="LANG" value="C"/>
<arg value="info"/>
<arg value="--xml"/>
<arg value="http://josm.openstreetmap.de/svn/trunk"/>
</exec>
<xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
<delete file="REVISION.XML"/>
<tstamp>
<format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
</tstamp>
<property name="version.entry.commit.revision" value="UNKNOWN"/>
<mkdir dir="${revision.dir}"/>
<!-- add Build-Name: ... when making special builds, e.g. DEBIAN -->
<echo file="${revision.dir}/REVISION">
# automatically generated by JOSM build.xml - do not edit
Revision: ${version.entry.commit.revision}
Is-Local-Build: true
Build-Date: ${build.tstamp}
</echo>
</target>
<target name="dist" depends="compile,create-revision">
<exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
<env key="LANG" value="C"/>
<arg value="info"/>
<arg value="--xml"/>
<arg value="http://josm.openstreetmap.de/svn/trunk"/>
</exec>
<xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
<delete file="REVISION"/>
<property name="version.entry.commit.revision" value="UNKNOWN"/>
<property name="version.entry.commit.date" value="UNKNOWN"/>
<echo>Revision ${version.entry.commit.revision}</echo>
<copy file="CONTRIBUTION" todir="build"/>
<copy file="README" todir="build"/>
<copy file="LICENSE" todir="build"/>
<!-- create josm-custom.jar -->
<delete file="dist/josm-custom.jar"/>
<jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
<!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
<manifest>
<attribute name="Main-class" value="JOSM"/>
<attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
<attribute name="Main-Date" value="${version.entry.commit.date}"/>
</manifest>
<zipfileset dir="images" prefix="images"/>
<zipfileset dir="data" prefix="data"/>
<zipfileset dir="styles" prefix="styles"/>
<zipfileset dir="src/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
<!-- All jar files necessary to run only JOSM (no tests) -->
<!-- <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar"/> -->
<!-- <zipfileset src="lib/signpost-core-1.2.1.1.jar"/> -->
</jar>
</target>
<target name="distmac" depends="dist">
<!-- modify MacOS X Info.plist file to hold the SVN version number -->
<copy file="macosx/JOSM.app/Contents/Info.plist" todir="build"/>
<replace file="build/Info.plist" token="@SVNVersion@" value="${version.entry.commit.revision}"/>
<!-- create ZIP file with MacOS X application bundle -->
<zip destfile="dist/josm-custom-macosx.zip" update="true">
<zipfileset dir="build" includes="CONTRIBUTION README LICENSE"/>
<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"/>
<zipfileset dir="build" includes="Info.plist" prefix="JOSM.app/Contents"/>
<zipfileset dir="dist" includes="josm-custom.jar" prefix="JOSM.app/Contents/Resources/Java"/>
<zipfileset dir="macosx" includes="JOSM.app/Contents/MacOS/JOSM" filemode="755"/>
</zip>
</target>
<target name="javacc" depends="init" unless="javacc.notRequired">
<mkdir dir="${mapcss.dir}/parsergen"/>
<exec append="false" executable="java" failifexecutionfails="true">
<arg value="-cp"/>
<arg value="${javacc.home}/javacc.jar"/>
<arg value="javacc"/>
<arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
<arg value="${mapcss.dir}/MapCSSParser.jj"/>
</exec>
<!-- <javacc target="${mapcss.dir}/MapCSSParser.jj" javacchome="${javacc.home}" outputdirectory="${mapcss.dir}/parsergen"/>-->
</target>
<target name="compile" depends="init,javacc">
<javac srcdir="src" includes="com/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.6" source="1.6" debug="on" includeantruntime="false" encoding="iso-8859-1"/>
<javac srcdir="src" excludes="com/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.6" source="1.6" debug="on" includeantruntime="false" encoding="UTF-8">
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
<target name="init">
<uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
<srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
</uptodate>
<mkdir dir="build"/>
<mkdir dir="dist"/>
</target>
<target name="javadoc">
<javadoc destdir="javadoc"
sourcepath="src"
packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
windowtitle="JOSM"
use="true"
private="true"
linksource="true"
author="false">
<link href="http://docs.oracle.com/javase/6/docs/api"/>
<doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
<bottom><![CDATA[<a href="http://josm.openstreetmap.de/">JOSM</a>]]></bottom>
</javadoc>
</target>
<target name="clean">
<delete dir="build"/>
<delete dir="dist"/>
<delete dir="${mapcss.dir}/parsergen"/>
</target>
<path id="test.classpath">
<fileset dir="${test.dir}/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement path="dist/josm-custom.jar"/>
</path>
<target name="test-init">
<mkdir dir="${test.dir}/${build.dir}"/>
<mkdir dir="${test.dir}/report"/>
</target>
<target name="test-clean">
<delete dir="${test.dir}/${build.dir}"/>
<delete dir="${test.dir}/report"/>
</target>
<target name="test-compile" depends="test-init,dist">
<javac srcdir="${test.dir}/unit" classpathref="test.classpath" destdir="${test.dir}/${build.dir}" target="1.5" source="1.5" debug="on" encoding="UTF-8">
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>
<javac srcdir="${test.dir}/functional" classpathref="test.classpath" destdir="${test.dir}/${build.dir}" target="1.5" source="1.5" debug="on" encoding="UTF-8">
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
<target name="test" depends="test-compile">
<junit printsummary="yes">
<sysproperty key="josm.home" value="${test.dir}/config/unit-josm.home"/>
<sysproperty key="java.awt.headless" value="true"/>
<sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
<classpath>
<path refid="test.classpath"/>
<pathelement path="${test.dir}/${build.dir}"/>
<pathelement path="${test.dir}/config"/>
</classpath>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.dir}/report">
<fileset dir="${test.dir}/unit" includes="**/*.java"/>
</batchtest>
</junit>
</target>
<target name="test-html" depends="test" description="Generate HTML test reports">
<!-- May require additional ant dependencies like ant-trax package -->
<junitreport todir="${test.dir}/report">
<fileset dir="${test.dir}/report">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${test.dir}/report/html"/>
</junitreport>
</target>
<target name="dist-optimized" depends="dist">
<taskdef resource="proguard/ant/task.properties" classpath="tools/proguard.jar"/>
<proguard>
-injars dist/josm-custom.jar
-outjars dist/josm-custom-optimized.jar
-libraryjars ${java.home}/lib/rt.jar
-libraryjars ${java.home}/lib/jce.jar
-dontoptimize
-dontobfuscate
# These options probably are not necessary (and make processing a bit slower)
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
public static void main(java.lang.String[]);
}
-keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplet
-keep class JOSM
-keep class * extends org.openstreetmap.josm.io.FileImporter
-keep class * extends org.openstreetmap.josm.io.FileExporter
-keep class org.openstreetmap.josm.data.imagery.types.Adapter1
-keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# Keep unused public methods (can be useful for plugins)
-keepclassmembers class * {
public protected *;
}
# 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
-dontnote
</proguard>
</target>
<target name="check-plugins" depends="dist-optimized">
<echo message="Check of plugins binary compatibility (needs ant 1.8)"/>
<local name="dir"/>
<local name="plugins"/>
<property name="dir" value="plugin-check"/>
<typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
<classpath path="tools/animal-sniffer-ant-tasks-1.8.jar"/>
</typedef>
<mkdir dir="${dir}"/>
<!-- List of deprecated plugins -->
<loadfile property="deprecated-plugins" srcFile="src/org/openstreetmap/josm/plugins/PluginHandler.java">
<filterchain>
<linecontains>
<contains value="new DeprecatedPlugin("/>
</linecontains>
<tokenfilter>
<replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
</tokenfilter>
<striplinebreaks/>
<tokenfilter>
<replaceregex pattern="\|$" replace="" flags="gi"/>
</tokenfilter>
</filterchain>
</loadfile>
<!-- Download list of plugins -->
<loadresource property="plugins">
<url url="http://josm.openstreetmap.de/plugin"/>
<filterchain>
<linecontainsregexp negate="true">
<regexp pattern="^\t.*"/>
</linecontainsregexp>
<linecontainsregexp negate="true">
<regexp pattern="${deprecated-plugins}"/>
</linecontainsregexp>
<tokenfilter>
<replaceregex pattern="^.*;" replace="" flags="gi"/>
</tokenfilter>
</filterchain>
</loadresource>
<!-- Delete files that are not in plugin list (like old plugins) -->
<loadresource property="file-list">
<propertyresource name="plugins"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
</tokenfilter>
<striplinebreaks/>
<tokenfilter>
<replaceregex pattern="\|$" replace="" flags="gi"/>
</tokenfilter>
</filterchain>
</loadresource>
<delete>
<restrict>
<fileset dir="${dir}"/>
<not>
<name regex="${file-list}"/>
</not>
</restrict>
</delete>
<!-- Download plugins -->
<copy todir="${dir}" flatten="true">
<resourcelist>
<string value="${plugins}"/>
</resourcelist>
</copy>
<!-- Check plugins -->
<as:build-signatures destfile="${dir}/api.sig">
<path>
<fileset file="dist/josm-custom-optimized.jar"/>
<fileset file="${java.home}/lib/rt.jar"/>
<fileset file="${java.home}/lib/jce.jar"/>
</path>
</as:build-signatures>
<as:check-signature signature="${dir}/api.sig">
<ignore classname="org.jgraph.*"/>
<ignore classname="com.touchgraph.*"/>
<ignore classname="com.sun.xml.fastinfoset.*"/>
<ignore classname="javax.jms.*"/>
<ignore classname="org.jvnet.staxex.*"/>
<ignore classname="javax.mail.*"/>
<ignore classname="com.sun.jdmk.*"/>
<ignore classname="org.apache.avalon.framework.logger.Logger"/>
<ignore classname="org.apache.log.*"/>
<ignore classname="junit.*"/>
<path path="${dir}"/>
</as:check-signature>
</target>
<target name="findbugs" depends="dist">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
<path id="findbugs-classpath">
<fileset dir="tools/findbugs/">
<include name="*.jar"/>
</fileset>
</path>
<property name="findbugs-classpath" refid="findbugs-classpath"/>
<findbugs output="xml"
outputFile="findbugs-josm.xml"
classpath="${findbugs-classpath}"
pluginList=""
excludeFilter="tools/findbugs/josm-filter.xml"
effort="max"
>
<sourcePath path="${basedir}/src" />
<class location="${basedir}/dist/josm-custom.jar" />
</findbugs>
</target>
<target name="run" depends="dist">
<java jar="dist/josm-custom.jar" fork="true">
<arg value="--set=expert=true"/>
<arg value="--set=remotecontrol.enabled=true"/>
<arg value="--set=debug.edt-checker.enable=false"/>
<jvmarg value="-Djosm.home=/tmp/.josm/"/>
</java>
</target>
</project>