Drop the default apex_available value from BUILD files

If apex_available is missing from Android.bp files, ApexAvailable
returns [//apex_available:platform], which is the default. To avoid
BUILD file verbosity, remove the build system default value from the
generated BUILD files.

Bug: 277651159
Test: go test ./bp2build

Change-Id: I4129c2a93ac28578f46ebeed49baa23ce727aa1f
This commit is contained in:
Spandan Das
2023-04-17 19:16:06 +00:00
parent 8e6386e0aa
commit 2dc6dfcb16

View File

@@ -747,7 +747,13 @@ func ApexAvailableTags(mod Module) bazel.StringListAttribute {
// TODO(b/218841706): hidl_interface has the apex_available prop, but it's
// defined directly as a prop and not via ApexModule, so this doesn't
// pick those props up.
attr.Value = ConvertApexAvailableToTags(am.apexModuleBase().ApexAvailable())
apexAvailable := am.apexModuleBase().ApexAvailable()
// If a user does not specify apex_available in Android.bp, then soong provides a default.
// To avoid verbosity of BUILD files, remove this default from user-facing BUILD files.
if len(am.apexModuleBase().ApexProperties.Apex_available) == 0 {
apexAvailable = []string{}
}
attr.Value = ConvertApexAvailableToTags(apexAvailable)
}
return attr
}