build.android 2 KB
Newer Older
1
2
3
#!/bin/bash
[% c("var/set_default_env") -%]
ext_dir=assets/distribution/extensions
4
qa_apk=[% dest_dir %]/[% c('filename') %]/tor-browser-[% c("version") %]-[% c("var/osname") %]-multi-qa.apk
5
6
7
8
9
10
11
12
apk=$rootdir/[% c('input_files_by_name/firefox') %]/tor-browser-unsigned-unaligned.apk

mkdir -p /var/tmp/build/$ext_dir [% dest_dir _ '/' _ c('filename') %]
cd /var/tmp/build

mv $rootdir/[% c('input_files_by_name/https-everywhere') %] $ext_dir/https-everywhere-eff@eff.org.xpi
mv $rootdir/[% c('input_files_by_name/noscript') %] $ext_dir/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi

13
14
15
16
[% c('zip', {
        zip_src => [ '$ext_dir' ],
        zip_args => '$apk',
    }) %]
17
18
unzip $apk lib/*
zip -d $apk lib/\*
19
20

[% IF c("var/android-x86") %]
21
22
23
24
    [% c('zip', {
          zip_src => [ 'lib/x86/*' ],
          zip_args => '$apk',
       }) %]
25
26
27
28
29
[% ELSIF c("var/android-x86_64") %]
    [% c('zip', {
          zip_src => [ 'lib/x86_64/*' ],
          zip_args => '$apk',
       }) %]
30
[% ELSIF c("var/android-armv7") %]
31
32
33
34
    [% c('zip', {
          zip_src => [ 'lib/armeabi-v7a/*' ],
          zip_args => '$apk',
       }) %]
35
36
37
38
39
[% ELSIF c("var/android-aarch64") %]
    [% c('zip', {
          zip_src => [ 'lib/arm64-v8a/*' ],
          zip_args => '$apk',
       }) %]
40
41
[% END %]

42
43
rm -fR lib

44
45
46
47
48
49
50
51
52
53
54
55
56
# Bug 31564: Android Gradle Plugin has a reproducibility bug. Decompile and recompile to fix ordering of resources.arsc files
apktool=$rootdir/[% c('input_files_by_name/apktool') %]
java -jar $apktool d --no-src -o decompiled $apk
java -jar $apktool b -o $apk decompiled
# Fix timestamps and remove extra field info from zip entries
unzip $apk -d tmp
rm $apk
cd tmp
[% c('zip', {
   zip_src => [ '.' ],
   zip_args => '$apk',
   }) %]

57
# Sign a QA build. This apk is not a debug version and doesn't contain a debug flag in the manifest
58
java -jar /usr/share/apksigner/apksigner.jar sign --verbose --min-sdk-version [% c("var/android_min_api") %] --ks $rootdir/android-qa.keystore --out $qa_apk --in $apk --ks-key-alias androidqakey --key-pass pass:android --ks-pass pass:android