Merge "Always use "${codename}.${sha}" if UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true" into rvc-dev

This commit is contained in:
Nikita Ioffe 2020-03-04 21:54:26 +00:00 committed by Android (Google) Code Review
commit 307dd9f4a5
3 changed files with 13 additions and 17 deletions

View file

@ -443,21 +443,18 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
targetSdkVersion := ctx.Config().DefaultAppTargetSdk()
minSdkVersion := ctx.Config().DefaultAppTargetSdk()
// TODO: this should be based on min_sdk_version property of an APEX.
if proptools.Bool(a.properties.Legacy_android10_support) {
if !java.UseApiFingerprint(ctx, targetSdkVersion) {
targetSdkVersion = "29"
}
if !java.UseApiFingerprint(ctx, minSdkVersion) {
minSdkVersion = "29"
}
targetSdkVersion = "29"
minSdkVersion = "29"
}
if java.UseApiFingerprint(ctx, targetSdkVersion) {
targetSdkVersion += fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
if java.UseApiFingerprint(ctx) {
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
}
if java.UseApiFingerprint(ctx, minSdkVersion) {
minSdkVersion += fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
if java.UseApiFingerprint(ctx) {
minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
}
optFlags = append(optFlags, "--target_sdk_version "+targetSdkVersion)

View file

@ -99,8 +99,8 @@ func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext
if err != nil {
ctx.ModuleErrorf("invalid targetSdkVersion: %s", err)
}
if UseApiFingerprint(ctx, targetSdkVersion) {
targetSdkVersion += fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
if UseApiFingerprint(ctx) {
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
deps = append(deps, ApiFingerprintPath(ctx))
}
@ -108,8 +108,8 @@ func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext
if err != nil {
ctx.ModuleErrorf("invalid minSdkVersion: %s", err)
}
if UseApiFingerprint(ctx, minSdkVersion) {
minSdkVersion += fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
if UseApiFingerprint(ctx) {
minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
deps = append(deps, ApiFingerprintPath(ctx))
}

View file

@ -50,9 +50,8 @@ type sdkContext interface {
targetSdkVersion() sdkSpec
}
func UseApiFingerprint(ctx android.BaseModuleContext, v string) bool {
if v == ctx.Config().PlatformSdkCodename() &&
ctx.Config().UnbundledBuild() &&
func UseApiFingerprint(ctx android.BaseModuleContext) bool {
if ctx.Config().UnbundledBuild() &&
!ctx.Config().UnbundledBuildUsePrebuiltSdks() &&
ctx.Config().IsEnvTrue("UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT") {
return true