gn2bp:

Test: ./update_result.sh
Change-Id: Idbee55191720949f82cf3b6b1df4d5c5da43712c
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index a1878b5..d5c1e94 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -2029,11 +2029,11 @@
          "--proto-in-dir " +
          "`dirname $(location net/cert/root_store.proto)` " +
          "--cc-out-dir " +
-         "clang_x64/gen/net/cert/root_store_proto_full/ " +
+         "$(genDir) " +
          " " +
          "",
     out: [
-        "net/cert/root_store_proto_full/root_store.pb.cc",
+        "root_store.pb.cc",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -2055,11 +2055,11 @@
          "--proto-in-dir " +
          "`dirname $(location net/cert/root_store.proto)` " +
          "--cc-out-dir " +
-         "clang_x64/gen/net/cert/root_store_proto_full/ " +
+         "$(genDir) " +
          " " +
          "",
     out: [
-        "net/cert/root_store_proto_full/root_store.pb.h",
+        "root_store.pb.h",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -2269,11 +2269,11 @@
          "--proto-in-dir " +
          "`dirname $(location net/base/isolation_info.proto)` " +
          "--cc-out-dir " +
-         "$(genDir)/net/base " +
+         "$(genDir) " +
          " " +
          "",
     out: [
-        "net/base/isolation_info.pb.cc",
+        "isolation_info.pb.cc",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -2295,11 +2295,11 @@
          "--proto-in-dir " +
          "`dirname $(location net/base/isolation_info.proto)` " +
          "--cc-out-dir " +
-         "$(genDir)/net/base " +
+         "$(genDir) " +
          " " +
          "",
     out: [
-        "net/base/isolation_info.pb.h",
+        "isolation_info.pb.h",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -3081,7 +3081,7 @@
          "--proto-in-dir " +
          "`dirname $(location net/nqe/proto/network_id_proto.proto)` " +
          "--cc-out-dir " +
-         "$(genDir)/net/nqe/proto " +
+         "$(genDir) " +
          "--cc-options " +
          "dllexport_decl=NET_EXPORT_PRIVATE: " +
          " " +
@@ -3090,7 +3090,7 @@
          " " +
          "",
     out: [
-        "net/nqe/proto/network_id_proto.pb.cc",
+        "network_id_proto.pb.cc",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -3113,7 +3113,7 @@
          "--proto-in-dir " +
          "`dirname $(location net/nqe/proto/network_id_proto.proto)` " +
          "--cc-out-dir " +
-         "$(genDir)/net/nqe/proto " +
+         "$(genDir) " +
          "--cc-options " +
          "dllexport_decl=NET_EXPORT_PRIVATE: " +
          " " +
@@ -3122,7 +3122,7 @@
          " " +
          "",
     out: [
-        "net/nqe/proto/network_id_proto.pb.h",
+        "network_id_proto.pb.h",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -3342,7 +3342,7 @@
          "--proto-in-dir " +
          "`dirname $(location net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.proto)`/../../../../ " +
          "--cc-out-dir " +
-         "$(genDir)/net/third_party/quiche/src " +
+         "$(genDir) " +
          "--cc-options " +
          "dllexport_decl=COMPONENT_EXPORT(QUICHE): " +
          " " +
@@ -3351,9 +3351,9 @@
          " " +
          "",
     out: [
-        "net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.pb.cc",
-        "net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config.pb.cc",
-        "net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.pb.cc",
+        "cached_network_parameters.pb.cc",
+        "crypto_server_config.pb.cc",
+        "source_address_token.pb.cc",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -3380,7 +3380,7 @@
          "--proto-in-dir " +
          "`dirname $(location net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.proto)`/../../../../ " +
          "--cc-out-dir " +
-         "$(genDir)/net/third_party/quiche/src " +
+         "$(genDir) " +
          "--cc-options " +
          "dllexport_decl=COMPONENT_EXPORT(QUICHE): " +
          " " +
@@ -3389,9 +3389,9 @@
          " " +
          "",
     out: [
-        "net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.pb.h",
-        "net/third_party/quiche/src/quiche/quic/core/proto/crypto_server_config.pb.h",
-        "net/third_party/quiche/src/quiche/quic/core/proto/source_address_token.pb.h",
+        "cached_network_parameters.pb.h",
+        "crypto_server_config.pb.h",
+        "source_address_token.pb.h",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -3469,7 +3469,7 @@
          "--proto-in-dir " +
          "`dirname $(location net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto)` " +
          "--cc-out-dir " +
-         "$(genDir)/net/third_party/quiche/src/quiche/quic/test_tools " +
+         "$(genDir) " +
          "--cc-options " +
          "dllexport_decl=NET_EXPORT_PRIVATE: " +
          " " +
@@ -3478,7 +3478,7 @@
          " " +
          "",
     out: [
-        "net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.pb.cc",
+        "send_algorithm_test_result.pb.cc",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
@@ -3501,7 +3501,7 @@
          "--proto-in-dir " +
          "`dirname $(location net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto)` " +
          "--cc-out-dir " +
-         "$(genDir)/net/third_party/quiche/src/quiche/quic/test_tools " +
+         "$(genDir) " +
          "--cc-options " +
          "dllexport_decl=NET_EXPORT_PRIVATE: " +
          " " +
@@ -3510,7 +3510,7 @@
          " " +
          "",
     out: [
-        "net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.pb.h",
+        "send_algorithm_test_result.pb.h",
     ],
     tool_files: [
         "tools/protoc_wrapper/protoc_wrapper.py",
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 674de98..88a7463 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -860,7 +860,7 @@
   elif target.script == "//tools/protoc_wrapper/protoc_wrapper.py":
     # Use protoc in the android
     module.tools.add("aprotoc")
-    target.outputs = [re.sub('^//out/test/', '', out) for out in target.outputs]
+    target.outputs = [os.path.basename(out) for out in target.outputs]
     for i, val in enumerate(target.args):
       if val == '--protoc':
         target.args[i + 1] = '$(location aprotoc)'
@@ -874,7 +874,7 @@
         if target.name == "//net/third_party/quiche:net_quic_proto_gen":
           target.args[i + 1] += '/../../../../'
       elif val == '--cc-out-dir':
-        target.args[i + 1] = re.sub('^gen', '$(genDir)', target.args[i + 1])
+        target.args[i + 1] = '$(genDir)'
       elif val == 'dllexport_decl':
         # Needs to be dllexport_decl=value format
         target.args[i] += '=' + target.args[i+1]