Create Stub targets for cc_library_(static|shared)
Fixes: 246958825
Test: Temporarily allowlist module and inspect BUILD.bazel
Change-Id: I4baeec2d873fefabd49ce77508630b82f759820a
diff --git a/cc/library.go b/cc/library.go
index 93bb26a..62937cb 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -442,6 +442,10 @@
android.CommonAttributes{Name: m.Name()},
sharedTargetAttrs, sharedAttrs.Enabled)
+ createStubsBazelTargetIfNeeded(ctx, m, compilerAttrs, exportedIncludes, baseAttributes)
+}
+
+func createStubsBazelTargetIfNeeded(ctx android.TopDownMutatorContext, m *Module, compilerAttrs compilerAttributes, exportedIncludes BazelIncludes, baseAttributes baseAttributes) {
if compilerAttrs.stubsSymbolFile != nil && len(compilerAttrs.stubsVersions.Value) > 0 {
stubSuitesProps := bazel.BazelTargetModuleProperties{
Rule_class: "cc_stub_suite",
@@ -2709,6 +2713,8 @@
}
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, attrs)
+
+ createStubsBazelTargetIfNeeded(ctx, module, compilerAttrs, exportedIncludes, baseAttributes)
}
// TODO(b/199902614): Can this be factored to share with the other Attributes?