tweak how we avoid rewriting vulkan includes
This may be splitting hairs, but it occurred to me that this might be a clearer way of expressing what we're trying to do, avoiding treating include/third_party/vulkan as our own. Change-Id: I2bb3c2da5b2294cc219d3a3745a6b52dd09ec21d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229801 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
1b458e82c3
commit
66ed6a0cad
@ -26,19 +26,21 @@ roots = [
|
|||||||
'tools'
|
'tools'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Don't want to always force our local Vulkan headers.
|
# Don't count our local Vulkan headers as Skia headers;
|
||||||
angle_bracket_whitelist = ['vulkan/']
|
# we don't want #include <vulkan/vulkan_foo.h> rewritten to point to them.
|
||||||
|
blacklist = ['include/third_party/vulkan']
|
||||||
|
|
||||||
# Map short name -> absolute path for all Skia headers.
|
# Map short name -> absolute path for all Skia headers.
|
||||||
headers = {}
|
headers = {}
|
||||||
for root in roots:
|
for root in roots:
|
||||||
for path, _, files in os.walk(root):
|
for path, _, files in os.walk(root):
|
||||||
for file_name in files:
|
if not any(snippet in path for snippet in blacklist):
|
||||||
if file_name.endswith('.h'):
|
for file_name in files:
|
||||||
if file_name in headers:
|
if file_name.endswith('.h'):
|
||||||
print path, file_name, headers[file_name]
|
if file_name in headers:
|
||||||
assert file_name not in headers
|
print path, file_name, headers[file_name]
|
||||||
headers[file_name] = os.path.abspath(os.path.join(path, file_name))
|
assert file_name not in headers
|
||||||
|
headers[file_name] = os.path.abspath(os.path.join(path, file_name))
|
||||||
|
|
||||||
# Rewrite any #includes relative to Skia's top-level directory.
|
# Rewrite any #includes relative to Skia's top-level directory.
|
||||||
for root in roots:
|
for root in roots:
|
||||||
@ -63,10 +65,7 @@ for root in roots:
|
|||||||
includes = []
|
includes = []
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
rewritten = line
|
parts = line.replace('<', '"').replace('>', '"').split('"')
|
||||||
if not any(token in line for token in angle_bracket_whitelist):
|
|
||||||
rewritten = rewritten.replace('<', '"').replace('>', '"')
|
|
||||||
parts = rewritten.split('"')
|
|
||||||
if (len(parts) == 3
|
if (len(parts) == 3
|
||||||
and '#' in parts[0]
|
and '#' in parts[0]
|
||||||
and 'include' in parts[0]
|
and 'include' in parts[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user