Pass includes attrs to cc_aidl_library
https://source.android.com/docs/core/architecture/aidl/aidl-backends#custom-parcelables
Some aidl files have custom parcelables with references to cpp headers. Hence, we need to pass the include dirs from cc libs to cc_aidl_library so that custom cpp headers are findable by the generated cpp/h files.
Test: go test
Bug: 278704136
Change-Id: I4ede1d23fbc04bdbfb69823d955c6df6b0a7b4ee
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 8c090d8..5f3ff62 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -3330,7 +3330,8 @@
name: "foo",
aidl: {
libs: ["A_aidl"],
- }
+ },
+ export_include_dirs: ["include"],
}`,
ExpectedBazelTargets: []string{
MakeBazelTargetNoRestrictions("aidl_library", "A_aidl", AttrNameToString{
@@ -3340,15 +3341,19 @@
"tags": `["apex_available=//apex_available:anyapex"]`,
}),
MakeBazelTarget("cc_aidl_library", "foo_cc_aidl_library", AttrNameToString{
- "deps": `[":A_aidl"]`,
+ "deps": `[":A_aidl"]`,
+ "local_includes": `["."]`,
+ "export_includes": `["include"]`,
}),
MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
"implementation_whole_archive_deps": `[":foo_cc_aidl_library"]`,
"local_includes": `["."]`,
+ "export_includes": `["include"]`,
}),
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
"implementation_whole_archive_deps": `[":foo_cc_aidl_library"]`,
"local_includes": `["."]`,
+ "export_includes": `["include"]`,
}),
},
})
@@ -3382,6 +3387,7 @@
"srcs": `["B.aidl"]`,
}),
MakeBazelTarget("cc_aidl_library", "foo_cc_aidl_library", AttrNameToString{
+ "local_includes": `["."]`,
"deps": `[
":A_aidl",
":foo_aidl_library",
@@ -3421,7 +3427,8 @@
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("cc_aidl_library", "foo_cc_aidl_library", AttrNameToString{
- "deps": `["//path/to/A:A_aidl"]`,
+ "local_includes": `["."]`,
+ "deps": `["//path/to/A:A_aidl"]`,
}),
MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
"implementation_whole_archive_deps": `[":foo_cc_aidl_library"]`,
@@ -3440,7 +3447,8 @@
expectedBazelTargets := []string{
MakeBazelTarget("cc_aidl_library", "foo_cc_aidl_library", AttrNameToString{
- "deps": `[":foo_aidl_library"]`,
+ "local_includes": `["."]`,
+ "deps": `[":foo_aidl_library"]`,
}),
MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
"whole_archive_deps": `[":foo_cc_aidl_library"]`,
@@ -3721,7 +3729,8 @@
"srcs": `["Foo.aidl"]`,
}),
MakeBazelTarget("cc_aidl_library", "foo_cc_aidl_library", AttrNameToString{
- "deps": `[":foo_aidl_library"]`,
+ "local_includes": `["."]`,
+ "deps": `[":foo_aidl_library"]`,
"implementation_deps": `[
":baz-static",
":bar-static",