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 sys | 10 import sys |
11 | 11 |
| 12 from util import build_utils |
12 from util import md5_check | 13 from util import md5_check |
13 | 14 |
14 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') | |
15 sys.path.append(BUILD_ANDROID_DIR) | |
16 | |
17 from pylib import build_utils | |
18 | |
19 | 15 |
20 def DoDex(options, paths): | 16 def DoDex(options, paths): |
21 dx_binary = os.path.join(options.android_sdk_root, 'platform-tools', 'dx') | 17 dx_binary = os.path.join(options.android_sdk_root, 'platform-tools', 'dx') |
22 dex_cmd = [dx_binary, '--dex', '--output', options.dex_path] + paths | 18 dex_cmd = [dx_binary, '--dex', '--output', options.dex_path] + paths |
23 | 19 |
24 md5_stamp = '%s.md5' % options.dex_path | 20 md5_stamp = '%s.md5' % options.dex_path |
25 md5_checker = md5_check.Md5Checker( | 21 md5_checker = md5_check.Md5Checker( |
26 stamp=md5_stamp, inputs=paths, command=dex_cmd) | 22 stamp=md5_stamp, inputs=paths, command=dex_cmd) |
27 if md5_checker.IsStale(): | 23 if md5_checker.IsStale(): |
28 build_utils.CheckCallDie(dex_cmd) | 24 build_utils.CheckCallDie(dex_cmd, suppress_output=True) |
29 else: | 25 else: |
30 build_utils.Touch(options.dex_path) | 26 build_utils.Touch(options.dex_path) |
31 md5_checker.Write() | 27 md5_checker.Write() |
32 | 28 |
33 | 29 |
34 def main(argv): | 30 def main(argv): |
35 parser = optparse.OptionParser() | 31 parser = optparse.OptionParser() |
36 parser.add_option('--android-sdk-root', help='Android sdk root directory.') | 32 parser.add_option('--android-sdk-root', help='Android sdk root directory.') |
37 parser.add_option('--dex-path', help='Dex output path.') | 33 parser.add_option('--dex-path', help='Dex output path.') |
38 parser.add_option('--stamp', help='Path to touch on success.') | 34 parser.add_option('--stamp', help='Path to touch on success.') |
39 | 35 |
40 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. | 36 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. |
41 parser.add_option('--ignore', help='Ignored.') | 37 parser.add_option('--ignore', help='Ignored.') |
42 | 38 |
43 options, paths = parser.parse_args() | 39 options, paths = parser.parse_args() |
44 | 40 |
45 DoDex(options, paths) | 41 DoDex(options, paths) |
46 | 42 |
47 if options.stamp: | 43 if options.stamp: |
48 build_utils.Touch(options.stamp) | 44 build_utils.Touch(options.stamp) |
49 | 45 |
50 | 46 |
51 if __name__ == '__main__': | 47 if __name__ == '__main__': |
52 sys.exit(main(sys.argv)) | 48 sys.exit(main(sys.argv)) |
53 | 49 |
OLD | NEW |