summaryrefslogtreecommitdiff
path: root/rust/rust.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2023-08-15 22:08:18 +0000
committer Spandan Das <spandandas@google.com> 2023-08-17 00:16:00 +0000
commitec39d516af50f2173128688ad57a5d1570175cd2 (patch)
treecb2be00ef95239cd5f74fb949c519fabd380e6ac /rust/rust.go
parent03010664c89cdc98a3f191111e546bc85c77c25b (diff)
Handle proto.include_dirs in bp2build for CC
Soong's proto.include_dirs becomes the -I path for aprotoc cpp code generation. This does not translate well to Bazel because it runs this action in a sandbox. Even if we construct an -I path, the .proto files will not be there. This CL attempts to handle this kind of dependency automatically via bp2build. For this hypothetical example ``` foo.proto # contains `import bar.proto" Android.bp # cc_library {srcs:"foo.proto", p.include_dirs:["subdir"]}, subdir/bar.proto ``` Implementation details for CcProtoGen of foo - Glob the labels of .proto files for each includeDir, and create a proto_library that encapsulates them. - Since Bazel poses a contraint that proto_library target needs to be in the same pacakge as the .proto file, the proto_library might be created in a subdirectory with an import_prefix - Add bar's proto_library as transitive deps of foo's cc_proto_library. This will be added to -I during aprotoc. We cannot add them to `deps`, otherwise bar's symbols will be statically linked into foo's .a file. Implementation details for clang compile of foo At the end of CcProtoGen, we have converted foo.proto to .cpp/.h files. To compile them to .a files, we need the .h files generated from bar.proto. Soong specifies this at the top-level cc_library soong module, so add those deps as the implementation deps for clang compile. (Will add support for java in a follow-up CL) Test: go test ./bp2build Test: built some internal modules that were previously blocked by this Bug: 285140726 Change-Id: I7e1f9f0d1b1ba916a7ba8278f6cfb342b381d695
Diffstat (limited to 'rust/rust.go')
0 files changed, 0 insertions, 0 deletions