Merge "Propagate min_sdk_version to apexer" am: 97cbce163f

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

Change-Id: I77e035414678f4fef5e24eecbd8a489b6dc0e193
This commit is contained in:
Nikita Ioffe
2020-10-21 17:54:58 +00:00
committed by Automerger Merge Worker

View File

@@ -21,6 +21,7 @@ import (
"path/filepath" "path/filepath"
"runtime" "runtime"
"sort" "sort"
"strconv"
"strings" "strings"
"android/soong/android" "android/soong/android"
@@ -552,14 +553,16 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String()) optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String())
} }
targetSdkVersion := ctx.Config().DefaultAppTargetSdk(ctx).String()
// TODO(b/157078772): propagate min_sdk_version to apexer.
minSdkVersion := ctx.Config().DefaultAppTargetSdk(ctx).String()
moduleMinSdkVersion := a.minSdkVersion(ctx) moduleMinSdkVersion := a.minSdkVersion(ctx)
if moduleMinSdkVersion.EqualTo(android.SdkVersion_Android10) { minSdkVersion := moduleMinSdkVersion.String()
minSdkVersion = moduleMinSdkVersion.String()
// bundletool doesn't understand what "current" is. We need to transform it to codename
if moduleMinSdkVersion.IsCurrent() {
minSdkVersion = ctx.Config().DefaultAppTargetSdk(ctx).String()
} }
// apex module doesn't have a concept of target_sdk_version, hence for the time being
// targetSdkVersion == default targetSdkVersion of the branch.
targetSdkVersion := strconv.Itoa(ctx.Config().DefaultAppTargetSdk(ctx).FinalOrFutureInt())
if java.UseApiFingerprint(ctx) { if java.UseApiFingerprint(ctx) {
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String()) targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())