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:
Mike Klein 2019-07-25 11:18:06 -05:00 committed by Skia Commit-Bot
parent 1b458e82c3
commit 66ed6a0cad

View File

@ -26,19 +26,21 @@ roots = [
'tools'
]
# Don't want to always force our local Vulkan headers.
angle_bracket_whitelist = ['vulkan/']
# Don't count our local Vulkan headers as Skia headers;
# 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.
headers = {}
for root in roots:
for path, _, files in os.walk(root):
for file_name in files:
if file_name.endswith('.h'):
if file_name in headers:
print path, file_name, headers[file_name]
assert file_name not in headers
headers[file_name] = os.path.abspath(os.path.join(path, file_name))
if not any(snippet in path for snippet in blacklist):
for file_name in files:
if file_name.endswith('.h'):
if file_name in headers:
print path, file_name, headers[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.
for root in roots:
@ -63,10 +65,7 @@ for root in roots:
includes = []
for line in lines:
rewritten = line
if not any(token in line for token in angle_bracket_whitelist):
rewritten = rewritten.replace('<', '"').replace('>', '"')
parts = rewritten.split('"')
parts = line.replace('<', '"').replace('>', '"').split('"')
if (len(parts) == 3
and '#' in parts[0]
and 'include' in parts[0]