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:
@@ -423,7 +423,6 @@ android_app {
|
||||
name: "foo",
|
||||
sdk_version: "current",
|
||||
min_sdk_version: "24",
|
||||
max_sdk_version: "30",
|
||||
target_sdk_version: "29",
|
||||
optimize: {
|
||||
enabled: false,
|
||||
@@ -435,7 +434,6 @@ android_app {
|
||||
"manifest": `"AndroidManifest.xml"`,
|
||||
"resource_files": `[]`,
|
||||
"manifest_values": `{
|
||||
"maxSdkVersion": "30",
|
||||
"minSdkVersion": "24",
|
||||
"targetSdkVersion": "29",
|
||||
}`,
|
||||
@@ -464,10 +462,6 @@ android_app {
|
||||
MakeBazelTarget("android_binary", "foo", AttrNameToString{
|
||||
"manifest": `"AndroidManifest.xml"`,
|
||||
"resource_files": `[]`,
|
||||
"manifest_values": `{
|
||||
"minSdkVersion": "30",
|
||||
"targetSdkVersion": "30",
|
||||
}`,
|
||||
"sdk_version": `"30"`,
|
||||
"optimize": `False`,
|
||||
}),
|
||||
|
@@ -282,6 +282,7 @@ func platformMappingSingleProduct(
|
||||
result.WriteString(fmt.Sprintf(" --//build/bazel/product_config:memtag_heap_sync_include_paths=%s\n", strings.Join(productVariables.MemtagHeapSyncIncludePaths, ",")))
|
||||
result.WriteString(fmt.Sprintf(" --//build/bazel/product_config:manifest_package_name_overrides=%s\n", strings.Join(productVariables.ManifestPackageNameOverrides, ",")))
|
||||
result.WriteString(fmt.Sprintf(" --//build/bazel/product_config:native_coverage=%t\n", proptools.Bool(productVariables.Native_coverage)))
|
||||
result.WriteString(fmt.Sprintf(" --//build/bazel/product_config:platform_sdk_final=%t\n", proptools.Bool(productVariables.Platform_sdk_final)))
|
||||
result.WriteString(fmt.Sprintf(" --//build/bazel/product_config:platform_version_name=%s\n", proptools.String(productVariables.Platform_version_name)))
|
||||
result.WriteString(fmt.Sprintf(" --//build/bazel/product_config:product_brand=%s\n", productVariables.ProductBrand))
|
||||
result.WriteString(fmt.Sprintf(" --//build/bazel/product_config:product_manufacturer=%s\n", productVariables.ProductManufacturer))
|
||||
|
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