build.android 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  4. assets_dir=assets
  5. ext_dir=$assets_dir/extensions
  6. qa_apk=[% dest_dir %]/[% c('filename') %]/tor-browser-[% c("version") %]-[% c("var/osname") %]-multi-qa.apk
  7. apk=$rootdir/fenix/app-[% c("var/abi") %]-*.apk
  8. test_out_apk=[% dest_dir %]/[% c('filename') %]/tor-browser-[% c("version") %]-[% c("var/osname") %]-androidTest.apk
  9. test_in_apk=$rootdir/fenix/app-*-androidTest.apk
  10. tar xavf $rootdir/[% c('input_files_by_name/fenix') %]
  11. # Bundle our extensions. We treat HTTPS-Everywhere and NoScript differently as
  12. # the former should be an internal extension without getting any updates besides
  13. # from Tor Browser releases. NoScript will be copied over to the profile folder
  14. # being a "regular" browser extension.
  15. mkdir -p /var/tmp/build/$ext_dir [% dest_dir _ '/' _ c('filename') %]
  16. cd /var/tmp/build
  17. unzip -d $ext_dir/https-everywhere $rootdir/[% c('input_files_by_name/https-everywhere') %]
  18. mv $rootdir/[% c('input_files_by_name/noscript') %] $ext_dir/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi
  19. [% IF c("var/verify_allowed_addons") %]
  20. # Check that allowed_addons.json contains the right versions of NoScript and HTTPS Everywhere
  21. # If so, replace the default allowed_addons.json by ours in the apk assets folder.
  22. $rootdir/verify_allowed_addons.py "$rootdir/allowed_addons.json" "$ext_dir/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi" "$rootdir/[% c('input_files_by_name/https-everywhere') %]"
  23. [% END %]
  24. mv $rootdir/allowed_addons.json $assets_dir/allowed_addons.json
  25. [% c('zip', {
  26. zip_src => [ '$assets_dir' ],
  27. zip_args => '$apk',
  28. }) %]
  29. # Sign a QA build. This .apk is not a debug version and doesn't contain a debug
  30. # flag in the manifest.
  31. apksigner 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
  32. apksigner sign --verbose --min-sdk-version [% c("var/android_min_api") %] --ks $rootdir/android-qa.keystore --out $test_out_apk --in $test_in_apk --ks-key-alias androidqakey --key-pass pass:android --ks-pass pass:android