gn2bp: create one action per arch

Action modules can have different args depending on target_cpu
(specifically, the buildflags action). Therefore, we create one action
per target os & arch.

Test: //components/cronet/android:cronet
Change-Id: I6025abba8eb9f1974ef0fa6b62f79998305374a3
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index d9e677a..6d23c55 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -273,11 +273,19 @@
     # Use name without toolchain for targets to support targets built for
     # multiple archs.
     target_name = label_without_toolchain(gn_target_name)
-    target = self.all_targets.get(target_name)
     desc = gn_desc[gn_target_name]
+    type_ = desc['type']
     arch = self._get_arch(desc['toolchain'])
+
+    # Action modules can differ depending on the target architecture, yet
+    # genrule's do not allow to overload cmd per target OS / arch.  Create a
+    # separate action for every architecture.
+    if type_ == 'action':
+      target_name += '__' + arch
+
+    target = self.all_targets.get(target_name)
     if target is None:
-      target = GnParser.Target(target_name, desc['type'])
+      target = GnParser.Target(target_name, type_)
       self.all_targets[target_name] = target
 
     if arch not in target.arch: