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/cc/bp2build.go b/cc/bp2build.go
index 1980ab9..202eebc 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -844,6 +844,7 @@
Value: aidlLibs,
},
linkerAttrs,
+ compilerAttrs,
)
if aidlDep != nil {
if lib, ok := module.linker.(*libraryDecorator); ok {
@@ -992,6 +993,7 @@
aidlSrcs bazel.LabelListAttribute,
aidlLibs bazel.LabelListAttribute,
linkerAttrs linkerAttributes,
+ compilerAttrs compilerAttributes,
) *bazel.LabelAttribute {
var aidlLibsFromSrcs, aidlFiles bazel.LabelListAttribute
apexAvailableTags := android.ApexAvailableTagsWithoutTestApexes(ctx.(android.TopDownMutatorContext), ctx.Module())
@@ -1038,6 +1040,15 @@
sdkAttrs := bp2BuildParseSdkAttributes(m)
+ exportedIncludes := bp2BuildParseExportedIncludes(ctx, m, &compilerAttrs.includes)
+ includeAttrs := includesAttributes{
+ Export_includes: exportedIncludes.Includes,
+ Export_absolute_includes: exportedIncludes.AbsoluteIncludes,
+ Export_system_includes: exportedIncludes.SystemIncludes,
+ Local_includes: compilerAttrs.localIncludes,
+ Absolute_includes: compilerAttrs.absoluteIncludes,
+ }
+
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{
Rule_class: "cc_aidl_library",
@@ -1050,6 +1061,7 @@
Implementation_dynamic_deps: *implementationDynamicDeps,
Tags: apexAvailableTags,
sdkAttributes: sdkAttrs,
+ includesAttributes: includeAttrs,
},
)
label := &bazel.LabelAttribute{