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/package classes/functions/members and the values of static | 10 public/protected/package classes/functions/members and the values of static |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 '-verbose', | 46 '-verbose', |
47 '-J-XX:NewSize=4m', | 47 '-J-XX:NewSize=4m', |
48 '-classpath', classpath | 48 '-classpath', classpath |
49 ] + classes | 49 ] + classes |
50 return build_utils.CheckOutput(javap_cmd) | 50 return build_utils.CheckOutput(javap_cmd) |
51 | 51 |
52 | 52 |
53 def ExtractToc(disassembled_classes): | 53 def ExtractToc(disassembled_classes): |
54 # javap output is structured by indent (2-space) levels. | 54 # javap output is structured by indent (2-space) levels. |
55 good_patterns = [ | 55 good_patterns = [ |
56 '^[^ ]', # This includes all class/function/member signatures. | 56 '^[^ ]', # This includes all class signatures. |
57 '^ SourceFile:', | 57 '^ SourceFile:', |
58 '^ minor version:', | 58 '^ minor version:', |
59 '^ major version:', | 59 '^ major version:', |
60 '^ Constant value:', | 60 '^ Constant value:', |
| 61 '^ public ', |
| 62 '^ protected ', |
61 ] | 63 ] |
62 bad_patterns = [ | 64 bad_patterns = [ |
63 '^const #', # Matches the constant pool (i.e. literals used in the class). | 65 '^const #', # Matches the constant pool (i.e. literals used in the class). |
64 ] | 66 ] |
65 | 67 |
66 def JavapFilter(line): | 68 def JavapFilter(line): |
67 return (re.match('|'.join(good_patterns), line) and | 69 return (re.match('|'.join(good_patterns), line) and |
68 not re.match('|'.join(bad_patterns), line)) | 70 not re.match('|'.join(bad_patterns), line)) |
69 toc = filter(JavapFilter, disassembled_classes.split('\n')) | 71 toc = filter(JavapFilter, disassembled_classes.split('\n')) |
70 | 72 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 build_utils.WriteDepfile( | 118 build_utils.WriteDepfile( |
117 options.depfile, | 119 options.depfile, |
118 build_utils.GetPythonDependencies()) | 120 build_utils.GetPythonDependencies()) |
119 | 121 |
120 if options.stamp: | 122 if options.stamp: |
121 build_utils.Touch(options.stamp) | 123 build_utils.Touch(options.stamp) |
122 | 124 |
123 | 125 |
124 if __name__ == '__main__': | 126 if __name__ == '__main__': |
125 sys.exit(main()) | 127 sys.exit(main()) |
OLD | NEW |