MCPcopy Create free account
hub / github.com/pytorch/executorch / index_headers

Function index_headers

scripts/print_public_headers.py:101–119  ·  view source on GitHub ↗

Returns a mapping of header paths to the BuildTargets that export them.

(targets: List[BuildTarget])

Source from the content-addressed store, hash-verified

99
100
101def index_headers(targets: List[BuildTarget]) -> Dict[str, List[BuildTarget]]:
102 """Returns a mapping of header paths to the BuildTargets that export them."""
103 ret: Dict[str, List[BuildTarget]] = {}
104 for target in targets:
105 if isinstance(target.exported_headers, dict):
106 # Dict of {"HeaderName.h": "fbcode//...[HeaderName.h] (mode//config)"}
107 for header in target.exported_headers.values():
108 header = header.split(" ", 1)[0]
109 if header not in ret:
110 ret[header] = []
111 ret[header].append(target)
112 else:
113 # Simple list of header file paths, prefixed with "fbcode//".
114 assert isinstance(target.exported_headers, list)
115 for header in target.exported_headers:
116 if header not in ret:
117 ret[header] = []
118 ret[header].append(target)
119 return ret
120
121
122def main():

Callers 1

mainFunction · 0.85

Calls 3

valuesMethod · 0.80
splitMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected