gn2bp: add arch to Target
arch set will consist of Arch object that contain arch-dependent
properties (sources, flags, etc.).
Test: //components/cronet/android:cronet
Change-Id: Ic5b62063d3c5ea07435c676eb11923defdf4e577
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 276f723..4f214b2 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -94,6 +94,12 @@
Maked properties are propagated up the dependency chain when a
source_set dependency is encountered.
"""
+ class Arch():
+ """Architecture-dependent properties
+ """
+ def __init__(self):
+ self.sources = set()
+
def __init__(self, name, type):
self.name = name # e.g. //src/ipc:ipc
@@ -144,6 +150,8 @@
# placeholder target once we hit //gn:protoc or similar.
self.is_third_party_dep_ = False
+ self.arch = dict()
+
def __lt__(self, other):
if isinstance(other, self.__class__):
return self.name < other.name
@@ -211,14 +219,20 @@
# multiple archs.
target_name = label_without_toolchain(gn_target_name)
target = self.all_targets.get(target_name)
- if target is not None:
+ desc = gn_desc[gn_target_name]
+ # TODO: get arch from toolchain
+ arch = 'x86_64'
+ if target is None:
+ target = GnParser.Target(target_name, desc['type'])
+ self.all_targets[target_name] = target
+
+ if arch not in target.arch:
+ target.arch[arch] = GnParser.Target.Arch()
+ else:
return target # Target already processed.
- desc = gn_desc[gn_target_name]
- target = GnParser.Target(target_name, desc['type'])
target.testonly = desc.get('testonly', False)
target.toolchain = desc.get('toolchain', None)
- self.all_targets[target_name] = target
proto_target_type, proto_desc = self.get_proto_target_type(gn_desc, gn_target_name)
if proto_target_type is not None: