add parent static deps to cc_aidl_library targets
The static deps of the parent library can be necessary to build a
bp2build-generated cc_aidl_library target. We should add these deps as
implementation_deps so that they are accessible.
Bug: 250876486
Test: b build //frameworks/native/libs/gui/...
Change-Id: Ibe7c3598a684907473e2a4e040fb3976455a59e9
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 67a697a..03d9de8 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -917,15 +917,12 @@
if !aidlLibs.IsEmpty() {
ccAidlLibrarylabel := m.Name() + "_cc_aidl_library"
- // Since cc_aidl_library only needs the dynamic deps (aka shared libs) from the parent cc library for compiling,
- // we err on the side of not re-exporting the headers of the dynamic deps from cc_aidl_lirary
- // because the parent cc library already has all the dynamic deps
- implementationDynamicDeps := bazel.MakeLabelListAttribute(
- bazel.AppendBazelLabelLists(
- linkerAttrs.dynamicDeps.Value,
- linkerAttrs.implementationDynamicDeps.Value,
- ),
- )
+ // Since parent cc_library already has these dependencies, we can add them as implementation
+ // deps so that they don't re-export
+ implementationDeps := linkerAttrs.deps.Clone()
+ implementationDeps.Append(linkerAttrs.implementationDeps)
+ implementationDynamicDeps := linkerAttrs.dynamicDeps.Clone()
+ implementationDynamicDeps.Append(linkerAttrs.implementationDynamicDeps)
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{
@@ -935,7 +932,8 @@
android.CommonAttributes{Name: ccAidlLibrarylabel},
&ccAidlLibraryAttributes{
Deps: aidlLibs,
- Implementation_dynamic_deps: implementationDynamicDeps,
+ Implementation_deps: *implementationDeps,
+ Implementation_dynamic_deps: *implementationDynamicDeps,
},
)
label := &bazel.LabelAttribute{
diff --git a/cc/library.go b/cc/library.go
index 68de233..1b579cd 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -268,6 +268,7 @@
type ccAidlLibraryAttributes struct {
Deps bazel.LabelListAttribute
+ Implementation_deps bazel.LabelListAttribute
Implementation_dynamic_deps bazel.LabelListAttribute
}