Merge "Always use "${codename}.${sha}" if UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true"
This commit is contained in:
@@ -453,21 +453,18 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||||||
targetSdkVersion := ctx.Config().DefaultAppTargetSdk()
|
targetSdkVersion := ctx.Config().DefaultAppTargetSdk()
|
||||||
minSdkVersion := 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 proptools.Bool(a.properties.Legacy_android10_support) {
|
||||||
if !java.UseApiFingerprint(ctx, targetSdkVersion) {
|
|
||||||
targetSdkVersion = "29"
|
targetSdkVersion = "29"
|
||||||
}
|
|
||||||
if !java.UseApiFingerprint(ctx, minSdkVersion) {
|
|
||||||
minSdkVersion = "29"
|
minSdkVersion = "29"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if java.UseApiFingerprint(ctx, targetSdkVersion) {
|
if java.UseApiFingerprint(ctx) {
|
||||||
targetSdkVersion += fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
|
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
|
||||||
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
|
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
|
||||||
}
|
}
|
||||||
if java.UseApiFingerprint(ctx, minSdkVersion) {
|
if java.UseApiFingerprint(ctx) {
|
||||||
minSdkVersion += fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
|
minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
|
||||||
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
|
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
|
||||||
}
|
}
|
||||||
optFlags = append(optFlags, "--target_sdk_version "+targetSdkVersion)
|
optFlags = append(optFlags, "--target_sdk_version "+targetSdkVersion)
|
||||||
|
@@ -99,8 +99,8 @@ func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ModuleErrorf("invalid targetSdkVersion: %s", err)
|
ctx.ModuleErrorf("invalid targetSdkVersion: %s", err)
|
||||||
}
|
}
|
||||||
if UseApiFingerprint(ctx, targetSdkVersion) {
|
if UseApiFingerprint(ctx) {
|
||||||
targetSdkVersion += fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
|
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
|
||||||
deps = append(deps, ApiFingerprintPath(ctx))
|
deps = append(deps, ApiFingerprintPath(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,8 +108,8 @@ func manifestFixer(ctx android.ModuleContext, manifest android.Path, sdkContext
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ModuleErrorf("invalid minSdkVersion: %s", err)
|
ctx.ModuleErrorf("invalid minSdkVersion: %s", err)
|
||||||
}
|
}
|
||||||
if UseApiFingerprint(ctx, minSdkVersion) {
|
if UseApiFingerprint(ctx) {
|
||||||
minSdkVersion += fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
|
minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
|
||||||
deps = append(deps, ApiFingerprintPath(ctx))
|
deps = append(deps, ApiFingerprintPath(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,9 +50,8 @@ type sdkContext interface {
|
|||||||
targetSdkVersion() sdkSpec
|
targetSdkVersion() sdkSpec
|
||||||
}
|
}
|
||||||
|
|
||||||
func UseApiFingerprint(ctx android.BaseModuleContext, v string) bool {
|
func UseApiFingerprint(ctx android.BaseModuleContext) bool {
|
||||||
if v == ctx.Config().PlatformSdkCodename() &&
|
if ctx.Config().UnbundledBuild() &&
|
||||||
ctx.Config().UnbundledBuild() &&
|
|
||||||
!ctx.Config().UnbundledBuildUsePrebuiltSdks() &&
|
!ctx.Config().UnbundledBuildUsePrebuiltSdks() &&
|
||||||
ctx.Config().IsEnvTrue("UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT") {
|
ctx.Config().IsEnvTrue("UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT") {
|
||||||
return true
|
return true
|
||||||
|
Reference in New Issue
Block a user