OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # |
| 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 """Signs and zipaligns split APKs. |
| 7 |
| 8 This script is require only by GYP (not GN). |
| 9 """ |
| 10 |
| 11 import optparse |
| 12 import sys |
| 13 |
| 14 import finalize_apk |
| 15 from util import build_utils |
| 16 |
| 17 def main(): |
| 18 parser = optparse.OptionParser() |
| 19 parser.add_option('--zipalign-path', help='Path to the zipalign tool.') |
| 20 parser.add_option('--resource-packaged-apk-path', |
| 21 help='Base path to input .ap_s.') |
| 22 parser.add_option('--base-output-path', |
| 23 help='Path to output .apk, minus extension.') |
| 24 parser.add_option('--key-path', help='Path to keystore for signing.') |
| 25 parser.add_option('--key-passwd', help='Keystore password') |
| 26 parser.add_option('--key-name', help='Keystore name') |
| 27 parser.add_option('--densities', |
| 28 help='Comma separated list of densities finalize.') |
| 29 parser.add_option('--languages', |
| 30 help='GYP list of language splits to finalize.') |
| 31 |
| 32 options, _ = parser.parse_args() |
| 33 options.load_library_from_zip = 0 |
| 34 |
| 35 if options.densities: |
| 36 for density in options.densities.split(','): |
| 37 options.unsigned_apk_path = ("%s_%s" % |
| 38 (options.resource_packaged_apk_path, density)) |
| 39 options.final_apk_path = ("%s-density-%s.apk" % |
| 40 (options.base_output_path, density)) |
| 41 finalize_apk.FinalizeApk(options) |
| 42 |
| 43 if options.languages: |
| 44 for lang in build_utils.ParseGypList(options.languages): |
| 45 options.unsigned_apk_path = ("%s_%s" % |
| 46 (options.resource_packaged_apk_path, lang)) |
| 47 options.final_apk_path = ("%s-lang-%s.apk" % |
| 48 (options.base_output_path, lang)) |
| 49 finalize_apk.FinalizeApk(options) |
| 50 |
| 51 if __name__ == '__main__': |
| 52 sys.exit(main()) |
OLD | NEW |