Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: sky/tools/missing_from_gn

Issue 715163002: Add headers to gn/gni files for all of sky/engine (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/wtf/BUILD.gn ('k') | sky/viewer/cc/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 import subprocess 6 import subprocess
7 import os 7 import os
8 import argparse 8 import argparse
9 import logging 9 import logging
10 10
(...skipping 27 matching lines...) Expand all
38 logging.info(target) 38 logging.info(target)
39 sources = map(lambda s: s[2:], gn_desc(target, 'sources')) 39 sources = map(lambda s: s[2:], gn_desc(target, 'sources'))
40 inputs = map(lambda s: s[2:], gn_desc(target, 'inputs')) 40 inputs = map(lambda s: s[2:], gn_desc(target, 'inputs'))
41 public = map(lambda s: s[2:], gn_desc(target, 'public')) 41 public = map(lambda s: s[2:], gn_desc(target, 'public'))
42 script = map(lambda s: s[2:], gn_desc(target, 'script')) 42 script = map(lambda s: s[2:], gn_desc(target, 'script'))
43 return sources + inputs + public + script 43 return sources + inputs + public + script
44 44
45 45
46 def find_on_disk(path): 46 def find_on_disk(path):
47 # FIXME: Use os.walk and do fancier ignoring. 47 # FIXME: Use os.walk and do fancier ignoring.
48 return stripped_lines_from_command(['find', path, '-type', 'f']) 48 find_cmd = ['find', path, '-type', 'f']
49 return stripped_lines_from_command(find_cmd, cwd=ROOT_DIR)
49 50
50 51
51 def main(): 52 def main():
52 logging.basicConfig(level=logging.INFO) 53 logging.basicConfig(level=logging.INFO)
53 54
54 if os.path.exists(GN_CACHE_PATH): 55 if os.path.exists(GN_CACHE_PATH):
55 logging.info('Using cached GN list: %s' % GN_CACHE_PATH) 56 logging.info('Using cached GN list: %s' % GN_CACHE_PATH)
56 in_gn = set(map(str.strip, open(GN_CACHE_PATH).readlines())) 57 in_gn = set(map(str.strip, open(GN_CACHE_PATH).readlines()))
57 else: 58 else:
58 logging.info('No gn cache found, rebuilding: %s' % GN_CACHE_PATH) 59 logging.info('No gn cache found, rebuilding: %s' % GN_CACHE_PATH)
59 in_gn = set(sum(map(used_files, targets_under('//sky')), [])) 60 in_gn = set(sum(map(used_files, targets_under('//sky')), []))
60 open(GN_CACHE_PATH, 'w+').write('\n'.join(in_gn)) 61 open(GN_CACHE_PATH, 'w+').write('\n'.join(in_gn))
61 62
62 on_disk = set(find_on_disk('sky/engine')) 63 on_disk = set(find_on_disk('sky/engine'))
63 # Ignore web/tests and bindings/tests 64 # Ignore web/tests and bindings/tests
64 on_disk = set(filter(lambda p: '/tests/' not in p, on_disk)) 65 on_disk = set(filter(lambda p: '/tests/' not in p, on_disk))
65 66
66 missing_from_gn = sorted(on_disk - in_gn) 67 missing_from_gn = sorted(on_disk - in_gn)
67 68
68 IGNORED_EXTENSIONS = [ 69 IGNORED_EXTENSIONS = [
69 '.py', # Probably some to remove, probably some to teach gn about. 70 '.py', # Probably some to remove, probably some to teach gn about.
70 # Python files not being known to gn can cause flaky builds too! 71 # Python files not being known to gn can cause flaky builds too!
71 '.pyc', 72 '.pyc',
72 '.gypi', 73 '.gypi',
73 '.gn', 74 '.gn',
74 '.gni', 75 '.gni',
75 '.h', # Ignore headers for the moment.
76 ] 76 ]
77 for ext in IGNORED_EXTENSIONS: 77 for ext in IGNORED_EXTENSIONS:
78 missing_from_gn = filter(lambda p: not p.endswith(ext), missing_from_gn) 78 missing_from_gn = filter(lambda p: not p.endswith(ext), missing_from_gn)
79 79
80 # All upper-case files like README, DEPS, etc. are fine. 80 # All upper-case files like README, DEPS, etc. are fine.
81 missing_from_gn = filter(lambda p: not os.path.basename(p).isupper(), 81 missing_from_gn = filter(lambda p: not os.path.basename(p).isupper(),
82 missing_from_gn) 82 missing_from_gn)
83 83
84 print '\n'.join(missing_from_gn) 84 print '\n'.join(missing_from_gn)
85 85
86 86
87 if __name__ == '__main__': 87 if __name__ == '__main__':
88 main() 88 main()
OLDNEW
« no previous file with comments | « sky/engine/wtf/BUILD.gn ('k') | sky/viewer/cc/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698