Produce _alwayslink sibling targets through bp2build
Add Alwayslink to bazelPrebuiltLibraryStaticAttributes
Also adjust the corresponding tests to espect these new targets.
Test: m libc
Test: b build --config=android //prebuilts/clang/host/linux-x86:libunwind-exported_alwayslink
Test: bp2build.sh
Bug: 267214124
Change-Id: I4d996aef55321f1827947f00b0eaa52d0a14413e
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index bb517ea..5b7ba43 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -352,6 +352,7 @@
Static_library bazel.LabelAttribute
Export_includes bazel.StringListAttribute
Export_system_includes bazel.StringListAttribute
+ Alwayslink bazel.BoolAttribute
}
// TODO(b/228623543): The below is not entirely true until the bug is fixed. For now, both targets are always generated
@@ -389,6 +390,11 @@
tags := android.ApexAvailableTags(module)
ctx.CreateBazelTargetModuleWithRestrictions(props, android.CommonAttributes{Name: name, Tags: tags}, attrs, prebuiltAttrs.Enabled)
+
+ _true := true
+ alwayslinkAttrs := *attrs
+ alwayslinkAttrs.Alwayslink.SetValue(&_true)
+ ctx.CreateBazelTargetModuleWithRestrictions(props, android.CommonAttributes{Name: name + "_alwayslink", Tags: tags}, &alwayslinkAttrs, prebuiltAttrs.Enabled)
}
type bazelPrebuiltLibrarySharedAttributes struct {