OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import fnmatch | 7 import fnmatch |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import subprocess | |
11 import sys | 10 import sys |
12 | 11 |
13 from pylib import build_utils | 12 from pylib import build_utils |
14 | 13 |
15 | 14 |
16 def DoDex(options, paths): | 15 def DoDex(options, paths): |
17 dx_binary = os.path.join(options.android_sdk_root, 'platform-tools', 'dx') | 16 dx_binary = os.path.join(options.android_sdk_root, 'platform-tools', 'dx') |
18 dex_cmd = [dx_binary, '--dex', '--output', options.dex_path] + paths | 17 dex_cmd = [dx_binary, '--dex', '--output', options.dex_path] + paths |
19 subprocess.check_call(dex_cmd) | 18 build_utils.CheckCallDie(dex_cmd) |
20 | 19 |
21 | 20 |
22 def main(argv): | 21 def main(argv): |
23 parser = optparse.OptionParser() | 22 parser = optparse.OptionParser() |
24 parser.add_option('--android-sdk-root', help='Android sdk root directory.') | 23 parser.add_option('--android-sdk-root', help='Android sdk root directory.') |
25 parser.add_option('--dex-path', help='Dex output path.') | 24 parser.add_option('--dex-path', help='Dex output path.') |
26 parser.add_option('--stamp', help='Path to touch on success.') | 25 parser.add_option('--stamp', help='Path to touch on success.') |
27 | 26 |
28 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. | 27 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. |
29 parser.add_option('--ignore', help='Ignored.') | 28 parser.add_option('--ignore', help='Ignored.') |
30 | 29 |
31 options, paths = parser.parse_args() | 30 options, paths = parser.parse_args() |
32 | 31 |
33 DoDex(options, paths) | 32 DoDex(options, paths) |
34 | 33 |
35 if options.stamp: | 34 if options.stamp: |
36 build_utils.Touch(options.stamp) | 35 build_utils.Touch(options.stamp) |
37 | 36 |
38 | 37 |
39 if __name__ == '__main__': | 38 if __name__ == '__main__': |
40 sys.exit(main(sys.argv)) | 39 sys.exit(main(sys.argv)) |
41 | 40 |
OLD | NEW |