gn2bp: Update --proto_path and --cpp_out arg
--proto_path specify the directory in which to search for imports.
net_quic_proto and metrics_proto have files that import other files.
Get proper --proto_path from the args in the desc.
Also, update --cpp_out to follow --proto_path change.
There are 6 targets which use protoc_wrapper.py in the dependency
from cronet_package_android.
It is confirmed that they could build with this commit.
Test: m cronet_aml_net_isolation_info_proto_gen
(//net:isolation_info_proto)
Test: m cronet_aml_net_net_nqe_proto_gen
(//net:net_nqe_proto)
Test: m cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen
(//net/third_party/quiche:net_quic_test_tools_proto)
Test: m cronet_aml_net_cert_root_store_proto_full_gen
(//net/cert:root_store_proto_full)
Test: m cronet_aml_net_third_party_quiche_net_quic_proto_gen
(//net/third_party/quiche:net_quic_proto)
Test: m cronet_aml_third_party_metrics_proto_metrics_proto_gen
(//third_party/metrics_proto:metrics_proto)
Change-Id: Id19e956eb0eb3fb402f8aaa9eb94734b731c74fd
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 7d5795a..ffb0741 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -494,13 +494,13 @@
assert (target.type == 'proto_library')
tools = {'aprotoc'}
- cpp_out_dir = '$(genDir)/%s/' % tree_path
+ cpp_out_dir = '$(genDir)/%s/%s/' % (tree_path, target.proto_in_dir)
target_module_name = label_to_module_name(target.name)
# In GN builds the proto path is always relative to the output directory
# (out/tmp.xxx).
cmd = ['mkdir -p %s &&' % cpp_out_dir, '$(location aprotoc)']
- cmd += ['--proto_path=%s' % tree_path]
+ cmd += ['--proto_path=%s/%s' % (tree_path, target.proto_in_dir)]
if buildtools_protobuf_src in target.proto_paths:
cmd += ['--proto_path=%s' % android_protobuf_src]