-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
358 lines (330 loc) · 15.4 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
<!-- build.xml for ChartBundler.jar
it includes ChartBundler and all used libraries
ChartBase
-->
<project default="all" name="Compile and build java classes plus jar archives">
<property name="app.name" value="OSeaMChartBundler" />
<property name="app.shname" value="osmcb" />
<property file="src/main/resources/${app.shname}/${app.shname}.properties" />
<property name="jar.name" value="${app.name}.jar" />
<property name="zip.name" value="${app.name}${osmcb.version}.zip" />
<property name="zip_src.name" value="${app.name}${osmcb.version}src.zip" />
<property name="starter.class" value="${app.shname}.StartOSMCB" />
<property name="rev.prop.file" value="src/main/resources/${app.shname}/${app.shname}-rev.properties" />
<property file="src/main/resources/${app.shname}/${app.shname}.properties" />
<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}" />
<property name="osmb.dir" value="../OSeaMChartBase" />
<property name="osmb.jarname" value="OSeaMChartBase.jar" />
<property name="osmcb.dir" value="../OSeaMChartBundler" />
<property name="src.dir" value="src/main/java" />
<!-- <property name="resrc.dir" value="src/osmcd/resources" /> -->
<property name="build.dir" value="bin" />
<property name="osmcb.srcdir" value="${osmcb.dir}/src/main/java" />
<property name="mp.srcdir" value="${osmcb.srcdir}/osmcb/mapsources/mappacks" />
<property name="mp.builddir" value="${osmcb.dir}/build" />
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<!-- Java target version -->
<property name="java-target" value="1.8" />
<!-- version dependent libraries -->
<property name="je-version" value="3.3.93" />
<property name="sqlite-version" value="3.8.11.1" />
<path id="maincp">
<fileset dir="${osmb.dir}/lib" includes="log*.jar" />
<fileset dir="${osmb.dir}/lib" includes="jai*.jar" />
<fileset dir="${osmb.dir}/lib" includes="bsh-2.0b4.jar" />
<fileset dir="${osmb.dir}/lib" includes="Tidy.jar" />
<fileset dir="${osmb.dir}/lib" includes="javapng-2.0.jar" />
<fileset dir="${osmb.dir}/lib" includes="itextpdf-5.1.0.jar" />
<fileset dir="${osmb.dir}/lib" includes="commons-codec-1.4.jar" />
<fileset dir="${osmb.dir}/lib" includes="commons-io-2.0.jar" />
<fileset dir="${osmb.dir}/lib" includes="commons-lang3-3.1.jar" />
<fileset dir="${osmb.dir}/lib" includes="je-${je-version}.jar" />
<fileset dir="${osmb.dir}/lib" includes="json-20170516.jar" />
<fileset dir="${osmb.dir}/build" includes="${osmb.jarname}" />
</path>
<!-- Targets -->
<!-- <target name="all" depends="clean_build,svnversion,build,build_mapsources,sign_mapsources,create_jar,shrink,create_release,create_release_src" /> -->
<target name="all" depends="clean_build,build,create_jar,create_release,create_release_src" />
<!-- <target name="update_mapsources" depends="build_mapsources,sign_mapsources" /> -->
<target name="clean_workspace" description="Deletes the work directories">
<delete includeemptydirs="true" failonerror="false">
<!--<fileset dir="atlases" includes="**/*" />-->
<fileset dir="${build.dir}" includes="**/*" />
<!--<fileset dir="tilestore" includes="**/*" />-->
</delete>
</target>
<target name="clean_build">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${build.dir}" includes="**/*" />
</delete>
</target>
<target name="delete_build" description="Deleted the entire build folder">
<delete failonerror="yes" dir="${build.dir}" />
</target>
<target name="build">
<mkdir dir="${build.dir}" />
<!-- Compile the starter class for Java ${java-target} (shows an verbose error if the JRE requirements are not met -->
<javac srcdir="${src.dir}"
destdir="${build.dir}"
target="${java-target}"
source="${java-target}"
debug="true"
includeantruntime="false"
encoding="UTF-8"
listfiles="yes">
<!-- [javac] Note: Some input files use unchecked or unsafe operations.
unchecked call to JComboBox(E[]) ...
<compilerarg value="-Xlint:unchecked"/> -->
<classpath refid="maincp" />
<include name="${app.shname}/StartOSMCB.java" />
</javac>
<!-- Compile the other classes for Java ${java-target} -->
<!-- <javac srcdir="${src.dir}" destdir="${build.dir}/osmcb" target="${java-target}" source="${java-target}" debug="true" includeantruntime="false" encoding="UTF-8"> -->
<javac srcdir="${src.dir}"
destdir="${build.dir}"
target="${java-target}"
source="${java-target}"
debug="true"
includeantruntime="false"
encoding="UTF-8"
listfiles="yes">
<classpath refid="maincp" />
<exclude name="${app.shname}/StartOSMCB.java" />
<exclude name="${osmcb.mpsrcdir}/**" />
<include name="${app.shname}/**" />
</javac>
<copy todir="${build.dir}" overwrite="true">
<fileset dir="src/main/resources" excludes="**/mapsources.properties" />
</copy>
</target>
<!-- mappack runtime location is: ${ProgDir}/mapsources
src code is located at ../OSeaMChartDesigner/src/main/java/osmcb/mapsources/mappacks/@{mappack}
build location is ../OSeaMChartDesigner/build/osmcb/mapsources/mappacks/@{mappack} -->
<!--<target name="build_mapsources" depends="clean_build,build,svnversion" description="Build all map packs and generate the new mappacks-md5.txt">-->
<!--
<target name="build_mapsources" description="Build all map packs and generate the new mappacks-md5.txt">
<property file="keys/keystore.properties" />
<taskdef name="for" classname="net.sf.antcontrib.logic.ForTask">
<classpath>
<pathelement location="${osmb.dir}/lib/ant-contrib-for.jar" />
</classpath>
</taskdef>
<delete dir="${osmcb.dir}/mapsources" includes="mp-*.jar" />
<dirset id="mappacks" dir="${mp.srcdir}/" includes="*" />
<pathconvert pathsep=";" property="mappacklist" refid="mappacks">
<mapper type="flatten" />
</pathconvert>
<mkdir dir="${osmcb.dir}/mapsources" />
<echo file="mapsources/mappacks-md5.txt" append="false" message="" />
<for list="${mappacklist}" param="mappack" delimiter=";">
<sequential>
<echo message="map pack: '@{mappack}'" />
<echo message="map pack dir: '${mp.builddir}'" />
<mkdir dir="${mp.builddir}" />
<uptodate property="@{mappack}.newer" targetfile="${osmcb.dir}/mapsources/mp-@{mappack}.jar">
<srcfiles dir="${mp.srcdir}/@{mappack}" />
</uptodate>
-->
<!--<echo message="No changes in map pack detected: '@{mappack}'" unless="@{mappack}.newer" />-->
<!--
<echo message="compile map pack: '@{mappack}'" />
<javac srcdir="src/main/java" destdir="${mp.builddir}/" defaultexcludes="true" debug="true" target="${java-target}" source="${java-target}" includeantruntime="false" encoding="UTF-8">
<include name="${mp.srcdir}/@{mappack}/**.java" />
<classpath>
<path refid="maincp" />
<path path="${osmcb.dir}/build/osmcb" />
</classpath>
</javac>
<delete file="${osmcb.dir}/mapsources/mp-@{mappack}.jar" failonerror="false" />
<fileset dir="${mp.builddir}" defaultexcludes="true" id="fileset-@{mappack}">
<include name="osmcb/mapsources/mappacks/@{mappack}/**.class" />
</fileset>
<echo message="build map pack jar: 'mp-@{mappack}.jar'" />
<jar destfile="${osmcb.dir}/mapsources/mp-@{mappack}.jar">
<manifest>
<attribute name="MapPackVersion" value="${osmcb.mappackversion}" />
<attribute name="MapPackName" value="@{mappack}" />
<attribute name="MapPackBuild-Date" value="${build.date}" />
<attribute name="MapPackRevision" value="${osmcb.revision.new}" />
</manifest>
<fileset refid="fileset-@{mappack}" />
<zipfileset dir="${mp.srcdir}/@{mappack}/" includes="mapsources.list" fullpath="META-INF/services/${app.shname}.program.interfaces.IfMapSource" />
</jar>
<echo message="update md5-txt: '@{mappack}'" />
<checksum algorithm="MD5" totalproperty="MD5-@{mappack}">
<fileset refid="fileset-@{mappack}" />
</checksum>
<echo file="${osmcb.dir}/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" depends="build" >
<delete file="${jar.name}" />
<jar destfile="${jar.name}" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="${starter.class}" />
<attribute name="Class-Path" value="./ sqlite-jdbc-${sqlite-version}.jar sqlite.jar jai_core.jar jai_codec.jar ${osmb.dir}/lib/jai_core.jar ${osmb.dir}/lib/jai_codec.jar jai_*.jar ${osmb.dir}/lib/jai_*.jar" />
</manifest>
<zipfileset src="${osmb.dir}/lib/log4j-1.2.15.jar" includes="org/apache/log4j/**" />
<zipfileset src="${osmb.dir}/lib/je-${je-version}.jar" />
<zipfileset src="${osmb.dir}/lib/bsh-2.0b4.jar" includes="**/*.class" />
<zipfileset src="${osmb.dir}/lib/commons-codec-1.4.jar" includes="**/*.class" />
<zipfileset src="${osmb.dir}/lib/commons-io-2.0.jar" includes="**/*.class" />
<zipfileset src="${osmb.dir}/lib/commons-lang3-3.1.jar" includes="**/*.class" />
<zipfileset src="${osmb.dir}/lib/javapng-2.0.jar" includes="**/*.class" />
<zipfileset src="${osmb.dir}/lib/Tidy.jar" includes="org/w3c/tidy/**" />
<zipfileset src="${osmb.dir}/lib/itextpdf-5.1.0.jar" includes="com/**" />
<zipfileset src="${osmb.dir}/build/${osmb.jarname}" includes="**/*.*" />
<fileset dir="${build.dir}">
<exclude name="**/unittest/**" />
<exclude name="${app.shname}/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="${osmb.dir}/lib/proguard.jar" />
<proguard>
-libraryjars "${rtlibraryjar}"
-injars
"${jar.name}"
-outjars
build/temp.jar
-keepattributes *Annotation*
-keep class ${starter.class} { public static void main(java.lang.String[]); }
-keep class osmcb.program.* { public *; }
-keep class osmcb.program.interfaces.* { public *; }
-keep class osmcb.program.abstracts.* { public *; }
-keep class osmcb.program.model.package-info
-keep class osmcb.program.model.* { public *; }
-keep class osmcb.program.jaxb.* { public *; }
-keep class osmcb.program.interfaces.* { public *; }
-keep class osmcb.program.download.UserAgent { public *; }
-keep class osmcb.exceptions.* { public *; }
-keep class osmcb.program.tilestore.berkeleydb.* { *; }
-keep class osmcb.program.tilestore.TileStoreEntry { public *; }
-keep class osmcb.program.bundlecreators.ACBundleCreator { public *; }
-keep class osmcd.utilities.beanshell.* { public *; }
-keep class osmcb.utilities.tar.TarIndex { public *; }
-keep class osmcb.utilities.tar.TarIndexedArchive { public *; }
-keep class osmcb.data.gpx.gpx11.* { public *; }
-keep class osmcb.mapsources.MapSourceTools { public *; }
-keep class osmcb.mapsources.MapSourceUrlUpdater { public *; }
-keep class osmcb.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_write_property_file" unless="${app.shname}.revision.exported">-->
<target name="svnversion_write_property_file">
<propertyfile file="${rev.prop.file}">
<entry key="${app.shname}.revision" value="${osmcb.revision.new}" />
</propertyfile>
</target>
<target name="create_release" depends="create_jar" 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="CHANGELOG.txt" />
<include name="start.*" />
<include name="${app.name}.exe" />
<include name="mapsources/mp-*.jar" />
</fileset>
<fileset dir="./misc">
<include name="${app.shname}.icns" />
</fileset>
<fileset dir="${osmb.dir}/lib" includes="sqlite-jdbc-${sqlite-version}.jar" />
</zip>
</target>
<target name="create_release_src" depends="create_jar" 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/${app.shname}/tools/**" />
<include name="log4j.xml" />
<include name="build.xml" />
<include name="gpl.txt" />
<include name="start.jar" />
<include name="CHANGELOG.txt" />
<include name="start.sh" />
<include name=".classpath" />
<include name=".project" />
<include name="${app.name}.exe" />
<include name="misc/launch4j.xml" />
<include name="misc/${app.shname}.ico" />
<include name="${osmb.dir}/lib/*.jar" />
</fileset>
</zip>
</target>
</project>