Support empty strings in bp2build

Previously, could not set an empty string as a value of an attribute;
however, this is necessary in some cases. To not unnecessarily create an
empty string, use string pointers for attributes rather than strings.

Test: go test bp2build tests
Change-Id: I03b3a3567452d455246d22d81f86c317d06b7c39
This commit is contained in:
Liz Kammer
2021-12-01 10:09:34 -05:00
parent 7c721018bb
commit 46fb7aba4d
7 changed files with 57 additions and 28 deletions

View File

@@ -3186,7 +3186,7 @@ type bazelApexBundleAttributes struct {
File_contexts bazel.LabelAttribute
Key bazel.LabelAttribute
Certificate bazel.LabelAttribute
Min_sdk_version string
Min_sdk_version *string
Updatable bazel.BoolAttribute
Installable bazel.BoolAttribute
Native_shared_libs bazel.LabelListAttribute
@@ -3226,9 +3226,9 @@ func apexBundleBp2BuildInternal(ctx android.TopDownMutatorContext, module *apexB
fileContextsLabelAttribute.SetValue(android.BazelLabelForModuleDepSingle(ctx, *module.properties.File_contexts))
}
var minSdkVersion string
var minSdkVersion *string
if module.properties.Min_sdk_version != nil {
minSdkVersion = *module.properties.Min_sdk_version
minSdkVersion = module.properties.Min_sdk_version
}
var keyLabelAttribute bazel.LabelAttribute