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 build_utils |
13 from util import md5_check | 13 from util import md5_check |
14 | 14 |
15 | 15 |
16 def DoDex(options, paths): | 16 def DoDex(options, paths): |
17 dx_binary = os.path.join(options.android_sdk_root, 'platform-tools', 'dx') | 17 dx_binary = os.path.join(options.android_sdk_build_tools, 'dx') |
18 dex_cmd = [dx_binary, '--dex', '--output', options.dex_path] + paths | 18 dex_cmd = [dx_binary, '--dex', '--output', options.dex_path] + paths |
19 | 19 |
20 record_path = '%s.md5.stamp' % options.dex_path | 20 record_path = '%s.md5.stamp' % options.dex_path |
21 md5_check.CallAndRecordIfStale( | 21 md5_check.CallAndRecordIfStale( |
22 lambda: build_utils.CheckCallDie(dex_cmd, suppress_output=True), | 22 lambda: build_utils.CheckCallDie(dex_cmd, suppress_output=True), |
23 record_path=record_path, | 23 record_path=record_path, |
24 input_paths=paths, | 24 input_paths=paths, |
25 input_strings=dex_cmd) | 25 input_strings=dex_cmd) |
26 | 26 |
27 build_utils.Touch(options.dex_path) | 27 build_utils.Touch(options.dex_path) |
28 | 28 |
29 | 29 |
30 def main(argv): | 30 def main(argv): |
31 parser = optparse.OptionParser() | 31 parser = optparse.OptionParser() |
32 parser.add_option('--android-sdk-root', help='Android sdk root directory.') | 32 parser.add_option('--android-sdk-root', help='Android sdk root directory.') |
cjhopman
2013/08/07 18:14:25
This isn't used anymore.
navabi
2013/08/07 18:24:13
Removed. Along with all instances of calls to dex.
| |
33 # The build-tools (e.g. aidl) are in sdk/build-tools/<build_tools_version>/. | |
34 parser.add_option('--android-sdk-build-tools', | |
35 help='Android sdk build tools directory.') | |
33 parser.add_option('--dex-path', help='Dex output path.') | 36 parser.add_option('--dex-path', help='Dex output path.') |
34 parser.add_option('--configuration-name', | 37 parser.add_option('--configuration-name', |
35 help='The build CONFIGURATION_NAME.') | 38 help='The build CONFIGURATION_NAME.') |
36 parser.add_option('--proguard-enabled', | 39 parser.add_option('--proguard-enabled', |
37 help='"true" if proguard is enabled.') | 40 help='"true" if proguard is enabled.') |
38 parser.add_option('--proguard-enabled-input-path', | 41 parser.add_option('--proguard-enabled-input-path', |
39 help='Path to dex in Release mode when proguard is enabled.') | 42 help='Path to dex in Release mode when proguard is enabled.') |
40 parser.add_option('--stamp', help='Path to touch on success.') | 43 parser.add_option('--stamp', help='Path to touch on success.') |
41 | 44 |
42 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. | 45 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. |
43 parser.add_option('--ignore', help='Ignored.') | 46 parser.add_option('--ignore', help='Ignored.') |
44 | 47 |
45 options, paths = parser.parse_args() | 48 options, paths = parser.parse_args() |
46 | 49 |
47 if (options.proguard_enabled == "true" | 50 if (options.proguard_enabled == "true" |
48 and options.configuration_name == "Release"): | 51 and options.configuration_name == "Release"): |
49 paths = [options.proguard_enabled_input_path] | 52 paths = [options.proguard_enabled_input_path] |
50 | 53 |
51 DoDex(options, paths) | 54 DoDex(options, paths) |
52 | 55 |
53 if options.stamp: | 56 if options.stamp: |
54 build_utils.Touch(options.stamp) | 57 build_utils.Touch(options.stamp) |
55 | 58 |
56 | 59 |
57 if __name__ == '__main__': | 60 if __name__ == '__main__': |
58 sys.exit(main(sys.argv)) | 61 sys.exit(main(sys.argv)) |
59 | 62 |
OLD | NEW |