MCPcopy Create free account
hub / github.com/nodejs/node / ExtractSharedMSVSSystemIncludes

Function ExtractSharedMSVSSystemIncludes

tools/gyp/pylib/gyp/msvs_emulation.py:171–196  ·  view source on GitHub ↗

Finds msvs_system_include_dirs that are common to all targets, removes them from all targets, and returns an OrderedSet containing them.

(configs, generator_flags)

Source from the content-addressed store, hash-verified

169
170
171def ExtractSharedMSVSSystemIncludes(configs, generator_flags):
172 """Finds msvs_system_include_dirs that are common to all targets, removes
173 them from all targets, and returns an OrderedSet containing them."""
174 all_system_includes = OrderedSet(configs[0].get("msvs_system_include_dirs", []))
175 for config in configs[1:]:
176 system_includes = config.get("msvs_system_include_dirs", [])
177 all_system_includes = all_system_includes & OrderedSet(system_includes)
178 if not all_system_includes:
179 return None
180 # Expand macros in all_system_includes.
181 env = GetGlobalVSMacroEnv(GetVSVersion(generator_flags))
182 expanded_system_includes = OrderedSet(
183 [ExpandMacros(include, env) for include in all_system_includes]
184 )
185 if any("$" in include for include in expanded_system_includes):
186 # Some path relies on target-specific variables, bail.
187 return None
188
189 # Remove system includes shared by all targets from the targets.
190 for config in configs:
191 includes = config.get("msvs_system_include_dirs", [])
192 if includes: # Don't insert a msvs_system_include_dirs key if not needed.
193 # This must check the unexpanded includes list:
194 new_includes = [i for i in includes if i not in all_system_includes]
195 config["msvs_system_include_dirs"] = new_includes
196 return expanded_system_includes
197
198
199class MsvsSettings:

Callers

nothing calls this directly

Calls 5

OrderedSetClass · 0.90
GetGlobalVSMacroEnvFunction · 0.85
GetVSVersionFunction · 0.85
ExpandMacrosFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected