build.android 2.2 KB

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