forked from servalproject/batphone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
695 lines (623 loc) · 30.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
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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
<?xml version="1.0" encoding="UTF-8"?>
<project name="batphone" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK and NDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- provides all environmental variables as env.FOO -->
<property environment="env"/>
<!-- 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="${env.SERVAL_BATPHONE_ANT_PROPERTIES}" />
<property file="${env.SERVAL_ANT_PROPERTIES}" />
<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" />
<!-- These properties are set in the SDK build.xml but are overridden here with the
same values, so that they are available for other property settings in this
build file before the SDK build.xml is included.
-->
<property name="out.dir" value="bin" />
<property name="out.absolute.dir" location="${out.dir}" />
<condition property="sdk.dir" value="${env.SDK_ROOT}">
<isset property="env.SDK_ROOT"/>
</condition>
<condition property="ndk.dir" value="${env.NDK_ROOT}">
<isset property="env.NDK_ROOT"/>
</condition>
<!-- quick checks on sdk.dir -->
<fail unless="sdk.dir">
Ant property 'sdk.dir' is missing:
- EITHER generate a local.properties file using 'android update project'
- OR set the SDK_ROOT environment variable
</fail>
<fail>
<condition>
<not><available file="${sdk.dir}/tools/android" type="file"/></not>
</condition>
Directory does not appear to be an Android SDK: sdk.dir=${sdk.dir}
- EITHER generate a local.properties file using 'android update project'
- OR set the SDK_ROOT environment variable
</fail>
<!-- quick checks on ndk.dir -->
<fail unless="ndk.dir">
Ant property 'ndk.dir' is missing:
- EITHER set the Ant property 'ndk.dir' in a properties file
- OR set the NDK_ROOT environment variable
</fail>
<fail>
<condition>
<not><available file="${ndk.dir}/ndk-build" type="file"/></not>
</condition>
Directory does not appear to be an Android NDK: ndk.dir=${ndk.dir}
- EITHER set the Ant property 'ndk.dir' in a properties file
- OR set the NDK_ROOT environment variable
</fail>
<!-- version code must be set before loading main_rules.xml -->
<exec executable="sh"
dir="${basedir}"
outputproperty="version.code"
failifexecutionfails="false"
failonerror="true"
logError="true"
>
<arg value="-c"/>
<arg value="git rev-list HEAD | wc -l | sed 's/ //g'"/>
</exec>
<fail>
<condition>
<not><and>
<isset property="version.code"/>
<length string="${version.code}" when="greater" length="0"/>
</and></not>
</condition>
Could not compute version code.
</fail>
<exec executable="${basedir}/jni/serval-dna/version_string.sh"
dir="${basedir}"
outputproperty="version.name"
failifexecutionfails="true"
failonerror="true"
logError="true"
/>
<echo>Version Name: ${version.name}</echo>
<echo>Version Code: ${version.code}</echo>
<!--
For debugging with gdb call "ant clean servald_simple debug"
-->
<target name="servald_simple">
<property name="servald.binary" value="${basedir}/jni/serval-dna/servaldsimple"/>
<property name="ndk.args" value="SERVALD_SIMPLE=1"/>
</target>
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<property name="host.servald" value="${basedir}/jni/serval-dna/servald"/>
<target name="-version-xml">
<echo file="${basedir}/res/values/version.xml" append="false"><?xml version="1.0" encoding="utf-8"?></echo>
<echo file="${basedir}/res/values/version.xml" append="true"><resources></echo>
<echo file="${basedir}/res/values/version.xml" append="true"><string name="version">${version.name}</string></echo>
<property name="manifest.id" value=""/>
<echo file="${basedir}/res/values/version.xml" append="true"><string name="manifest_id">${manifest.id}</string></echo>
<echo file="${basedir}/res/values/version.xml" append="true"></resources></echo>
</target>
<target name="-copy-servald" if="servald.binary">
<copy file="${servald.binary}" tofile="${basedir}/data/bin/servald" overwrite="true" failonerror="true"/>
</target>
<target name="res-zip" depends="-copy-servald">
<copy file="${basedir}/libs/armeabi/adhoc" tofile="${basedir}/data/bin/adhoc" overwrite="true" failonerror="true"/>
<copy file="${basedir}/libs/armeabi/iwconfig" tofile="${basedir}/data/bin/iwconfig" overwrite="true" failonerror="true"/>
<copy file="${basedir}/libs/armeabi/ifconfig" tofile="${basedir}/data/bin/ifconfig" overwrite="true" failonerror="true"/>
<copy file="${basedir}/libs/armeabi/iw" tofile="${basedir}/data/bin/iw" overwrite="true" failonerror="true"/>
<delete file="${basedir}/assets/serval.zip"/>
<zip basedir="${basedir}/data" destfile="${basedir}/assets/serval.zip" level="9"/>
<exec executable="sh" dir="${basedir}" failifexecutionfails="false">
<arg value="-c"/>
<arg value="git ls-files -o -s data/ > assets/manifest"/>
</exec>
</target>
<!-- enforce proper configuration -->
<fail if="key.store">Ant property 'key.store' should not be used:
- Use Ant properties 'android.key.store' and 'debug.android.key.store' instead.
</fail>
<fail if="key.alias">Ant property 'key.alias' should not be used:
- Use Ant properties 'android.key.alias' and 'debug.android.key.alias' instead.
</fail>
<macrodef name="no-secrets-in-config">
<attribute name="build-type"/>
<sequential>
<fail if="@{build-type}.serval.keyring.pin">
Ant property '@{buildtype}.serval.keyring.pin' is not allowed for security reasons:
- Alpha/Beta/Release keyring PINs must not be configured in the clear!
- PINs must be supplied interactively
</fail>
<fail if="@{buildtype}.serval.manifest.secret">
Ant property '@{buildtype}.serval.manifest.secret' is not allowed for security reasons:
- Alpha/Beta/Release manifest secrets must not be configured in the clear!
- Instead, configure a BK and use a keyring (ideally with a PIN):
- Set Ant property 'serval.keyring.path' or '{debug|alpha|beta|release}.serval.keyring.path' to absolute path of Serval keyring file
- Set Ant property 'serval.manifest.author' or '{debug|alpha|beta|release}.serval.manifest.author' to the SID of the signing identity
- Set Ant property '{debug|alpha|beta|release}.serval.manifest.id' to the Manifest ID
- Set Ant property '{debug|alpha|beta|release}.serval.manifest.bk' to the BK of the manifest
- Enter the author's keyring PIN interactively when running Ant
</fail>
</sequential>
</macrodef>
<no-secrets-in-config build-type="alpha"/>
<no-secrets-in-config build-type="beta"/>
<no-secrets-in-config build-type="release"/>
<fail if="serval.manifest.secret">Ant property 'serval.manifest.secret' is not allowed.
- Use 'debug.serval.manifest.secret' for debug builds
</fail>
<macrodef name="config-property">
<attribute name="name"/>
<attribute name="build-type"/>
<attribute name="config-name"/>
<attribute name="allow-generic"/>
<sequential>
<condition property="@{name}" value="${@{build-type}.@{config-name}}">
<and>
<isset property="@{build-type}.@{config-name}"/>
<length string="${@{build-type}.@{config-name}}" when="greater" length="0" />
</and>
</condition>
<fail>
<condition>
<and>
<not><istrue value="@{allow-generic}"/></not>
<isset property="@{config-name}"/>
</and>
</condition>
Ant property '@{config-name}' is not allowed.
- Use '{debug|alpha|beta|release}.@{config-name}' instead
</fail>
<condition property="@{name}" value="${@{config-name}}">
<and>
<istrue value="@{allow-generic}"/>
<isset property="@{config-name}"/>
<length string="${@{config-name}}" when="greater" length="0" />
</and>
</condition>
<condition property="@{name}-echo" value="${@{name}}" else="">
<isset property="@{name}"/>
</condition>
<echo>@{name}=${@{name}-echo}</echo>
</sequential>
</macrodef>
<macrodef name="config-release-build">
<attribute name="type"/>
<sequential>
<property name="build.type" value="@{type}"/>
<echo>build.type=${build.type}</echo>
<config-property name="key.store" config-name="android.key.store" build-type="@{type}" allow-generic="true"/>
<config-property name="key.alias" config-name="android.key.alias" build-type="@{type}" allow-generic="true"/>
<config-property name="keyring.path" config-name="serval.keyring.path" build-type="@{type}" allow-generic="true"/>
<config-property name="manifest.author" config-name="serval.manifest.author" build-type="@{type}" allow-generic="true"/>
<config-property name="manifest.id" config-name="serval.manifest.id" build-type="@{type}" allow-generic="no"/>
<config-property name="manifest.bk" config-name="serval.manifest.bk" build-type="@{type}" allow-generic="no"/>
<!-- override properties in the SDK build.xml to change the name of the APK files produced by the
"debug" and "release" targets -->
<property name="out.unaligned.file" location="${out.absolute.dir}/${ant.project.name}-@{type}-unaligned.apk" />
<property name="out.packaged.file" location="${out.absolute.dir}/${ant.project.name}-@{type}-unsigned.apk" />
<property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-@{type}.apk" />
<property name="out.play.file" location="${out.absolute.dir}/${ant.project.name}-@{type}-play.apk" />
</sequential>
</macrodef>
<macrodef name="enforce-version-regex">
<attribute name="pattern"/>
<text name="text" trim="true"/>
<sequential>
<fail>
<condition>
<not><matches pattern="\A@{pattern}\Z" string="${version.name}"/></not>
</condition>
Version string '${version.name}' is unsuitable for ${build.type} build:
@{text}
</fail>
</sequential>
</macrodef>
<target name="-args-debug">
<config-release-build type="debug"/>
<config-property name="manifest.secret" config-name="serval.manifest.secret" build-type="debug" allow-generic="no"/>
<config-property name="keyring.pin" config-name="serval.keyring.pin" build-type="debug" allow-generic="no"/>
<property name="ndk.args" value="SERVALD_WRAP=1"/>
<property name="servald.binary" value="${basedir}/libs/armeabi/servald"/>
</target>
<target name="-args-alpha">
<property name="need.pandoc" value="true"/>
<config-release-build type="alpha"/>
<property name="upload.subfolder" value="alpha/"/>
<enforce-version-regex pattern="\d+\.\d+(?:\.\d+)?(?:[.-]RC\d+|-pre\d*)(?:-\d+-g[0-9A-Fa-f]{7})?">
- Must look like X.Y[.Z]-pre[N][-C-gXXXXXXX], eg, 0.92-pre, 1.0-pre8-45-g91be7a5
- To tag the current commit: git tag -m 'Pre-release build' X.Y-preN
- Remember to push the tag to GitHub: git push origin X.Y-preN
- Can also alpha build after a beta: X.Y[.Z]-RCN[-C-gXXXXXXX], eg, 0.94-RC2-8-g61fefa7
</enforce-version-regex>
</target>
<target name="-args-beta">
<property name="need.pandoc" value="true"/>
<config-release-build type="beta"/>
<property name="upload.subfolder" value="beta/"/>
<enforce-version-regex pattern="\d+\.\d+(?:\.\d+)?[.-]RC\d+">
- Must look like X.Y[.Z]-RCN, eg, 0.94-RC2 or 1.7-RC3
- To tag the current commit with the version string: git tag -m 'Release candidate' X.Y-RCN
- Remember to push the tag to GitHub: git push origin X.Y-RCN
</enforce-version-regex>
</target>
<target name="-args-release">
<property name="need.pandoc" value="true"/>
<config-release-build type="release"/>
<property name="upload.subfolder" value=""/>
<enforce-version-regex pattern="\d+\.\d+(?:\.\d+)?">
- Must look like X.Y[.Z], eg, 0.94.1 or 1.2
- To tag the current commit with the version string: git tag -m 'Release' X.Y
- Remember to push the tag to GitHub: git push origin X.Y
</enforce-version-regex>
</target>
<target name="-keystore-properties">
<!-- properties for signing in release mode -->
<!-- this code copied from the SDK build.xml to force re-computation of
'has.keystore' and 'has.password' at target execution time after key.store
and key.alias have been set
-->
<condition property="has.keystore">
<and>
<isset property="key.store" />
<length string="${key.store}" when="greater" length="0" />
<isset property="key.alias" />
</and>
</condition>
<condition property="has.password">
<and>
<isset property="has.keystore" />
<isset property="key.store.password" />
<isset property="key.alias.password" />
</and>
</condition>
</target>
<target name="-has-pandoc">
<exec executable="pandoc" failifexecutionfails="false" failonerror="false" resultproperty="-pandoc-result" logError="true" outputproperty="-pandoc-version">
<arg value="--version"/>
</exec>
<property name="-pandoc-result" value="1"/>
<condition property="has.pandoc" value="true">
<equals arg1="${-pandoc-result}" arg2="0"/>
</condition>
</target>
<target name="-check-pandoc" depends="-has-pandoc" if="need.pandoc">
<fail>
<condition>
<not><isset property="has.pandoc" /></not>
</condition>
Missing pandoc(1) utility
- See http://johnmacfarlane.net/pandoc/installing.html
</fail>
</target>
<macrodef name="markdown-to-html">
<attribute name="title"/>
<attribute name="src"/>
<attribute name="dst"/>
<sequential>
<exec executable="pandoc" logError="true" failonerror="true">
<arg value="-f"/>
<arg value="markdown_github-hard_line_breaks+fancy_lists+startnum"/>
<arg value="-t"/>
<arg value="html"/>
<arg value="--standalone"/>
<arg value="--css"/>
<arg value="servalhelp.css"/>
<arg value="--variable"/>
<arg value="pagetitle:Serval Help: @{title}"/>
<arg value="--variable"/>
<arg value='header-includes:<meta name="description" content="Serval App WebView Page" />'/>
<arg value="--output"/>
<arg value="${basedir}/@{dst}"/>
<arg value="${basedir}/@{src}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="markdown-to-help-html">
<attribute name="title"/>
<attribute name="src"/>
<sequential>
<echo>Generate help : assets/@{src}</echo>
<markdown-to-html src="@{src}" dst="assets/@{src}" title="@{title}" />
</sequential>
</macrodef>
<target name="generate-html" depends="-has-pandoc,-remove-html,-generate-html">
</target>
<target name="-generate-html" if="has.pandoc">
<copy file="cc-by-4.0.png" todir="assets" />
<markdown-to-help-html src="CURRENT-RELEASE.md" title="Release Notes" />
<markdown-to-help-html src="CREDITS.md" title="Credits" />
<markdown-to-help-html src="LICENSE-SOFTWARE.md" title="Software License" />
<markdown-to-help-html src="LICENSE-DOCUMENTATION.md" title="Documentation License" />
<markdown-to-help-html src="CC-BY-4.0.md" title="Documentation License" />
<markdown-to-help-html src="PRIVACY.md" title="Privacy Policy" />
</target>
<target name="-remove-html">
<delete file="${basedir}/assets/CURRENT-RELEASE.md" verbose="true" quiet="true" />
<delete file="${basedir}/assets/CREDITS.md" verbose="true" quiet="true" />
<delete file="${basedir}/assets/LICENSE-SOFTWARE.md" verbose="true" quiet="true" />
<delete file="${basedir}/assets/LICENSE-DOCUMENTATION.md" verbose="true" quiet="true" />
<delete file="${basedir}/assets/CC-BY-4.0.md" verbose="true" quiet="true" />
<delete file="${basedir}/assets/PRIVACY.md" verbose="true" quiet="true" />
</target>
<target name="-play-apk">
<copy file="${out.final.file}" tofile="${out.play.file}" overwrite="true" failonerror="true"/>
</target>
<target name="-serval-instance" unless="serval.instance.path">
<property name="delete.serval.instance" value="true"/>
<property name="serval.instance.path" value="${out.absolute.dir}/instance/"/>
<mkdir dir="${serval.instance.path}" />
<concat destfile="${serval.instance.path}/serval.conf">log.file.path=serval.log
</concat>
</target>
<target name="-remove-instance" if="delete.serval.instance">
<delete dir="${serval.instance.path}"/>
</target>
<target name="-check-keyring-path" unless="manifest.secret">
<fail>
<condition>
<not><and>
<isset property="keyring.path" />
<length string="${keyring.path}" when="greater" length="0" />
</and></not>
</condition>
Serval keyring path is not configured:
- Set Ant property 'serval.keyring.path' or '${build.type}.serval.keyring.path' to absolute path of Serval keyring file
</fail>
<fail>
<condition>
<not> <resourceexists> <file file="${keyring.path}" /> </resourceexists> </not>
</condition>
Keyring file does not exist: ${keyring.path}
</fail>
</target>
<target name="-check-keyring-author" unless="manifest.secret">
<fail>
<condition>
<not><and>
<isset property="manifest.author" />
<length string="${manifest.author}" when="greater" length="0" />
</and></not>
</condition>
Serval signing identity is not configured:
- Set Ant property 'serval.manifest.author' or '${build.type}.serval.manifest.author' to SID of signing identity
- The configured SID must be in the keyring file: ${keyring.path}
</fail>
</target>
<target name="-check-keyring" depends="-check-keyring-path,-check-keyring-author" unless="manifest.secret">
</target>
<target name="-get-keyring-pin" unless="manifest.secret">
<input message="Please enter Serval ${build.type} PIN:" addproperty="keyring.pin" />
</target>
<target name="-check-manifest-author" depends="-check-keyring,-serval-instance,-get-keyring-pin" unless="manifest.secret">
<fail>
<condition>
<not><and>
<isset property="manifest.author"/>
<length string="${manifest.author}" when="greater" length="0" />
</and></not>
</condition>
Ant property 'manifest.author' is not set -- bug in build.xml.
</fail>
<exec executable="${basedir}/jni/serval-dna/servald" failonerror="true" logError="true" outputproperty="-keyring-list">
<env key="SERVALINSTANCE_PATH" value="${serval.instance.path}"/>
<env key="SERVALD_KEYRING_PATH" value="${keyring.path}"/>
<env key="SERVALD_KEYRING_READONLY" value="true"/>
<arg value="keyring"/>
<arg value="list"/>
<arg line="--entry-pin=${keyring.pin}"/>
</exec>
<condition property="keyring.pin.desc" value=" with entry PIN '${keyring.pin}'">
<length string="${keyring.pin}" when="greater" length="0" />
</condition>
<property name="keyring.pin.desc" value=" with no keyring PINs" />
<fail>
<condition>
<not><contains string="${-keyring-list}" substring="${manifest.author}" casesensitive="false"/></not>
</condition>
Author SID ${manifest.author} is not in keyring:
- Keyring is: ${keyring.path}
- Ensure keyring contains the identity SID=${manifest.author}${keyring.pin.desc}
</fail>
</target>
<target name="-check-manifest-id">
<condition property="manifest.secret.desc" value=" or '${build.type}.serval.manifest.secret'">
<or>
<equals arg1="${build.type}" arg2="debug" />
</or>
</condition>
<property name="manifest.secret.desc" value="" />
<fail>
<condition><not><and>
<isset property="manifest.id"/>
<length string="${manifest.id}" when="greater" length="0" />
</and></not></condition>
Manifest ID has not been configured for signed ${build.type} builds:
- Create a new Manifest ID by adding an empty file to Rhizome, note the reported 'manifestid'
- Set Ant property '${build.type}.serval.manifest.id'
- Set Ant property '${build.type}.serval.manifest.bk'${manifest.secret.desc}
</fail>
</target>
<target name="-check-manifest-secret">
<fail>
<condition>
<and>
<isset property="manifest.secret"/>
<isset property="manifest.bk"/>
</and>
</condition>
Ant properties '${build.type}.serval.manifest.bk' and '${build.type}.serval.manifest.secret' are both set:
- Only one or the other should be configured
</fail>
</target>
<target name="-check-manifest-bk" unless="manifest.secret">
<fail>
<condition><not><and>
<isset property="manifest.bk"/>
<length string="${manifest.bk}" when="greater" length="0" />
</and></not></condition>
Manifest BK (Bundle Key) has not been configured for signed ${build.type} builds:
- Extract the Manifest from Rhizome with ID ${manifest.id}
- Set Ant property '${build.type}.serval.manifest.bk' to the BK field from the Manifest
</fail>
</target>
<target name="-check-manifest" depends="-check-manifest-id,-check-manifest-secret,-check-manifest-bk,-check-manifest-author"/>
<target name="-create-manifest" depends="-serval-instance,-check-manifest,-get-keyring-pin,-create-initial-manifest,-add-manifest,-append-manifest"/>
<target name="-create-initial-manifest">
<!-- Make sure parameters are blank if not supplied -->
<property name="serval.manifest.file" value="${out.final.file}.manifest"/>
<condition property="manifest.id.line" value="id=${manifest.id} ">
<and>
<isset property="manifest.id"/>
<length string="${manifest.id}" when="greater" length="0" />
</and>
</condition>
<property name="manifest.id.line" value=""/>
<condition property="manifest.bk.line" value="BK=${manifest.bk} ">
<and>
<isset property="manifest.bk"/>
<length string="${manifest.bk}" when="greater" length="0" />
</and>
</condition>
<property name="manifest.bk.line" value=""/>
<condition property="manifest.version.line" value="version=${manifest.version} ">
<and>
<isset property="manifest.version"/>
<length string="${manifest.version}" when="greater" length="0" />
</and>
</condition>
<property name="manifest.version.line" value=""/>
<!-- Construct initial manifest file -->
<echo file="${out.final.file}.manifest" append="false">name=Serval-${version.name}.apk
service=file
${manifest.id.line}${manifest.bk.line}${manifest.version.line}</echo>
</target>
<target name="-add-manifest" depends="-add-manifest-with-bk,-add-manifest-with-secret"/>
<target name="-add-manifest-with-bk" unless="manifest.secret">
<!-- Add the apk to our local rhizome store -->
<exec executable="${basedir}/jni/serval-dna/servald" failonerror="true">
<env key="SERVALINSTANCE_PATH" value="${serval.instance.path}"/>
<env key="SERVALD_KEYRING_PATH" value="${keyring.path}"/>
<env key="SERVALD_KEYRING_READONLY" value="true"/>
<arg value="rhizome"/>
<arg value="add"/>
<arg value="file"/>
<arg line="--entry-pin=${keyring.pin}"/>
<arg value="${manifest.author}"/>
<arg file="${out.final.file}"/>
<arg file="${out.final.file}.manifest"/>
</exec>
</target>
<target name="-add-manifest-with-secret" if="manifest.secret">
<!-- Add the apk to our local rhizome store -->
<exec executable="${basedir}/jni/serval-dna/servald" failonerror="true">
<env key="SERVALINSTANCE_PATH" value="${serval.instance.path}"/>
<arg value="rhizome"/>
<arg value="add"/>
<arg value="file"/>
<arg value=""/>
<arg file="${out.final.file}"/>
<arg file="${out.final.file}.manifest"/>
<arg value="${manifest.secret}"/>
</exec>
</target>
<target name="-append-manifest">
<!-- Append the payload and manifest into a single file -->
<exec executable="${basedir}/jni/serval-dna/servald" failonerror="true">
<env key="SERVALINSTANCE_PATH" value="${serval.instance.path}"/>
<arg value="rhizome"/>
<arg value="append"/>
<arg value="manifest"/>
<arg file="${out.final.file}"/>
<arg file="${out.final.file}.manifest"/>
</exec>
</target>
<target name="debug" depends="-args-debug,android_rules.debug"/>
<target name="debug-autoup" depends="-args-debug,-keystore-properties,-check-manifest,debug,-create-manifest,-remove-instance"/>
<target name="alpha" depends="-args-alpha,-check-pandoc,-keystore-properties,-check-manifest,android_rules.release,-create-manifest,-remove-instance"/>
<target name="beta" depends="-args-beta,-check-pandoc,-keystore-properties,-check-manifest,android_rules.release,-play-apk,-create-manifest,-remove-instance"/>
<target name="release" depends="-args-release,-check-pandoc,-keystore-properties,-check-manifest,android_rules.release,-play-apk,-create-manifest,-remove-instance"/>
<target name="upload-alpha" depends="-args-alpha,-upload"/>
<target name="upload-beta" depends="-args-beta,-upload"/>
<target name="upload-release" depends="-args-release,-upload"/>
<target name="-upload">
<property name="upload.subfolder" value="misc/"/>
<exec executable="scp" dir="${basedir}">
<arg value="${out.final.file}"/>
<arg value="${webserver}/${upload.subfolder}Serval_Mesh-${version.name}.apk"/>
</exec>
</target>
<target name="ndk-build">
<property name="ndk.args" value=""/>
<exec executable="${ndk.dir}/ndk-build" failonerror="true">
<arg line="${ndk.args}"/>
</exec>
</target>
<target name="-pre-build" depends="-version-xml,ndk-build,generate-html,res-zip" />
<target name="clean-all" depends="clean">
<exec executable="${ndk.dir}/ndk-build" failonerror="true">
<arg value="clean"/>
</exec>
<delete file="${basedir}/data/bin/adhoc" quiet="true"/>
<delete file="${basedir}/data/bin/servald" quiet="true"/>
<delete file="${basedir}/data/bin/iw" quiet="true"/>
<delete file="${basedir}/data/bin/ifconfig" quiet="true"/>
</target>
<target name="servaldna-java">
<javac
srcdir="jni/serval-dna/java"
excludes="org/servalproject/test/**"
destdir="bin/classes"
target="1.5"
source="1.5"
debug="true"
/>
</target>
<target name="-pre-compile" depends="servaldna-java"/>
<!--
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
<target name="-post-compile">
</target>
-->
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: custom -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>