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