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 """Creates a TOC file from a Java jar. | 7 """Creates a TOC file from a Java jar. |
8 | 8 |
9 The TOC file contains the non-package API of the jar. This includes all | 9 The TOC file contains the non-package API of the jar. This includes all |
10 public/protected classes/functions/members and the values of static final | 10 public/protected classes/functions/members and the values of static final |
(...skipping 20 matching lines...) Expand all Loading... |
31 for f in files: | 31 for f in files: |
32 if f.endswith('.class'): | 32 if f.endswith('.class'): |
33 # f is of the form org/chromium/base/Class$Inner.class | 33 # f is of the form org/chromium/base/Class$Inner.class |
34 classes.append(f.replace('/', '.')[:-6]) | 34 classes.append(f.replace('/', '.')[:-6]) |
35 return classes | 35 return classes |
36 | 36 |
37 | 37 |
38 def CallJavap(classpath, classes): | 38 def CallJavap(classpath, classes): |
39 javap_cmd = [ | 39 javap_cmd = [ |
40 'javap', | 40 'javap', |
41 '-public', | 41 '-protected', # In reality both public & protected. |
42 '-protected', | |
43 # -verbose is required to get constant values (which can be inlined in | 42 # -verbose is required to get constant values (which can be inlined in |
44 # dependents). | 43 # dependents). |
45 '-verbose', | 44 '-verbose', |
46 '-classpath', classpath | 45 '-classpath', classpath |
47 ] + classes | 46 ] + classes |
48 return build_utils.CheckCallDie(javap_cmd, suppress_output=True) | 47 return build_utils.CheckCallDie(javap_cmd, suppress_output=True) |
49 | 48 |
50 | 49 |
51 def ExtractToc(disassembled_classes): | 50 def ExtractToc(disassembled_classes): |
52 # javap output is structured by indent (2-space) levels. | 51 # javap output is structured by indent (2-space) levels. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 options, _ = parser.parse_args() | 101 options, _ = parser.parse_args() |
103 | 102 |
104 DoJarToc(options) | 103 DoJarToc(options) |
105 | 104 |
106 if options.stamp: | 105 if options.stamp: |
107 build_utils.Touch(options.stamp) | 106 build_utils.Touch(options.stamp) |
108 | 107 |
109 | 108 |
110 if __name__ == '__main__': | 109 if __name__ == '__main__': |
111 sys.exit(main(sys.argv)) | 110 sys.exit(main(sys.argv)) |
112 | |
OLD | NEW |