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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 def CallJavap(classpath, classes): | 38 def CallJavap(classpath, classes): |
39 javap_cmd = [ | 39 javap_cmd = [ |
40 'javap', | 40 'javap', |
41 '-protected', # In reality both public & protected. | 41 '-protected', # In reality both public & protected. |
42 # -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 |
43 # dependents). | 43 # dependents). |
44 '-verbose', | 44 '-verbose', |
45 '-classpath', classpath | 45 '-classpath', classpath |
46 ] + classes | 46 ] + classes |
47 return build_utils.CheckCallDie(javap_cmd, suppress_output=True) | 47 return build_utils.CheckOutput(javap_cmd) |
48 | 48 |
49 | 49 |
50 def ExtractToc(disassembled_classes): | 50 def ExtractToc(disassembled_classes): |
51 # javap output is structured by indent (2-space) levels. | 51 # javap output is structured by indent (2-space) levels. |
52 good_patterns = [ | 52 good_patterns = [ |
53 '^[^ ]', # This includes all class/function/member signatures. | 53 '^[^ ]', # This includes all class/function/member signatures. |
54 '^ SourceFile:', | 54 '^ SourceFile:', |
55 '^ minor version:', | 55 '^ minor version:', |
56 '^ major version:', | 56 '^ major version:', |
57 '^ Constant value:', | 57 '^ Constant value:', |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 options, _ = parser.parse_args() | 101 options, _ = parser.parse_args() |
102 | 102 |
103 DoJarToc(options) | 103 DoJarToc(options) |
104 | 104 |
105 if options.stamp: | 105 if options.stamp: |
106 build_utils.Touch(options.stamp) | 106 build_utils.Touch(options.stamp) |
107 | 107 |
108 | 108 |
109 if __name__ == '__main__': | 109 if __name__ == '__main__': |
110 sys.exit(main(sys.argv)) | 110 sys.exit(main(sys.argv)) |
OLD | NEW |