Reduce build graph by another eight percent

This commit is contained in:
Justine Tunney 2022-08-13 13:11:56 -07:00
parent 367d06d9e4
commit 0ea0d33a77
249 changed files with 889 additions and 988 deletions

27
tool/scripts/explain-deps.py Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env python.com
import os
import re
import sys
def GetDeps(path):
deps = set()
def Dive(path, depth):
if path in deps:
return
deps.add(path)
sys.stdout.write('%s%s\n' % ('\t' * depth, path))
with open(path) as f:
code = f.read()
for dep in re.findall(r'[.#]include "([^"]+)"', code):
Dive(dep, depth + 1)
Dive(path, 0)
sys.stdout.write('\n')
for arg in sys.argv[1:]:
if os.path.isdir(arg):
for dirpath, dirs, files in os.walk(arg):
for filepath in files:
GetDeps(os.path.join(dirpath, filepath))
else:
GetDeps(arg)