Use raw {min,target}_sdk_version properties in android_app converter
The logic of EffectiveVersionString is product-variable dependent and is being implemented bazel-side in order to produce product agnostic BUILD files. A required additional product variable is added to the export list, and the "updatable" property of android_app is also bp2build-converted. Handling of max sdk version was not correct (it does not affect manifest values in Soong), so removing it for now. Bug: 274474008 Bug: 274474002 Test: CI Change-Id: I7a10bfabf914c8e86064b7ce61926701f87517e3
This commit is contained in:
28
java/app.go
28
java/app.go
@@ -1614,7 +1614,6 @@ func androidAppCertificateBp2Build(ctx android.TopDownMutatorContext, module *An
|
||||
|
||||
type manifestValueAttribute struct {
|
||||
MinSdkVersion *string
|
||||
MaxSdkVersion *string
|
||||
TargetSdkVersion *string
|
||||
}
|
||||
|
||||
@@ -1628,6 +1627,7 @@ type bazelAndroidAppAttributes struct {
|
||||
Manifest_values *manifestValueAttribute
|
||||
Optimize *bool
|
||||
Proguard_specs bazel.LabelListAttribute
|
||||
Updatable *bool
|
||||
}
|
||||
|
||||
// ConvertWithBp2build is used to convert android_app to Bazel.
|
||||
@@ -1638,28 +1638,9 @@ func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
}
|
||||
certificate, certificateName := android.BazelStringOrLabelFromProp(ctx, a.overridableAppProperties.Certificate)
|
||||
|
||||
manifestValues := &manifestValueAttribute{}
|
||||
// TODO(b/274474008 ): Directly convert deviceProperties.Min_sdk_version in bp2build
|
||||
// MinSdkVersion(ctx) calls SdkVersion(ctx) if no value for min_sdk_version is set
|
||||
minSdkVersion := a.MinSdkVersion(ctx)
|
||||
if !minSdkVersion.IsPreview() && !minSdkVersion.IsInvalid() {
|
||||
if minSdkStr, err := minSdkVersion.EffectiveVersionString(ctx); err == nil {
|
||||
manifestValues.MinSdkVersion = &minSdkStr
|
||||
}
|
||||
}
|
||||
|
||||
maxSdkVersion := a.MaxSdkVersion(ctx)
|
||||
if !maxSdkVersion.IsPreview() && !maxSdkVersion.IsInvalid() {
|
||||
if maxSdkStr, err := maxSdkVersion.EffectiveVersionString(ctx); err == nil {
|
||||
manifestValues.MaxSdkVersion = &maxSdkStr
|
||||
}
|
||||
}
|
||||
|
||||
targetSdkVersion := a.TargetSdkVersion(ctx)
|
||||
if !targetSdkVersion.IsPreview() && !targetSdkVersion.IsInvalid() {
|
||||
if targetSdkStr, err := targetSdkVersion.EffectiveVersionString(ctx); err == nil {
|
||||
manifestValues.TargetSdkVersion = &targetSdkStr
|
||||
}
|
||||
manifestValues := &manifestValueAttribute{
|
||||
MinSdkVersion: a.deviceProperties.Min_sdk_version,
|
||||
TargetSdkVersion: a.deviceProperties.Target_sdk_version,
|
||||
}
|
||||
|
||||
appAttrs := &bazelAndroidAppAttributes{
|
||||
@@ -1668,6 +1649,7 @@ func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
Certificate: certificate,
|
||||
Certificate_name: certificateName,
|
||||
Manifest_values: manifestValues,
|
||||
Updatable: a.appProperties.Updatable,
|
||||
}
|
||||
|
||||
if !BoolDefault(a.dexProperties.Optimize.Enabled, true) {
|
||||
|
Reference in New Issue
Block a user