gn2bp: Generate bofingssl_asm module for x86

This is required to build third_party/boringssl for x86

Test: ./update_results.sh
Change-Id: I3ed81b5a00071e9ebc52bb2b40d9fc0624efc916
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index f996a2b..5b635f7 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -5548,6 +5548,26 @@
     ],
 }
 
+// GN: //third_party/boringssl:boringssl_asm
+filegroup {
+    name: "cronet_aml_third_party_boringssl_boringssl_asm_x86",
+    srcs: [
+        "third_party/boringssl/linux-x86/crypto/chacha/chacha-x86.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/aesni-x86.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/bn-586.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/co-586.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/ghash-ssse3-x86.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/ghash-x86.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/md5-586.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/sha1-586.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/sha256-586.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/sha512-586.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/vpaes-x86.S",
+        "third_party/boringssl/linux-x86/crypto/fipsmodule/x86-mont.S",
+        "third_party/boringssl/linux-x86/crypto/test/trampoline-x86.S",
+    ],
+}
+
 // GN: //third_party/boringssl/src/third_party/fiat:fiat_license
 filegroup {
     name: "cronet_aml_third_party_boringssl_src_third_party_fiat_fiat_license",
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 1b550bc..6e4792e 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -499,6 +499,11 @@
   label_without_toolchain = gn_utils.label_without_toolchain(label)
   module = re.sub(r'^//:?', '', label_without_toolchain)
   module = re.sub(r'[^a-zA-Z0-9_]', '_', module)
+
+  # If it's required to support multi toolchain for more targets, it's better to avoid hardcoding.
+  if label == "//third_party/boringssl:boringssl_asm(//build/toolchain/android:android_clang_x86)":
+    module += "_x86"
+
   if not module.startswith(module_prefix):
     return module_prefix + module
   return module
@@ -1297,6 +1302,13 @@
   for target in targets:
     create_modules_from_target(blueprint, gn, target)
 
+  # Currently, multi tool chain is not supported for all targets and create_modules_from_target can
+  # not reach to this target by following the dependency.
+  # So it's required to specify explicitly.
+  create_modules_from_target(blueprint, gn,
+                             "//third_party/boringssl:boringssl_asm" +
+                             "(//build/toolchain/android:android_clang_x86)")
+
   create_java_module(blueprint, gn)
   update_jni_registration_module(blueprint, gn)