build.android 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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') %]/[% c("var/project-name") %]-[% 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') %]/[% c("var/project-name") %]-[% 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 extensioni(s).
  12. # NoScript will be copied over to the profile folder
  13. # as a "regular" browser extension receiving regular AMO updates.
  14. noscript_path="$ext_dir/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi"
  15. mkdir -p /var/tmp/build/$ext_dir [% dest_dir _ '/' _ c('filename') %]
  16. cd /var/tmp/build
  17. mv $rootdir/[% c('input_files_by_name/noscript') %] "$noscript_path"
  18. [% IF c("var/verify_allowed_addons") %]
  19. # Check that allowed_addons.json contains the right versions of our bundled extension(s).
  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" "$noscript_path"
  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. aligned_apk=$(basename $apk .apk)_aligned.apk
  29. zipalign -vp 4 $apk $aligned_apk
  30. # Sign a QA build. This .apk is not a debug version and doesn't contain a debug
  31. # flag in the manifest.
  32. apksigner sign --verbose --min-sdk-version [% c("var/android_min_api") %] --ks $rootdir/android-qa.keystore --out $qa_apk --in $aligned_apk --ks-key-alias androidqakey --key-pass pass:android --ks-pass pass:android
  33. 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
  34. [%IF c("var/tor-browser") -%]
  35. tor_expert_bundle_src="[% c("input_files_by_name/tor-expert-bundle") %]"
  36. # strip off trailing "$buildid.tar.gz"
  37. tor_expert_bundle_dest=${tor_expert_bundle_src:0:-14}.tar.gz
  38. cp $rootdir/$tor_expert_bundle_src [% dest_dir %]/[% c('filename') %]/$tor_expert_bundle_dest
  39. [% END -%]