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

Function _AppendFiltersForMSBuild

tools/gyp/pylib/gyp/generator/msvs.py:2215–2270  ·  view source on GitHub ↗

Creates the list of filters and sources to be added in the filter file. Args: parent_filter_name: The name of the filter under which the sources are found. sources: The hierarchy of filters and sources to process. extension_to_rule_name: A dictionary mapping

(
    parent_filter_name,
    sources,
    rule_dependencies,
    extension_to_rule_name,
    platforms,
    toolset,
    filter_group,
    source_group,
)

Source from the content-addressed store, hash-verified

2213
2214
2215def _AppendFiltersForMSBuild(
2216 parent_filter_name,
2217 sources,
2218 rule_dependencies,
2219 extension_to_rule_name,
2220 platforms,
2221 toolset,
2222 filter_group,
2223 source_group,
2224):
2225 """Creates the list of filters and sources to be added in the filter file.
2226
2227 Args:
2228 parent_filter_name: The name of the filter under which the sources are
2229 found.
2230 sources: The hierarchy of filters and sources to process.
2231 extension_to_rule_name: A dictionary mapping file extensions to rules.
2232 filter_group: The list to which filter entries will be appended.
2233 source_group: The list to which source entries will be appended.
2234 """
2235 for source in sources:
2236 if isinstance(source, MSVSProject.Filter):
2237 # We have a sub-filter. Create the name of that sub-filter.
2238 if not parent_filter_name:
2239 filter_name = source.name
2240 else:
2241 filter_name = f"{parent_filter_name}\\{source.name}"
2242 # Add the filter to the group.
2243 filter_group.append(
2244 [
2245 "Filter",
2246 {"Include": filter_name},
2247 ["UniqueIdentifier", MSVSNew.MakeGuid(source.name)],
2248 ]
2249 )
2250 # Recurse and add its dependents.
2251 _AppendFiltersForMSBuild(
2252 filter_name,
2253 source.contents,
2254 rule_dependencies,
2255 extension_to_rule_name,
2256 platforms,
2257 toolset,
2258 filter_group,
2259 source_group,
2260 )
2261 else:
2262 # It's a source. Create a source entry.
2263 _, element = _MapFileToMsBuildSourceType(
2264 source, rule_dependencies, extension_to_rule_name, platforms, toolset
2265 )
2266 source_entry = [element, {"Include": source}]
2267 # Specify the filter it is part of, if any.
2268 if parent_filter_name:
2269 source_entry.append(["Filter", parent_filter_name])
2270 source_group.append(source_entry)
2271
2272

Callers 1

Calls 2

appendMethod · 0.45

Tested by

no test coverage detected