OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (C) 2013 The Android Open Source Project | 3 # Copyright (C) 2013 The Android Open Source Project |
4 # | 4 # |
5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
8 # | 8 # |
9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
10 # | 10 # |
(...skipping 10 matching lines...) Expand all Loading... |
21 import logging | 21 import logging |
22 import os | 22 import os |
23 import sys | 23 import sys |
24 | 24 |
25 import stack_core | 25 import stack_core |
26 import stack_libs | 26 import stack_libs |
27 import subprocess | 27 import subprocess |
28 import symbol | 28 import symbol |
29 import sys | 29 import sys |
30 | 30 |
| 31 sys.path.insert(0, os.path.join(os.path.dirname(__file__), |
| 32 os.pardir, os.pardir, os.pardir, os.pardir, |
| 33 'build', 'android')) |
| 34 from pylib import constants |
| 35 |
| 36 |
31 DEFAULT_SYMROOT='/tmp/symbols' | 37 DEFAULT_SYMROOT='/tmp/symbols' |
32 DEFAULT_APK_DIR='chrome_apk' | 38 DEFAULT_APK_DIR='chrome_apk' |
33 # From: https://source.android.com/source/build-numbers.html | 39 # From: https://source.android.com/source/build-numbers.html |
34 _ANDROID_M_MAJOR_VERSION=6 | 40 _ANDROID_M_MAJOR_VERSION=6 |
35 | 41 |
36 def PrintUsage(): | 42 def PrintUsage(): |
37 """Print usage and exit with error.""" | 43 """Print usage and exit with error.""" |
38 # pylint: disable-msg=C6310 | 44 # pylint: disable-msg=C6310 |
39 print | 45 print |
40 print " usage: " + sys.argv[0] + " [options] [FILE]" | 46 print " usage: " + sys.argv[0] + " [options] [FILE]" |
41 print | 47 print |
42 print " --symbols-dir=path" | 48 print " --symbols-dir=path" |
43 print " the path to a symbols dir, such as =/tmp/out/target/product/drea
m/symbols" | 49 print " the path to a symbols dir, such as =/tmp/out/target/product/drea
m/symbols" |
44 print | 50 print |
45 print " --chrome-symbols-dir=path" | 51 print " --chrome-symbols-dir=path" |
46 print " the path to a Chrome symbols dir (can be absolute or relative" | 52 print " the path to a Chrome symbols dir (can be absolute or relative" |
47 print " to src), such as =out/Debug/lib" | 53 print " to src), such as =out/Debug/lib" |
48 print " If not specified, will look for the newest lib in out/Debug or" | 54 print |
49 print " out/Release" | 55 print " --output-directory=path" |
| 56 print " the path to the build output directory, such as out/Debug." |
| 57 print " Ignored if --chrome-symbols-dir is passed." |
50 print | 58 print |
51 print " --packed-relocation-adjustments" | 59 print " --packed-relocation-adjustments" |
52 print " --no-packed-relocation-adjustments" | 60 print " --no-packed-relocation-adjustments" |
53 print " turn packed relocation adjustment on and off (default is off)" | 61 print " turn packed relocation adjustment on and off (default is off)" |
54 print " If running on pre-M Android and the stack trace appears to" | 62 print " If running on pre-M Android and the stack trace appears to" |
55 print " make no sense, try turning this feature on." | 63 print " make no sense, try turning this feature on." |
56 print | 64 print |
57 print " --chrome-apk-dir=path" | 65 print " --chrome-apk-dir=path" |
58 print " the path to the APK staging dir (can be absolute or relative" | 66 print " the path to the APK staging dir (can be absolute or relative" |
59 print " to src), such as =out/Debug/chrome_apk" | 67 print " to src), such as =out/Debug/chrome_apk" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 140 |
133 def main(argv): | 141 def main(argv): |
134 try: | 142 try: |
135 options, arguments = getopt.getopt(argv, "", | 143 options, arguments = getopt.getopt(argv, "", |
136 ["packed-relocation-adjustments", | 144 ["packed-relocation-adjustments", |
137 "no-packed-relocation-adjustments", | 145 "no-packed-relocation-adjustments", |
138 "more-info", | 146 "more-info", |
139 "less-info", | 147 "less-info", |
140 "chrome-symbols-dir=", | 148 "chrome-symbols-dir=", |
141 "chrome-apk-dir=", | 149 "chrome-apk-dir=", |
| 150 "output-directory=", |
142 "symbols-dir=", | 151 "symbols-dir=", |
143 "symbols-zip=", | 152 "symbols-zip=", |
144 "arch=", | 153 "arch=", |
145 "verbose", | 154 "verbose", |
146 "help"]) | 155 "help"]) |
147 except getopt.GetoptError, unused_error: | 156 except getopt.GetoptError, unused_error: |
148 PrintUsage() | 157 PrintUsage() |
149 | 158 |
150 zip_arg = None | 159 zip_arg = None |
151 more_info = False | 160 more_info = False |
152 chrome_apk_dir = None | 161 chrome_apk_dir = None |
153 packed_relocation_adjustments = "unknown" | 162 packed_relocation_adjustments = "unknown" |
154 for option, value in options: | 163 for option, value in options: |
155 if option == "--help": | 164 if option == "--help": |
156 PrintUsage() | 165 PrintUsage() |
157 elif option == "--symbols-dir": | 166 elif option == "--symbols-dir": |
158 symbol.SYMBOLS_DIR = os.path.expanduser(value) | 167 symbol.SYMBOLS_DIR = os.path.expanduser(value) |
159 elif option == "--symbols-zip": | 168 elif option == "--symbols-zip": |
160 zip_arg = os.path.expanduser(value) | 169 zip_arg = os.path.expanduser(value) |
161 elif option == "--arch": | 170 elif option == "--arch": |
162 symbol.ARCH = value | 171 symbol.ARCH = value |
163 elif option == "--chrome-symbols-dir": | 172 elif option == "--chrome-symbols-dir": |
164 symbol.CHROME_SYMBOLS_DIR = os.path.join(symbol.CHROME_SRC, value) | 173 symbol.CHROME_SYMBOLS_DIR = os.path.join(symbol.CHROME_SRC, value) |
165 elif option == "--chrome-apk-dir": | 174 elif option == "--chrome-apk-dir": |
166 chrome_apk_dir = os.path.join(symbol.CHROME_SRC, value) | 175 chrome_apk_dir = os.path.join(symbol.CHROME_SRC, value) |
| 176 elif option == "--output-directory": |
| 177 constants.SetOutputDirectory(value) |
167 elif option == "--packed-relocation-adjustments": | 178 elif option == "--packed-relocation-adjustments": |
168 packed_relocation_adjustments = True | 179 packed_relocation_adjustments = True |
169 elif option == "--no-packed-relocation-adjustments": | 180 elif option == "--no-packed-relocation-adjustments": |
170 packed_relocation_adjustments = False | 181 packed_relocation_adjustments = False |
171 elif option == "--more-info": | 182 elif option == "--more-info": |
172 more_info = True | 183 more_info = True |
173 elif option == "--less-info": | 184 elif option == "--less-info": |
174 more_info = False | 185 more_info = False |
175 elif option == "--verbose": | 186 elif option == "--verbose": |
176 logging.basicConfig(level=logging.DEBUG) | 187 logging.basicConfig(level=logging.DEBUG) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 if rootdir: | 245 if rootdir: |
235 # be a good citizen and clean up...os.rmdir and os.removedirs() don't work | 246 # be a good citizen and clean up...os.rmdir and os.removedirs() don't work |
236 cmd = "rm -rf \"%s\"" % rootdir | 247 cmd = "rm -rf \"%s\"" % rootdir |
237 print "\ncleaning up (%s)" % cmd | 248 print "\ncleaning up (%s)" % cmd |
238 os.system(cmd) | 249 os.system(cmd) |
239 | 250 |
240 if __name__ == "__main__": | 251 if __name__ == "__main__": |
241 sys.exit(main(sys.argv[1:])) | 252 sys.exit(main(sys.argv[1:])) |
242 | 253 |
243 # vi: ts=2 sw=2 | 254 # vi: ts=2 sw=2 |
OLD | NEW |