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

Method _LinkDependenciesInternal

tools/gyp/pylib/gyp/input.py:1811–1905  ·  view source on GitHub ↗

Returns an OrderedSet of dependency targets that are linked into this target. This function has a split personality, depending on the setting of |initial|. Outside callers should always leave |initial| at its default setting. When adding a target to the lis

(
        self, targets, include_shared_libraries, dependencies=None, initial=True
    )

Source from the content-addressed store, hash-verified

1809 return dependencies
1810
1811 def _LinkDependenciesInternal(
1812 self, targets, include_shared_libraries, dependencies=None, initial=True
1813 ):
1814 """Returns an OrderedSet of dependency targets that are linked
1815 into this target.
1816
1817 This function has a split personality, depending on the setting of
1818 |initial|. Outside callers should always leave |initial| at its default
1819 setting.
1820
1821 When adding a target to the list of dependencies, this function will
1822 recurse into itself with |initial| set to False, to collect dependencies
1823 that are linked into the linkable target for which the list is being built.
1824
1825 If |include_shared_libraries| is False, the resulting dependencies will not
1826 include shared_library targets that are linked into this target.
1827 """
1828 if dependencies is None:
1829 # Using a list to get ordered output and a set to do fast "is it
1830 # already added" checks.
1831 dependencies = OrderedSet()
1832
1833 # Check for None, corresponding to the root node.
1834 if self.ref is None:
1835 return dependencies
1836
1837 # It's kind of sucky that |targets| has to be passed into this function,
1838 # but that's presently the easiest way to access the target dicts so that
1839 # this function can find target types.
1840
1841 if "target_name" not in targets[self.ref]:
1842 raise GypError("Missing 'target_name' field in target.")
1843
1844 if "type" not in targets[self.ref]:
1845 raise GypError(
1846 "Missing 'type' field in target %s" % targets[self.ref]["target_name"]
1847 )
1848
1849 target_type = targets[self.ref]["type"]
1850
1851 is_linkable = target_type in linkable_types
1852
1853 if initial and not is_linkable:
1854 # If this is the first target being examined and it's not linkable,
1855 # return an empty list of link dependencies, because the link
1856 # dependencies are intended to apply to the target itself (initial is
1857 # True) and this target won't be linked.
1858 return dependencies
1859
1860 # Don't traverse 'none' targets if explicitly excluded.
1861 if target_type == "none" and not targets[self.ref].get(
1862 "dependencies_traverse", True
1863 ):
1864 dependencies.add(self.ref)
1865 return dependencies
1866
1867 # Executables, mac kernel extensions, windows drivers and loadable modules
1868 # are already fully and finally linked. Nothing else can be a link

Callers 2

Calls 4

addMethod · 0.95
OrderedSetClass · 0.90
GypErrorClass · 0.90
getMethod · 0.65

Tested by

no test coverage detected