forked from jitsi/jitsi-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
453 lines (400 loc) · 18.6 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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<?xml version="1.0" encoding="UTF-8"?>
<project name="jitsi-android" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
unless="sdk.dir"
/>
<!-- version-tag: custom -->
<import file="${sdk.dir}/tools/ant/build.xml" />
<!--target name="-pre-build">
</target-->
<target name="define-jarjar">
<!-- task to rename packages in jar files -->
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="lib/installer-exclude/jarjar.jar"/>
</target>
<target name="clean" depends="android_rules.clean">
<!-- Clears libs folder -->
<delete dir="libs" />
</target>
<!-- This target should be called after updating Jitsi bundles
inside lib/asset-bundles
-->
<target name="create-asset-dex" depends="define-jarjar">
<getbuildtools name="android.build.tools.dir" />
<property name="dx" location="${android.build.tools.dir}/dx${bat}" />
<!-- Copies lib bundles to temp dir -->
<property name="asset.libs.dir"
value="${out.absolute.dir}/asset-libs" />
<delete dir="${asset.libs.dir}" />
<copy todir="${asset.libs.dir}" >
<fileset dir="lib/asset-bundles" />
</copy>
<!-- renames packages as different versions are used in devices -->
<jarjar jarfile="${asset.libs.dir}/protocol-sip.jar">
<zipfileset src="lib/asset-bundles/protocol-sip.jar"/>
<!-- Reported by Pawel Domas
renaming this strings leads to Exception -
ClassNotFoundException: org.jitsi.gov.nist.org.jitsi.javax.sip.header.HeaderFactoryImpl
The cause is javax.sip.SipFactory constructing the header
factories by name and renaming causes wrong classnames.
-->
<rule pattern="javax.sip.header.HeaderFactoryImpl"
result="javax.sip.header.HeaderFactoryImpl"/>
<rule pattern="javax.sip.message.MessageFactoryImpl"
result="javax.sip.message.MessageFactoryImpl"/>
<rule pattern="javax.sip.address.AddressFactoryImpl"
result="javax.sip.address.AddressFactoryImpl"/>
<rule pattern="javax.sip.**"
result="org.jitsi.javax.sip.@1"/>
<rule pattern="gov.nist.core.**"
result="org.jitsi.gov.nist.core.@1"/>
<rule pattern="gov.nist.javax.sip.**"
result="org.jitsi.gov.nist.javax.sip.@1"/>
<rule pattern="java.awt.**"
result="org.jitsi.android.util.java.awt.@1"/>
</jarjar>
<!-- renaming packages in order to use vanilla smack in android -->
<jarjar jarfile="${asset.libs.dir}/smacklib.jar">
<zipfileset src="lib/asset-bundles/smacklib.jar"/>
<rule pattern="org.xmlpull.v1.**"
result="org.jitsi.org.xmlpull.v1.@1"/>
<!-- Renames missing java.beans classes -->
<rule pattern="java.beans.PropertyDescriptor"
result="org.jitsi.android.util.java.beans.PropertyDescriptor"/>
<rule pattern="java.beans.PropertyEditor"
result="org.jitsi.android.util.java.beans.PropertyEditor"/>
<rule pattern="javax.security.sasl.**"
result="org.apache.harmony.javax.security.sasl.@1"/>
<rule pattern="javax.security.auth.**"
result="org.apache.harmony.javax.security.auth.@1"/>
</jarjar>
<!-- renaming packages in order to use vanilla smack in android -->
<jarjar jarfile="${asset.libs.dir}/protocol-jabber.jar">
<zipfileset src="lib/asset-bundles/protocol-jabber.jar"/>
<rule pattern="org.xmlpull.v1.**"
result="org.jitsi.org.xmlpull.v1.@1"/>
<!-- Renames missing java.beans classes -->
<rule pattern="java.beans.PropertyDescriptor"
result="org.jitsi.android.util.java.beans.PropertyDescriptor"/>
<rule pattern="java.beans.PropertyEditor"
result="org.jitsi.android.util.java.beans.PropertyEditor"/>
<rule pattern="javax.security.sasl.**"
result="org.apache.harmony.javax.security.sasl.@1"/>
<rule pattern="javax.security.auth.**"
result="org.apache.harmony.javax.security.auth.@1"/>
<rule pattern="java.awt.**"
result="org.jitsi.android.util.java.awt.@1"/>
</jarjar>
<!-- Create dex file for library bundles -->
<mkdir dir="${out.absolute.dir}/jitsi_bundles_dex_dir" />
<dex executable="${dx}"
output="${out.absolute.dir}/jitsi_bundles_dex_dir/classes.dex"
verbose="${verbose}" >
<path path="${asset.libs.dir}"/>
</dex>
<!-- Jar asset dex file so it can be consumed by the DexClassLoader. -->
<!-- Package the output in the assets directory of the apk. -->
<jar destfile="${asset.absolute.dir}/jitsi-bundles-dex.jar"
basedir="${out.absolute.dir}/jitsi_bundles_dex_dir" includes="classes.dex" />
<delete dir="${asset.libs.dir}" />
</target>
<!-- before compilation clears libs folder and populated
with all the libraries and binaries we use -->
<target name="setup-libs" depends="create-asset-dex">
<mkdir dir="libs"/>
<!-- fix loading some classes -->
<jarjar jarfile="libs/ui-service.jar">
<zipfileset src="lib/bundles/ui-service.jar"/>
<rule pattern="java.awt.**"
result="org.jitsi.android.util.java.awt.@1"/>
<rule pattern="javax.swing.**"
result="org.jitsi.android.util.javax.swing.@1"/>
<rule pattern="javax.sound.**"
result="org.jitsi.android.util.javax.sound.@1"/>
</jarjar>
<!-- fix loading some classes -->
<jarjar jarfile="libs/protocol.jar">
<zipfileset src="lib/bundles/protocol.jar"/>
<rule pattern="java.awt.**"
result="org.jitsi.android.util.java.awt.@1"/>
<rule pattern="javax.swing.**"
result="org.jitsi.android.util.javax.swing.@1"/>
<rule pattern="javax.sound.**"
result="org.jitsi.android.util.javax.sound.@1"/>
</jarjar>
<!-- fix loading some classes -->
<!-- Added delete as jarjar is not always renaming libjitsi.jar -->
<jarjar jarfile="libs/libjitsi.jar">
<zipfileset src="lib/bundles/libjitsi.jar"/>
<rule pattern="java.awt.**"
result="org.jitsi.android.util.java.awt.@1"/>
<rule pattern="javax.swing.**"
result="org.jitsi.android.util.javax.swing.@1"/>
<rule pattern="javax.sound.**"
result="org.jitsi.android.util.javax.sound.@1"/>
<rule pattern="org.bouncycastle.**"
result="org.jitsi.bouncycastle.@1"/>
</jarjar>
<!-- fix loading some classes -->
<jarjar jarfile="libs/bouncycastle.jar">
<zipfileset src="lib/bundles/bouncycastle.jar"/>
<rule pattern="org.bouncycastle.**"
result="org.jitsi.bouncycastle.@1"/>
</jarjar>
<jarjar jarfile="libs/bccontrib.jar">
<zipfileset src="lib/bundles/bccontrib.jar"/>
<rule pattern="org.bouncycastle.**"
result="org.jitsi.bouncycastle.@1"/>
</jarjar>
<jarjar jarfile="libs/certificate.jar">
<zipfileset src="lib/bundles/certificate.jar"/>
<rule pattern="org.bouncycastle.**"
result="org.jitsi.bouncycastle.@1"/>
</jarjar>
<jarjar jarfile="libs/zrtp4j.jar">
<zipfileset src="lib/bundles/zrtp4j.jar"/>
<rule pattern="org.bouncycastle.**"
result="org.jitsi.bouncycastle.@1"/>
</jarjar>
<jarjar jarfile="libs/otr.jar">
<zipfileset src="lib/bundles/otr.jar"/>
<rule pattern="java.awt.**"
result="org.jitsi.android.util.java.awt.@1"/>
<rule pattern="org.bouncycastle.**"
result="org.jitsi.bouncycastle.@1"/>
<rule pattern="javax.swing.**"
result="org.jitsi.android.util.javax.swing.@1"/>
</jarjar>
<!-- Rename Apache commons codec -->
<jarjar jarfile="libs/commons-codec.jar">
<zipfileset src="lib/bundles/commons-codec.jar"/>
<rule pattern="org.apache.commons.codec.**"
result="org.jitsi.apache.commons.codec.@1"/>
</jarjar>
<jarjar jarfile="libs/sdes4j.jar">
<zipfileset src="lib/bundles/sdes4j.jar"/>
<rule pattern="org.apache.commons.codec.**"
result="org.jitsi.apache.commons.codec.@1"/>
</jarjar>
<!-- Rename org.apache.http -->
<jarjar jarfile="libs/httpcore.jar">
<zipfileset src="lib/bundles/httpcore.jar"/>
<rule pattern="org.apache.http.**"
result="org.jitsi.apache.http.@1"/>
</jarjar>
<jarjar jarfile="libs/httpclient.jar">
<zipfileset src="lib/bundles/httpclient.jar"/>
<rule pattern="org.apache.http.**"
result="org.jitsi.apache.http.@1"/>
</jarjar>
<jarjar jarfile="libs/httputil.jar">
<zipfileset src="lib/bundles/httputil.jar"/>
<rule pattern="org.apache.http.**"
result="org.jitsi.apache.http.@1"/>
</jarjar>
<!-- and finally the stubs we use for common java
packages that are missing in android, in order to
use the desktop version of files without modification
and for easy merging-->
<jarjar jarfile="libs/java-stubs.jar">
<zipfileset src="lib/java-stubs.jar"/>
<rule pattern="java.awt.**"
result="org.jitsi.android.util.java.awt.@1"/>
<!--
We have only PropertyDescriptor and PropertyEditor defined
(the rest is in Android core), so only those 2 classes are
renamed in our bundles(above).
-->
<rule pattern="java.beans.**"
result="org.jitsi.android.util.java.beans.@1"/>
<rule pattern="javax.sound.**"
result="org.jitsi.android.util.javax.sound.@1"/>
<rule pattern="javax.swing.**"
result="org.jitsi.android.util.javax.swing.@1"/>
</jarjar>
<!-- fix loading some classes -->
<jarjar jarfile="libs/resourcemanager.jar">
<zipfileset src="lib/bundles/resourcemanager.jar"/>
<rule pattern="javax.swing.**"
result="org.jitsi.android.util.javax.swing.@1"/>
</jarjar>
<copy todir="libs" verbose="true">
<fileset dir="lib">
<include name="*.jar"/>
<or>
<modified/>
<present present="srconly" targetdir="libs"/>
</or>
</fileset>
<fileset dir="lib/bundles">
<include name="*.jar"/>
<or>
<modified/>
<present present="srconly" targetdir="libs"/>
</or>
</fileset>
<fileset dir="lib/native">
<include name="**/*"/>
<or>
<modified/>
<present present="srconly" targetdir="libs"/>
</or>
</fileset>
</copy>
</target>
<!-- Executed before the build -->
<target name="-pre-build" depends="-manifest-version">
</target>
<!-- Executed after the build -->
<target name="-post-build"
depends="-gen-version-update-props,-restore-manifest">
</target>
<!-- Injects CC build label - it must be integer number -->
<condition property="build.label"
value="${label}">
<isset property="label"/>
</condition>
<!-- Injects build label into AndroidManifest.xml as versionCode
and as the nightly id part of versionName.
Version name syntax: {major}.{minor}.{nightly_id}
-->
<target name="-manifest-version" if="build.label">
<copy file="AndroidManifest.xml"
tofile="AndroidManifest.xml.antbak"
preservelastmodified="true" />
<replaceregexp
file="AndroidManifest.xml"
match='android:versionCode="(\d+)"'
replace='android:versionCode="${build.label}"' />
<replaceregexp
file="AndroidManifest.xml"
match='android:versionName="(\d+\.\d+)\..+"'
replace='android:versionName="\1.${build.label}"'
/>
</target>
<!-- Restores original AndroidManifest.xml -->
<target name="-restore-manifest" if="build.label" >
<move file="AndroidManifest.xml.antbak"
tofile="AndroidManifest.xml"
preservelastmodified="true"
overwrite="true" />
</target>
<!-- Generates versionupdate.properties -->
<target name="-gen-version-update-props" if="link.download.android" >
<!-- Read version from AndroidManifest.xml -->
<loadfile
property="build.version.name"
srcFile="AndroidManifest.xml"
failonerror="true">
<filterchain>
<containsregex pattern='.*android:versionName="(.*)".*'
replace='\1'/>
<deletecharacters chars="\r\n"/>
</filterchain>
</loadfile>
<!-- Generate versionupdate.properties file -->
<propertyfile file="${out.absolute.dir}/versionupdate.properties">
<entry key="last_version" value="${build.version.name}" />
<entry key="download_link" value="${link.download.android}" />
</propertyfile>
</target>
<target name="compile" depends="-compile"/>
<target name="debug-install" depends="debug">
<copy file="./bin/jitsi-android-debug.apk"
tofile="./bin/classes/jitsi-android.apk"/>
</target>
<target name="adb-install">
<exec executable="${sdk.dir}/platform-tools/adb" >
<arg line=" install -r ./bin/jitsi-android-debug.apk"/>
</exec>
</target>
<target name="adb-uninstall">
<exec executable="${sdk.dir}/platform-tools/adb" >
<arg line=" uninstall org.jitsi"/>
</exec>
</target>
<!-- install and starts jitsi apk -->
<target name="adb-install-and-run" depends="adb-install">
<exec executable="${sdk.dir}/platform-tools/adb" >
<arg line=" shell am start -n org.jitsi/org.jitsi.android.gui.LauncherActivity"/>
</exec>
</target>
<target name="make-and-deploy" depends="make,adb-install" />
<!-- Copies/Updates jitsi bundles from the jitsi project path to the
current libs folder. Copies only the bundles that are already present
in the lib/bundles folder.
-->
<target name="copy-jitsi-bundles"
depends="jitsi-path-warning"
if="jitsi.path">
<copy todir="lib/bundles" verbose="true" overwrite="true">
<fileset dir="./${jitsi.path}/sc-bundles">
<include name="*.jar"/>
<!-- Exclude OTR bundle -->
<exclude name="otr.jar" />
<not>
<present present="srconly" targetdir="lib/bundles"/>
</not>
</fileset>
</copy>
<copy todir="lib/asset-bundles" verbose="true" overwrite="true">
<fileset dir="./${jitsi.path}/sc-bundles">
<include name="*.jar"/>
<not>
<present present="srconly" targetdir="lib/asset-bundles"/>
</not>
</fileset>
</copy>
<copy todir="lib/bundles" verbose="true" overwrite="true">
<fileset dir="./${jitsi.path}/sc-bundles/os-specific/android">
<include name="*.jar"/>
<not>
<present present="srconly" targetdir="lib/bundles"/>
</not>
</fileset>
</copy>
</target>
<!-- prints waring if jitsi.path is not set -->
<target name="jitsi-path-warning" unless="jitsi.path">
<echo message=""/>
<echo message="Please specify jitsi.path param.
A relative path from the current folder (-Djitsi.path=~/projects/jitsi)"/>
<echo message=""/>
</target>
<!-- makes the project and creates debug apk -->
<target name="make" depends="compile,debug-install"/>
<!-- cleans and makes project -->
<target name="rebuild" depends="clean,setup-libs,make"/>
<!-- makes, install and runs the project on the default device -->
<target name="run" depends="make,adb-install-and-run"/>
</project>