forked from StevenSunzh/mobac-ext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
374 lines (348 loc) · 13.5 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
367
368
369
370
371
372
373
374
<project default="all"
name="Compile and build java classes plus jar archives">
<property file="src/main/resources/mobac/mobac.properties" />
<property name="rev.prop.file" value="src/main/resources/mobac/mobac-rev.properties" />
<property name="jar.name" value="Mobile_Atlas_Creator.jar" />
<property name="zip.name" value="Mobile Atlas Creator ${mobac.version}.zip" />
<property name="zip_src.name" value="Mobile Atlas Creator ${mobac.version} src.zip" />
<property name="main.class" value="mobac.StartMOBAC" />
<property name="rtlibraryjar.non_osx" value="${java.home}/lib/rt.jar" />
<property name="rtlibraryjar.osx" value="${java.home}/../Classes/classes.jar" />
<available property="rtlibraryjar.osx.present" file="${rtlibraryjar.osx}" />
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<property name="je-version" value="3.3.93" />
<property name="sqlite-version" value="3.8.11.1" />
<!-- Java target version -->
<property name="java-target" value="1.6" />
<path id="maincp">
<fileset dir="lib" includes="log*.jar" />
<fileset dir="lib" includes="jai*.jar" />
<fileset dir="lib" includes="bsh-2.0b4.jar" />
<fileset dir="lib" includes="Tidy.jar" />
<fileset dir="lib" includes="javapng-2.0.jar" />
<fileset dir="lib" includes="itextpdf-5.1.0.jar" />
<fileset dir="lib" includes="commons-codec-1.4.jar" />
<fileset dir="lib" includes="commons-io-2.0.jar" />
<fileset dir="lib" includes="commons-lang3-3.1.jar" />
<fileset dir="lib" includes="je-${je-version}.jar" />
</path>
<target name="all"
depends="clean_build,svnversion,build,build_mapsources,sign_mapsources,create_jar,shrink,create_release,create_release_src" />
<target name="update_mapsources" depends="build_mapsources,sign_mapsources" />
<target name="clean_workspace"
description="Deletes the work directories ozi, atlases, atlasestared">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="atlases" includes="**/*" />
<fileset dir="build" includes="**/*" />
<fileset dir="tilestore" includes="**/*" />
</delete>
</target>
<target name="clean_build">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="build" includes="**/*" />
</delete>
</target>
<target name="delete_build" description="Deleted the entire build folder">
<delete failonerror="yes" dir="build" />
</target>
<target name="build">
<mkdir dir="build/mobac" />
<!-- Compile the starter class for Java 1.5 (shows an verbose -->
<!-- error if the JRE requirements are not met -->
<javac srcdir="src/main/java" destdir="build/mobac" target="1.5"
source="1.5" debug="true" includeantruntime="false" encoding="UTF-8">
<classpath refid="maincp" />
<include name="mobac/StartMOBAC.java" />
</javac>
<!-- Compile the other classes for Java 1.6 -->
<javac srcdir="src/main/java" destdir="build/mobac" target="${java-target}"
source="${java-target}" debug="true" includeantruntime="false"
encoding="UTF-8">
<classpath refid="maincp" />
<exclude name="mobac/StartMOBAC.java" />
<exclude name="mobac/mapsources/mappacks/**" />
<include name="mobac/**" />
</javac>
<copy todir="build/mobac" overwrite="true">
<fileset dir="src/main/resources" excludes="**/mapsources.properties" />
</copy>
</target>
<target name="build_mapsources" depends="clean_build,build,svnversion"
description="Build all map packs and generate the new mappacks-md5.txt">
<property name="mappack.srcbasedir" value="src/main/java/mobac/mapsources/mappacks" />
<property file="keys/keystore.properties" />
<taskdef name="for" classname="net.sf.antcontrib.logic.ForTask">
<classpath>
<pathelement location="lib/ant-contrib-for.jar" />
</classpath>
</taskdef>
<delete dir="mapsources" includes="mp-*.jar" />
<dirset id="mappacks" dir="${mappack.srcbasedir}/" includes="*" />
<pathconvert pathsep=";" property="mappacklist" refid="mappacks">
<mapper type="flatten" />
</pathconvert>
<mkdir dir="mapsources" />
<echo file="mapsources/mappacks-md5.txt" append="false" message="" />
<for list="${mappacklist}" param="mappack" delimiter=";">
<sequential>
<echo message="@{mappack}" />
<mkdir dir="build/mp-@{mappack}" />
<uptodate property="@{mappack}.newer" targetfile="mapsources/mp-@{mappack}.jar">
<srcfiles dir="src/main/java/mobac/mapsources/mappacks/@{mappack}" />
</uptodate>
<echo message="No changes in map pack detected: @{mappack}" />
<javac srcdir="src/main/java" destdir="build/mp-@{mappack}"
defaultexcludes="true" debug="true" target="${java-target}" source="${java-target}"
includeantruntime="false" encoding="UTF-8">
<include name="mobac/mapsources/mappacks/@{mappack}/**.java" />
<classpath>
<path refid="maincp" />
<path path="build/mobac" />
</classpath>
</javac>
<delete file="mapsources/mp-@{mappack}.jar" failonerror="false" />
<fileset dir="build/mp-@{mappack}" defaultexcludes="true"
id="fileset-@{mappack}">
<include name="mobac/mapsources/mappacks/@{mappack}/**.class" />
</fileset>
<jar destfile="mapsources/mp-@{mappack}.jar">
<manifest>
<attribute name="MapPackVersion" value="${mobac.mappackversion}" />
<attribute name="MapPackName" value="@{mappack}" />
<attribute name="MapPackBuild-Date" value="${build.date}" />
<attribute name="MapPackRevision" value="${mobac.revision.new}" />
</manifest>
<fileset refid="fileset-@{mappack}" />
<zipfileset dir="${mappack.srcbasedir}/@{mappack}/"
includes="mapsources.list" fullpath="META-INF/services/mobac.program.interfaces.MapSource" />
</jar>
<checksum algorithm="MD5" totalproperty="MD5-@{mappack}">
<fileset refid="fileset-@{mappack}" />
</checksum>
<echo file="mapsources/mappacks-md5.txt" append="true"
message="${MD5-@{mappack}} mp-@{mappack}.jar " />
</sequential>
</for>
</target>
<target name="check_keystore"
description="Checks if the key store for signing the map packs is present">
<available file="keys/keystore.jks" property="keystore.present" />
</target>
<!-- This task is only executed if a java key store is present in the keys
directory -->
<target name="sign_mapsources" depends="build_mapsources,check_keystore"
if="keystore.present">
<!-- The required key stores are not available in SVN and releases! -->
<echo message="Signing map packs using password: ${keystore.password}" />
<for list="${mappacklist}" param="mappack" delimiter=";">
<sequential>
<signjar keystore="keys/keystore.jks" storepass="${keystore.password}"
alias="MapPack" jar="mapsources/mp-@{mappack}.jar" verbose="false" />
</sequential>
</for>
</target>
<target name="create_jar">
<delete file="${jar.name}" />
<jar destfile="${jar.name}" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="${main.class}" />
<attribute name="Class-Path"
value="./ sqlite-jdbc-${sqlite-version}.jar sqlite.jar jai_core.jar jai_codec.jar lib/jai_core.jar lib/jai_codec.jar jai_*.jar lib/jai_*.jar" />
</manifest>
<zipfileset src="lib/log4j-1.2.15.jar" includes="org/apache/log4j/**" />
<zipfileset src="lib/je-${je-version}.jar" />
<zipfileset src="lib/bsh-2.0b4.jar" includes="**/*.class" />
<zipfileset src="lib/commons-codec-1.4.jar" includes="**/*.class" />
<zipfileset src="lib/commons-io-2.0.jar" includes="**/*.class" />
<zipfileset src="lib/commons-lang3-3.1.jar" includes="**/*.class" />
<zipfileset src="lib/javapng-2.0.jar" includes="**/*.class" />
<zipfileset src="lib/Tidy.jar" includes="org/w3c/tidy/**" />
<zipfileset src="lib/itextpdf-5.1.0.jar" includes="com/**" />
<fileset dir="build/mobac">
<exclude name="**/unittest/**" />
<exclude name="mobac/mapsources/mapapcks/**" />
<exclude name="**/*.java" />
</fileset>
</jar>
</target>
<target name="shrink_libraryjars" unless="rtlibraryjar.osx.present">
<property name="rtlibraryjar" value="${rtlibraryjar.non_osx}" />
</target>
<target name="shrink_libraryjars_osx" if="rtlibraryjar.osx.present">
<property name="rtlibraryjar" value="${rtlibraryjar.osx}" />
</target>
<target name="shrink"
depends="create_jar,shrink_libraryjars,shrink_libraryjars_osx"
description="Removes unused classes from compiled jar">
<taskdef resource="proguard/ant/task.properties" classpath="lib/proguard.jar" />
<proguard>
-libraryjars "${rtlibraryjar}"
-injars
"${jar.name}"
-outjars
build/temp.jar
-keepattributes *Annotation*
-keep class ${main.class} {
public static void main(java.lang.String[]); }
-keep class
mobac.program.* { public *; }
-keep class mobac.program.interfaces.* {
public *; }
-keep class mobac.program.model.package-info
-keep class
mobac.program.model.* { public *; }
-keep class mobac.program.jaxb.* {
public *; }
-keep class mobac.program.interfaces.* { public *; }
-keep
class mobac.program.download.UserAgent { public *; }
-keep class
mobac.exceptions.* { public *; }
-keep class
mobac.program.tilestore.berkeleydb.* { *; }
-keep class
mobac.program.tilestore.TileStoreEntry { public *; }
-keep class
mobac.program.atlascreators.AtlasCreator { public *; }
-keep class
mobac.utilities.beanshell.* { public *; }
-keep class
mobac.utilities.tar.TarIndex { public *; }
-keep class
mobac.utilities.tar.TarIndexedArchive { public *; }
-keep class
mobac.data.gpx.gpx11.* { public *; }
-keep class
mobac.mapsources.MapSourceTools { public *; }
-keep class
mobac.mapsources.MapSourceUrlUpdater { public *; }
-keep class
mobac.mapsources.custom.* { *; }
-keep class org.apache.log4j.Layout {
public *; }
-keep class org.apache.log4j.Level { public *; }
-keep
class org.apache.commons.lang3.StringEscapeUtils { public *; }
-keep
class org.apache.log4j.Category { public *; }
-keep class
org.apache.log4j.Priority { public *; }
-keep class
org.apache.log4j.spi.LoggingEvent { public *; }
-keep class
org.apache.log4j.spi.ThrowableInformation { public *; }
-keep class
org.apache.log4j.spi.LocationInfo { public *; }
-keep class
org.apache.log4j.PatternLayout { public *; }
-keep class
org.apache.log4j.Appender { public *; }
-keep class
org.apache.log4j.FileAppender { public *; }
-keep class
com.sixlegs.png.PngImage { public *; }
-keep class bsh.This { public
*; }
-keep class bsh.XThis { public *; }
-keep class
com.sleepycat.persist.PrimaryIndex { public *; }
-keepclassmembers
enum * {
public static **[] values();
public static **
valueOf(java.lang.String);
}
-keepclassmembers class *
implements
java.io.Serializable {
static final long serialVersionUID;
private void
writeObject(java.io.ObjectOutputStream);
private void
readObject(java.io.ObjectInputStream);
java.lang.Object
writeReplace();
java.lang.Object readResolve();
}
-keepclassmembers
class * implements
com.sleepycat.persist.evolve.Conversion {
boolean
equals(java.lang.Object);
}
-dontnote java.**
-dontnote javax.**
-dontnote com.sun.**
-dontnote sun.**
-dontwarn
-dontoptimize
-dontobfuscate
</proguard>
<move file="build/temp.jar" tofile="${jar.name}" overwrite="true" />
</target>
<target name="svnversion"
description="Updates the revision information in src/mobac/mobac.properties"
depends="svnversion_svn">
</target>
<target name="svnversion_svn">
<delete file="${rev.prop.file}" />
<exec executable="svnversion" outputproperty="mobac.revision.new"
searchpath="true" failifexecutionfails="false" />
<property name="mobac.revision.new" value="exported" />
<condition property="mobac.revision.exported">
<equals arg1="${mobac.revision.new}" arg2="exported" />
</condition>
<echo message="MOBAC revision: ${mobac.revision.new}" />
<antcall target="svnversion_write_property_file" />
</target>
<target name="svnversion_write_property_file" unless="mobac.revision.exported">
<propertyfile file="${rev.prop.file}">
<entry key="mobac.revision" value="${mobac.revision.new}" />
</propertyfile>
</target>
<target name="create_release"
description="Packs all necessary files for the binary release into one zip archive">
<zip destfile="${zip.name}" update="false">
<fileset dir="./">
<include name="${jar.name}" />
<include name="gpl.txt" />
<include name="start.jar" />
<include name="README.HTM" />
<include name="ReleaseNotes.txt" />
<include name="CHANGELOG.txt" />
<include name="start.*" />
<include name="Mobile Atlas Creator.exe" />
<include name="mapsources/mp-*.jar" />
</fileset>
<fileset dir="./misc">
<include name="mobac.icns" />
</fileset>
<fileset dir="lib" includes="sqlite-jdbc-${sqlite-version}.jar" />
</zip>
</target>
<target name="create_release_src"
description="Packs all necessary files for the source code release into one zip archive">
<zip destfile="${zip_src.name}" update="false">
<fileset dir="./">
<include name="src/**" />
<exclude name="src/mobac/tools/**" />
<include name="log4j.xml" />
<include name="build.xml" />
<include name="gpl.txt" />
<include name="start.jar" />
<include name="README.HTM" />
<include name="README-DEV.HTM" />
<include name="CHANGELOG.txt" />
<include name="start.sh" />
<include name=".classpath" />
<include name=".project" />
<include name="Mobile Atlas Creator.exe" />
<include name="misc/launch4j.xml" />
<include name="misc/mobac.ico" />
<include name="lib/*.jar" />
</fileset>
</zip>
</target>
</project>