Allowlist fake_device_config in order to build some java_aconfig_library for host.
Bug: 305255550
Test: CI
Change-Id: Ic073a5fef0acccb7fcbbacb93c9f42ea80e8e154
diff --git a/aconfig/java_aconfig_library.go b/aconfig/java_aconfig_library.go
index 79573c7..f7f8db8 100644
--- a/aconfig/java_aconfig_library.go
+++ b/aconfig/java_aconfig_library.go
@@ -99,6 +99,7 @@
Aconfig_declarations bazel.LabelAttribute
Test *bool
Sdk_version *string
+ Libs bazel.LabelListAttribute
}
func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) Bp2build(ctx android.Bp2buildMutatorContext, module *java.GeneratedJavaLibraryModule) {
@@ -118,10 +119,28 @@
// modules in framework/base use core_platform which is not supported by bazel yet.
// TODO(b/302148527): change soong to default to system_current as well.
sdkVersion := "system_current"
+
+ var libs bazel.LabelListAttribute
+ archVariantProps := module.GetArchVariantProperties(ctx, &java.CommonProperties{})
+ for axis, configToProps := range archVariantProps {
+ for config, p := range configToProps {
+ if archProps, ok := p.(*java.CommonProperties); ok {
+ var libLabels []bazel.Label
+ for _, d := range archProps.Libs {
+ neverlinkLabel := android.BazelLabelForModuleDepSingle(ctx, d)
+ neverlinkLabel.Label = neverlinkLabel.Label + "-neverlink"
+ libLabels = append(libLabels, neverlinkLabel)
+ }
+ libs.SetSelectValue(axis, config, (bazel.MakeLabelList(libLabels)))
+ }
+ }
+ }
+
attrs := bazelJavaAconfigLibraryAttributes{
Aconfig_declarations: *bazel.MakeLabelAttribute(android.BazelLabelForModuleDepSingle(ctx, callbacks.properties.Aconfig_declarations).Label),
Test: callbacks.properties.Test,
Sdk_version: &sdkVersion,
+ Libs: libs,
}
props := bazel.BazelTargetModuleProperties{
Rule_class: "java_aconfig_library",