OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2017 The Chromium Authors. All rights reserved. | 2 # Copyright 2017 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Find header files missing in GN. | 6 """Find header files missing in GN. |
7 | 7 |
8 This script gets all the header files from ninja_deps, which is from the true | 8 This script gets all the header files from ninja_deps, which is from the true |
9 dependency generated by the compiler, and report if they don't exist in GN. | 9 dependency generated by the compiler, and report if they don't exist in GN. |
10 """ | 10 """ |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 if i.startswith('src/'): | 141 if i.startswith('src/'): |
142 i = i[4:] | 142 i = i[4:] |
143 prefixes.add(i) | 143 prefixes.add(i) |
144 except Exception as e: | 144 except Exception as e: |
145 err = str(e) | 145 err = str(e) |
146 q.put((prefixes, err)) | 146 q.put((prefixes, err)) |
147 | 147 |
148 | 148 |
149 def IsBuildClean(out_dir): | 149 def IsBuildClean(out_dir): |
150 cmd = [os.path.join(DEPOT_TOOLS_DIR, 'ninja'), '-C', out_dir, '-n'] | 150 cmd = [os.path.join(DEPOT_TOOLS_DIR, 'ninja'), '-C', out_dir, '-n'] |
151 out = subprocess.check_output(cmd) | 151 try: |
152 return 'no work to do.' in out | 152 out = subprocess.check_output(cmd) |
153 | 153 return 'no work to do.' in out |
| 154 except Exception as e: |
| 155 print e |
| 156 return False |
154 | 157 |
155 def ParseWhiteList(whitelist): | 158 def ParseWhiteList(whitelist): |
156 out = set() | 159 out = set() |
157 for line in whitelist.split('\n'): | 160 for line in whitelist.split('\n'): |
158 line = re.sub(r'#.*', '', line).strip() | 161 line = re.sub(r'#.*', '', line).strip() |
159 if line: | 162 if line: |
160 out.add(line) | 163 out.add(line) |
161 return out | 164 return out |
162 | 165 |
163 | 166 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 count = {k: len(v) for (k, v) in d.iteritems()} | 295 count = {k: len(v) for (k, v) in d.iteritems()} |
293 for f in sorted(count, key=count.get, reverse=True): | 296 for f in sorted(count, key=count.get, reverse=True): |
294 if f in missing: | 297 if f in missing: |
295 print count[f], f | 298 print count[f], f |
296 | 299 |
297 return 1 | 300 return 1 |
298 | 301 |
299 | 302 |
300 if __name__ == '__main__': | 303 if __name__ == '__main__': |
301 sys.exit(main()) | 304 sys.exit(main()) |
OLD | NEW |