28def CheckFile(sdk_root, path):
29 includes = set()
30 with open(os.path.join(sdk_root, path), encoding='utf-8') as file:
31 for line in file:
32 m = INCLUDE_DIRECTIVE_RE.match(line)
33 if m is not None:
34 header = os.path.join('runtime', m.group(1))
35 if os.path.isfile(os.path.join(sdk_root, header)):
36 includes.add(header)
37
38 errors = []
39 for include in includes:
40 if PLATFORM_LAYER_RE.match(path):
41 if VM_LAYER_RE.match(include):
42 errors.append(
43 'LAYERING ERROR: %s must not include %s' % (path, include))
44 elif BIN_LAYER_RE.match(include):
45 errors.append(
46 'LAYERING ERROR: %s must not include %s' % (path, include))
47 elif VM_LAYER_RE.match(path):
48 if BIN_LAYER_RE.match(include):
49 errors.append(
50 'LAYERING ERROR: %s must not include %s' % (path, include))
51 elif BIN_LAYER_RE.match(path):
52 if VM_LAYER_RE.match(include):
53 errors.append(
54 'LAYERING ERROR: %s must not include %s' % (path, include))
55 return errors
56
57