gn2bp: add is_linker_unit_type helper to Target
Test: none
Change-Id: I4c1a8be6d3bd3676dd0ea6ef700b01db1134119f
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index b3f51c9..f45a6b6 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -182,6 +182,9 @@
def device_supported(self):
return any([name.startswith('android') for name in self.arch.keys()])
+ def is_linker_unit_type(self):
+ return self.type in LINKER_UNIT_TYPES
+
def __lt__(self, other):
if isinstance(other, self.__class__):
return self.name < other.name
@@ -344,7 +347,7 @@
elif target.type == 'source_set':
self.source_sets[gn_target_name] = target
target.arch[arch].sources.update(desc.get('sources', []))
- elif target.type in LINKER_UNIT_TYPES:
+ elif target.is_linker_unit_type():
self.linker_units[gn_target_name] = target
target.arch[arch].sources.update(desc.get('sources', []))
elif (desc.get("script", "") in JAVA_BANNED_SCRIPTS
@@ -405,7 +408,7 @@
elif dep.type in ['action', 'action_foreach', 'copy']:
if proto_target_type is None:
target.arch[arch].deps.add(dep.name)
- elif dep.type in LINKER_UNIT_TYPES:
+ elif dep.is_linker_unit_type():
target.arch[arch].deps.add(dep.name)
elif dep.type == 'java_group':
# Explicitly break dependency chain when a java_group is added.