Convert aidl.export_aidl_headers in cc library to Bazel
Export/not aidl headers aren't fully properly functional until b/239311679 is fixed.
Test: go test
Bug: 243023967
Change-Id: I33ec9a591b4bc53aa0aa95d099159cb0a79c39cb
diff --git a/cc/bp2build.go b/cc/bp2build.go
index c1a3bef..a2e0a31 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -723,15 +723,23 @@
(&compilerAttrs.srcs).Add(bp2BuildYasm(ctx, module, compilerAttrs))
protoDep := bp2buildProto(ctx, module, compilerAttrs.protoSrcs)
- aidlDep := bp2buildCcAidlLibrary(ctx, module, compilerAttrs.aidlSrcs)
// bp2buildProto will only set wholeStaticLib or implementationWholeStaticLib, but we don't know
// which. This will add the newly generated proto library to the appropriate attribute and nothing
// to the other
(&linkerAttrs).wholeArchiveDeps.Add(protoDep.wholeStaticLib)
(&linkerAttrs).implementationWholeArchiveDeps.Add(protoDep.implementationWholeStaticLib)
- // TODO(b/243023967) Add aidlDep to implementationWholeArchiveDeps if aidl.export_aidl_headers is true
- (&linkerAttrs).wholeArchiveDeps.Add(aidlDep)
+
+ aidlDep := bp2buildCcAidlLibrary(ctx, module, compilerAttrs.aidlSrcs)
+ if aidlDep != nil {
+ if lib, ok := module.linker.(*libraryDecorator); ok {
+ if proptools.Bool(lib.Properties.Aidl.Export_aidl_headers) {
+ (&linkerAttrs).wholeArchiveDeps.Add(aidlDep)
+ } else {
+ (&linkerAttrs).implementationWholeArchiveDeps.Add(aidlDep)
+ }
+ }
+ }
convertedLSrcs := bp2BuildLex(ctx, module.Name(), compilerAttrs)
(&compilerAttrs).srcs.Add(&convertedLSrcs.srcName)