-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
270 lines (250 loc) · 8.84 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="dist" name="OffRoad">
<property name="ver" value="0.6"/>
<property name="src" location="src"/>
<property name="res" location="res"/>
<property name="lib" location="lib"/>
<property name="build" location="build" />
<property name="dist" location="dist" />
<property name="dist.lib" location="${dist}/lib" />
<property name="OffRoad.jar" location="${dist}/OffRoad.jar"/>
<property name="java_source_version" value="1.8" />
<property name="java_target_version" value="1.8" />
<property name="build.compiler" value="modern" />
<property name="start.class" value="net.sourceforge.offroad.OsmWindow" />
<property name="post" location="post" />
<path id="build-classpath">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
</path>
<!-- - - - - - - - - - - - - - - - - -
target: init
- - - - - - - - - - - - - - - - - -->
<target name="init">
<echo>OffRoad version = ${ver}.</echo>
</target>
<target name="build" depends="init">
<mkdir dir="${build}"/>
<javac includeantruntime="false" srcdir="${src}"
destdir="${build}"
debug="true"
source="${java_source_version}"
target="${java_target_version}"
encoding="utf-8"
>
<classpath refid="build-classpath">
</classpath>
</javac>
<exec executable="git" outputproperty="hash"><arg line="rev-parse HEAD"/></exec>
<echo file="${build}/version.properties" message="version=${ver}">
hash=${hash}
</echo>
</target>
<target name="jar" depends="build">
<mkdir dir="${dist.lib}" />
<jar destfile="${dist.lib}/Resources.jar">
<zipfileset dir="${res}" includes="**" excludes="installer/**"/>
</jar>
<!-- third party libs -->
<copy todir="${dist.lib}">
<fileset dir="${lib}">
<include name="commons-logging-1.1.1.jar"/>
<include name="gnu-trove-osmand.jar"/>
<include name="junidecode-0.1.jar"/>
<include name="json-20090211.jar"/>
<include name="kxml2-2.5.0.jar"/>
<include name="xmlpull-1.1.4.1.jar"/>
<include name="bzip2.jar"/>
<include name="sqlite-jdbc-3.30.1.jar"/>
<include name="commons-lang3-3.4.jar"/>
<include name="jakarta.activation-api-2.0.1.jar"/>
<include name="jakarta.activation-2.0.1.jar"/>
<include name="jakarta.xml.bind-api-3.0.1.jar"/>
<include name="jaxb-runtime-3.0.2.jar"/>
<include name="istack-commons-runtime-4.0.1.jar"/>
<include name="jaxb-core-3.0.2.jar"/>
</fileset>
</copy>
<tempfile prefix="manifest" property="temp.manifest.file"/>
<path id="jar-classpath">
<fileset dir="${dist.lib}">
<include name="*.jar"/>
</fileset>
<fileset dir="${dist}">
<include name="*.jar"/>
</fileset>
</path>
<manifestclasspath property="lib.list" jarfile="${OffRoad.jar}">
<classpath refid="jar-classpath"/>
</manifestclasspath>
<manifest file="${temp.manifest.file}">
<attribute name="Built-By" value="${user.name}" />
<attribute name="Built-Number" value="${ver}" />
<attribute name="Created-By" value="OsmAnd team and Christian Foltin" />
<attribute name="Main-Class" value="${start.class}" />
<!-- <attribute name="Class-Path" value="OffRoad.jar . lib/commons-logging-1.1.1.jar lib/gnu-trove-osmand.jar lib/junidecode-0.1.jar lib/kxml2-2.5.0.jar lib/Resources.jar lib/commons-lang3-3.4.jar"/> -->
<attribute name="Class-Path" value="${lib.list}"/>
</manifest>
<exec command="cat">
<arg value="${temp.manifest.file}"/>
</exec>
<jar jarfile="${OffRoad.jar}"
manifest="${temp.manifest.file}"
update="true">
<metainf dir="META-INF" />
<fileset dir="${build}">
</fileset>
<fileset dir="${src}">
<include name="**/*.xslt"/>
</fileset>
</jar>
<delete file="${temp.manifest.file}" failonerror="false"/>
</target>
<target name="dist" depends="jar">
<copy todir="${dist}">
<fileset dir=".">
<include name="LICENSE"/>
</fileset>
</copy>
</target>
<target name="run" depends="dist">
<condition property="vmarg" value="NODPI">
<not>
<isset property="vmarg"/>
</not>
</condition>
<echo message="vmarg: ${vmarg}">
</echo>
<java fork="yes" dir="${dist}" spawn="false" failonerror="false" maxmemory="1024M" jar="${OffRoad.jar}">
<!-- <jvmarg line="- -add-modules java.se.ee" /> -->
<jvmarg value="-D${vmarg}=true" />
<!-- <jvmarg value="-Djava.util.logging.config.file=commons-logging.properties" /> -->
</java>
</target>
<target name="runh">
<property name="vmarg" value="HIDPI" >
</property>
<antcall target="run" inheritall="true">
</antcall>
</target>
<target name="post" depends="dist">
<mkdir dir="${post}/${ver}" />
<zip destfile="${post}/${ver}/OffRoad-bin-${ver}.zip" includes="lib/*.jar,*.jar,LICENSE" basedir="${dist}">
</zip>
<copy todir="${post}/${ver}">
<fileset dir=".">
<include name="readme.txt"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${build}" quiet="true"/>
<delete dir="${dist}" quiet="true"/>
<delete dir="${post}/${ver}/" quiet="true"/>
</target>
<target name="release" depends="installers_chris">
<echo message="Test for readme.txt for containing ${ver}">
</echo>
<loadfile property="test.readme.updated" srcfile="readme.txt">
<filterchain>
<linecontainsregexp>
<regexp pattern="${ver}" />
</linecontainsregexp>
</filterchain>
</loadfile>
<fail unless="test.readme.updated" message="readme.txt not updated to version ${ver}." />
<echo message="SCP to ${ver}">
</echo>
<exec command="scp">
<arg value="-r" />
<arg value="-v" />
<arg value="${post}/${ver}" />
<arg value="christianfoltin,offroadosm@frs.sourceforge.net:/home/frs/project/o/of/offroadosm/OffRoad_Unstable/." />
</exec>
<echo message="git tag ${ver}">
</echo>
<exec command="git">
<arg value="tag"/>
<arg value="${ver}"/>
</exec>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: create_windows_installer
- - - - - - - - - - - - - - - - - -->
<target name="create_windows_installer">
<ant dir="${inst.windows.installer}" target="${inst.windows.variant}">
</ant>
<exec dir="${inst.windows.installer}" executable="wine" os="Linux">
<arg value="/home/foltin/.wine/drive_c/Programme/Inno Setup 5/ISCC.exe"/>
<arg value="offroad.iss"/>
</exec>
<exec dir="${inst.windows.installer}" executable="wine" os="Mac OS X">
<arg value="/Users/foltin/.wine/drive_c/Programme/Inno Setup 5/ISCC.exe"/>
<arg value="offroad.iss"/>
</exec>
</target>
<!-- =================================
target: installers, for Chris' computers
================================= -->
<target name="installers_chris" depends="" description="--> Creates all installers. This is a task that only works on Chris laptops. But it should be informative to others who want to build the installers">
<property name="gitRoot" value="git://git.code.sf.net/p/offroadosm/code"/>
<property name="macName" value="mahler.local"/>
<property name="inst.dir" location="/tmp/fm_installer"/>
<property name="inst.dest.dir" location="${post}/${ver}"/>
<property name="inst.windows.installer" location="${inst.dir}/res/installer/windows"/>
<mkdir dir="${inst.dest.dir}"/>
<delete dir="${inst.dir}" failonerror="false"/>
<mkdir dir="${inst.dir}"/>
<exec dir="." executable="git">
<arg value="clone"/>
<arg value="${gitRoot}"/>
<arg value="${inst.dir}/"/>
</exec>
<ant dir="${inst.dir}" target="post" inheritall="false" useNativeBasedir="true">
</ant>
<copy todir="${inst.dest.dir}">
<fileset dir="${inst.dir}/post/${ver}">
<include name="**"/>
</fileset>
</copy>
<copy todir="${inst.windows.installer}">
<fileset dir="res/installer/windows/">
<include name="jre_installer.exe"/>
<include name="jre/**"/>
</fileset>
</copy>
<!--
<copy todir="${inst.dir}">
<fileset dir=".">
<include name="**"/>
</fileset>
</copy>
-->
<property name="offroad.version" value="${ver}"/>
<antcall target="create_windows_installer">
<param name="inst.windows.variant" value="installer"/>
</antcall>
<antcall target="create_windows_installer">
<param name="inst.windows.variant" value="installer_java_installer_embedded"/>
</antcall>
<!-- Debian installer -->
<property name="inst.debian.installer" location="${inst.dir}/res/installer/debian/offroad.equivs"/>
<replaceregexp file="${inst.debian.installer}"
match="^Version:.*$"
replace="Version: ${ver}"
byline="true"/>
<exec executable="/usr/bin/equivs-build" os="Linux" dir="${inst.dir}">
<arg value="${inst.debian.installer}"/>
</exec>
<copy todir="${inst.dest.dir}">
<fileset dir="${inst.windows.installer}/Output/">
<include name="*.exe"/>
</fileset>
<fileset dir="${inst.dir}">
<include name="*.deb"/>
</fileset>
</copy>
<delete dir="${inst.dir}" failonerror="false"/>
</target>
</project>