Merge "Introduce BazelStringOrLabelFromProp." am: 95ac23eeeb

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2255856

Change-Id: I54a2fd05ede068d2d103769f7144a06aba66bf40
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2022-10-20 18:36:38 +00:00
committed by Automerger Merge Worker
6 changed files with 173 additions and 53 deletions

View File

@@ -2665,12 +2665,13 @@ func (o *OverrideApex) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
// Certificate
if overridableProperties.Certificate == nil {
// delegated to the rule attr default
attrs.Certificate = nil
// If overridableProperties.Certificate is nil, clear this out as
// well with zeroed structs, so the override_apex does not use the
// base apex's certificate.
attrs.Certificate = bazel.LabelAttribute{}
attrs.Certificate_name = bazel.StringAttribute{}
} else {
certificateName, certificate := java.ParseCertificateToAttribute(ctx, overridableProperties.Certificate)
attrs.Certificate_name = certificateName
attrs.Certificate = certificate
attrs.Certificate, attrs.Certificate_name = android.BazelStringOrLabelFromProp(ctx, overridableProperties.Certificate)
}
// Prebuilts
@@ -3322,8 +3323,8 @@ type bazelApexBundleAttributes struct {
Android_manifest bazel.LabelAttribute
File_contexts bazel.LabelAttribute
Key bazel.LabelAttribute
Certificate *bazel.Label // used when the certificate prop is a module
Certificate_name *string // used when the certificate prop is a string
Certificate bazel.LabelAttribute // used when the certificate prop is a module
Certificate_name bazel.StringAttribute // used when the certificate prop is a string
Min_sdk_version *string
Updatable bazel.BoolAttribute
Installable bazel.BoolAttribute
@@ -3385,7 +3386,8 @@ func convertWithBp2build(a *apexBundle, ctx android.TopDownMutatorContext) (baze
keyLabelAttribute.SetValue(android.BazelLabelForModuleDepSingle(ctx, *a.overridableProperties.Key))
}
certificateName, certificate := java.ParseCertificateToAttribute(ctx, a.overridableProperties.Certificate)
// Certificate
certificate, certificateName := android.BazelStringOrLabelFromProp(ctx, a.overridableProperties.Certificate)
nativeSharedLibs := &convertedNativeSharedLibs{
Native_shared_libs_32: bazel.LabelListAttribute{},