OLD | NEW |
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): |
36 if path.startswith('../'): | 58 for prefix in ['../', 'src/inspector/', 'src/']: |
37 return path_no_prefix(path[3:]) | 59 if path.startswith(prefix): |
38 elif path.startswith('src/'): | 60 return path_no_prefix(path[len(prefix):]) |
39 return path_no_prefix(path[4:]) | 61 return path |
40 else: | |
41 return path | |
42 | 62 |
43 | 63 |
44 def isources(directory): | 64 def isources(directory): |
45 for root, dirs, files in os.walk(directory): | 65 for root, dirs, files in os.walk(directory): |
46 for f in files: | 66 for f in files: |
47 if not (f.endswith('.h') or f.endswith('.cc')): | 67 if not (f.endswith('.h') or f.endswith('.cc')): |
48 continue | 68 continue |
49 yield path_no_prefix(os.path.relpath(os.path.join(root, f), V8_BASE)) | 69 yield path_no_prefix(os.path.relpath(os.path.join(root, f), V8_BASE)) |
50 | 70 |
51 | 71 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 112 |
93 | 113 |
94 gyp_values = set(itertools.chain( | 114 gyp_values = set(itertools.chain( |
95 *[iflatten_gyp_file(gyp_file) for gyp_file in GYP_FILES] | 115 *[iflatten_gyp_file(gyp_file) for gyp_file in GYP_FILES] |
96 )) | 116 )) |
97 | 117 |
98 print "----------- Files not in gyp: ------------" | 118 print "----------- Files not in gyp: ------------" |
99 for i in sorted(icheck_values(gyp_values, V8_SRC_BASE, V8_INCLUDE_BASE)): | 119 for i in sorted(icheck_values(gyp_values, V8_SRC_BASE, V8_INCLUDE_BASE)): |
100 print i | 120 print i |
101 | 121 |
102 gn_values = set(iflatten_gn_file(os.path.join(V8_BASE, 'BUILD.gn'))) | 122 gn_values = set(itertools.chain( |
| 123 *[iflatten_gn_file(gn_file) for gn_file in GN_FILES] |
| 124 )) |
103 | 125 |
104 print "\n----------- Files not in gn: -------------" | 126 print "\n----------- Files not in gn: -------------" |
105 for i in sorted(icheck_values(gn_values, V8_SRC_BASE, V8_INCLUDE_BASE)): | 127 for i in sorted(icheck_values(gn_values, V8_SRC_BASE, V8_INCLUDE_BASE)): |
106 print i | 128 if not any(f in i for f in GN_UNSUPPORTED_FEATURES): |
| 129 print i |
OLD | NEW |