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

Side by Side Diff: tools/verify_source_deps.py

Issue 2342663004: Add files missing from gn and fix verify script (Closed)
Patch Set: updates Created 4 years, 3 months 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
« BUILD.gn ('K') | « BUILD.gn ('k') | no next file » | 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 2015 the V8 project authors. All rights reserved. 2 # Copyright 2015 the V8 project 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 """ 6 """
7 Script to print potentially missing source dependencies based on the actual 7 Script to print potentially missing source dependencies based on the actual
8 .h and .cc files in the source tree and which files are included in the gyp 8 .h and .cc files in the source tree and which files are included in the gyp
9 and gn files. The latter inclusion is overapproximated. 9 and gn files. The latter inclusion is overapproximated.
10 10
11 TODO(machenbach): Gyp files in src will point to source files in src without a 11 TODO(machenbach): Gyp files in src will point to source files in src without a
12 src/ prefix. For simplicity, all paths relative to src are stripped. But this 12 src/ prefix. For simplicity, all paths relative to src are stripped. But this
13 tool won't be accurate for other sources in other directories (e.g. cctest). 13 tool won't be accurate for other sources in other directories (e.g. cctest).
14 """ 14 """
15 15
16 import itertools 16 import itertools
17 import re 17 import re
18 import os 18 import os
19 19
20 20
21 V8_BASE = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 21 V8_BASE = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
22 V8_SRC_BASE = os.path.join(V8_BASE, 'src') 22 V8_SRC_BASE = os.path.join(V8_BASE, 'src')
23 V8_INCLUDE_BASE = os.path.join(V8_BASE, 'include') 23 V8_INCLUDE_BASE = os.path.join(V8_BASE, 'include')
24 24
25 GYP_FILES = [ 25 GYP_FILES = [
26 os.path.join(V8_BASE, 'src', 'd8.gyp'), 26 os.path.join(V8_BASE, 'src', 'd8.gyp'),
27 os.path.join(V8_BASE, 'src', 'v8.gyp'), 27 os.path.join(V8_BASE, 'src', 'v8.gyp'),
28 os.path.join(V8_BASE, 'src', 'inspector', 'inspector.gyp'),
28 os.path.join(V8_BASE, 'src', 'third_party', 'vtune', 'v8vtune.gyp'), 29 os.path.join(V8_BASE, 'src', 'third_party', 'vtune', 'v8vtune.gyp'),
29 os.path.join(V8_BASE, 'test', 'cctest', 'cctest.gyp'), 30 os.path.join(V8_BASE, 'test', 'cctest', 'cctest.gyp'),
30 os.path.join(V8_BASE, 'test', 'unittests', 'unittests.gyp'), 31 os.path.join(V8_BASE, 'test', 'unittests', 'unittests.gyp'),
31 os.path.join(V8_BASE, 'tools', 'parser-shell.gyp'), 32 os.path.join(V8_BASE, 'tools', 'parser-shell.gyp'),
32 ] 33 ]
33 34
35 GN_FILES = [
36 os.path.join(V8_BASE, 'BUILD.gn'),
37 os.path.join(V8_BASE, 'src', 'inspector', 'BUILD.gn'),
38 os.path.join(V8_BASE, 'test', 'cctest', 'BUILD.gn'),
39 os.path.join(V8_BASE, 'test', 'unittests', 'BUILD.gn'),
40 os.path.join(V8_BASE, 'tools', 'BUILD.gn'),
41 ]
42
43 GN_UNSUPPORTED_FEATURES = [
44 'aix',
45 'cygwin',
46 'freebsd',
47 'openbsd',
48 'ppc',
49 'qnx',
50 'solaris',
51 'valgrind',
52 'vtune',
53 'x87',
54 ]
55
34 56
35 def path_no_prefix(path): 57 def path_no_prefix(path):
vogelheim 2016/09/15 12:07:06 maybe: for prefix in ['..', 'src/inspector/', ...
jochen (gone - plz use gerrit) 2016/09/15 12:24:18 done
36 if path.startswith('../'): 58 if path.startswith('../'):
37 return path_no_prefix(path[3:]) 59 return path_no_prefix(path[3:])
60 elif path.startswith('src/inspector/'):
61 return path_no_prefix(path[14:])
38 elif path.startswith('src/'): 62 elif path.startswith('src/'):
39 return path_no_prefix(path[4:]) 63 return path_no_prefix(path[4:])
40 else: 64 else:
41 return path 65 return path
42 66
43 67
44 def isources(directory): 68 def isources(directory):
45 for root, dirs, files in os.walk(directory): 69 for root, dirs, files in os.walk(directory):
46 for f in files: 70 for f in files:
47 if not (f.endswith('.h') or f.endswith('.cc')): 71 if not (f.endswith('.h') or f.endswith('.cc')):
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 116
93 117
94 gyp_values = set(itertools.chain( 118 gyp_values = set(itertools.chain(
95 *[iflatten_gyp_file(gyp_file) for gyp_file in GYP_FILES] 119 *[iflatten_gyp_file(gyp_file) for gyp_file in GYP_FILES]
96 )) 120 ))
97 121
98 print "----------- Files not in gyp: ------------" 122 print "----------- Files not in gyp: ------------"
99 for i in sorted(icheck_values(gyp_values, V8_SRC_BASE, V8_INCLUDE_BASE)): 123 for i in sorted(icheck_values(gyp_values, V8_SRC_BASE, V8_INCLUDE_BASE)):
100 print i 124 print i
101 125
102 gn_values = set(iflatten_gn_file(os.path.join(V8_BASE, 'BUILD.gn'))) 126 gn_values = set(itertools.chain(
127 *[iflatten_gn_file(gn_file) for gn_file in GN_FILES]
128 ))
103 129
104 print "\n----------- Files not in gn: -------------" 130 print "\n----------- Files not in gn: -------------"
105 for i in sorted(icheck_values(gn_values, V8_SRC_BASE, V8_INCLUDE_BASE)): 131 for i in sorted(icheck_values(gn_values, V8_SRC_BASE, V8_INCLUDE_BASE)):
132 if set((f for f in GN_UNSUPPORTED_FEATURES if f in i)):
vogelheim 2016/09/15 12:07:05 If I understand this, you want to know whether the
vogelheim 2016/09/15 12:07:05 Why set(..)? I know the set(...) trick mainly to
jochen (gone - plz use gerrit) 2016/09/15 12:24:18 i is a filename, like 'disassembler-ppc.cc', and u
vogelheim 2016/09/15 12:39:54 Ahh... I don't think 'force-materialize' exists in
133 continue
106 print i 134 print i
OLDNEW
« BUILD.gn ('K') | « BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698