gn2bp: Set --proto-in-dir arg for protoc_wrapper.py
Test: ./update_result.sh
Change-Id: I664fb94a92c89a27a06157128474ac5622707c23
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index c479c18..8b883ee 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -3220,7 +3220,7 @@
"--protoc " +
"$(location aprotoc) " +
"--proto-in-dir " +
- "../../net/cert " +
+ "`dirname $(location net/cert/root_store.proto)` " +
"--cc-out-dir " +
"clang_x64/gen/net/cert/root_store_proto_full/ " +
"--py-out-dir " +
@@ -3430,7 +3430,7 @@
"--protoc " +
"$(location aprotoc) " +
"--proto-in-dir " +
- "../../net/base " +
+ "`dirname $(location net/base/isolation_info.proto)` " +
"--cc-out-dir " +
"gen/net/base " +
"--py-out-dir " +
@@ -4211,7 +4211,7 @@
"--protoc " +
"$(location aprotoc) " +
"--proto-in-dir " +
- "../../net/nqe/proto " +
+ "`dirname $(location net/nqe/proto/network_id_proto.proto)` " +
"--cc-out-dir " +
"gen/net/nqe/proto " +
"--cc-options " +
@@ -4437,7 +4437,7 @@
"--protoc " +
"$(location aprotoc) " +
"--proto-in-dir " +
- "../../net/third_party/quiche/src " +
+ "`dirname $(location net/third_party/quiche/src/quiche/quic/core/proto/cached_network_parameters.proto)`/../../../../ " +
"--cc-out-dir " +
"gen/net/third_party/quiche/src " +
"--cc-options " +
@@ -4525,7 +4525,7 @@
"--protoc " +
"$(location aprotoc) " +
"--proto-in-dir " +
- "../../net/third_party/quiche/src/quiche/quic/test_tools " +
+ "`dirname $(location net/third_party/quiche/src/quiche/quic/test_tools/send_algorithm_test_result.proto)` " +
"--cc-out-dir " +
"gen/net/third_party/quiche/src/quiche/quic/test_tools " +
"--cc-options " +
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 33d1b71..4286c62 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -862,6 +862,15 @@
for i, val in enumerate(target.args):
if val == '--protoc':
target.args[i + 1] = '$(location aprotoc)'
+ elif val == '--proto-in-dir':
+ # Proto files in the cmd is relative path from --proto-in-dir
+ # Proto files are specified as filenames without directory except net_quic_proto_gen
+ # So getting directory from source file
+ proto_file = gn_utils.label_to_path(sorted(list(target.sources))[0])
+ target.args[i + 1] = '`dirname $(location %s)`' % proto_file
+ # Adjusting path for net_quic_proto_gen
+ if target.name == "//net/third_party/quiche:net_quic_proto_gen":
+ target.args[i + 1] += '/../../../../'
script = gn_utils.label_to_path(target.script)
module.tool_files.add(script)