summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2019-04-23 00:18:54 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-04-23 00:18:54 +0000
commit6fa6dfa25d67c83ea86d5cb76857d19553ca1a3e (patch)
tree8fb829116c86abac87793f2ffd873878212d62e2
parente928452f307a95ad1d83443184f40019fdae2be4 (diff)
parent71b519d6ce98fc0313019d84777bfc04f3799efc (diff)
Merge "Set default target SDK version for APEX"
-rw-r--r--apex/apex.go11
-rw-r--r--apex/apex_test.go3
-rw-r--r--java/android_manifest.go2
-rw-r--r--java/sdk.go6
4 files changed, 18 insertions, 4 deletions
diff --git a/apex/apex.go b/apex/apex.go
index 004de86c7..509e0f2ee 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -977,6 +977,17 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, apexType ap
optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String())
}
+ targetSdkVersion := ctx.Config().DefaultAppTargetSdk()
+ if targetSdkVersion == ctx.Config().PlatformSdkCodename() &&
+ ctx.Config().UnbundledBuild() &&
+ !ctx.Config().UnbundledBuildUsePrebuiltSdks() &&
+ ctx.Config().IsEnvTrue("UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT") {
+ apiFingerprint := java.ApiFingerprintPath(ctx)
+ targetSdkVersion += fmt.Sprintf(".$$(cat %s)", apiFingerprint.String())
+ implicitInputs = append(implicitInputs, apiFingerprint)
+ }
+ optFlags = append(optFlags, "--target_sdk_version "+targetSdkVersion)
+
ctx.Build(pctx, android.BuildParams{
Rule: apexRule,
Implicits: implicitInputs,
diff --git a/apex/apex_test.go b/apex/apex_test.go
index fce213569..b0cd4be2f 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -171,6 +171,7 @@ func testApex(t *testing.T, bp string) *android.TestContext {
"testkey2.pem": nil,
"myapex-arm64.apex": nil,
"myapex-arm.apex": nil,
+ "frameworks/base/api/current.txt": nil,
})
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
android.FailIfErrored(t, errs)
@@ -190,6 +191,8 @@ func setup(t *testing.T) (config android.Config, buildDir string) {
config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("current")
config.TestProductVariables.DefaultAppCertificate = proptools.StringPtr("vendor/foo/devkeys/test")
config.TestProductVariables.CertificateOverrides = []string{"myapex_keytest:myapex.certificate.override"}
+ config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("Q")
+ config.TestProductVariables.Platform_sdk_final = proptools.BoolPtr(false)
return
}
diff --git a/java/android_manifest.go b/java/android_manifest.go
index 39cf4712a..8dc3b4752 100644
--- a/java/android_manifest.go
+++ b/java/android_manifest.go
@@ -74,7 +74,7 @@ func manifestMerger(ctx android.ModuleContext, manifest android.Path, sdkContext
ctx.Config().UnbundledBuild() &&
!ctx.Config().UnbundledBuildUsePrebuiltSdks() &&
ctx.Config().IsEnvTrue("UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT") {
- apiFingerprint := apiFingerprintPath(ctx)
+ apiFingerprint := ApiFingerprintPath(ctx)
targetSdkVersion += fmt.Sprintf(".$$(cat %s)", apiFingerprint.String())
deps = append(deps, apiFingerprint)
}
diff --git a/java/sdk.go b/java/sdk.go
index 36010b6fa..e93f8fb69 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -316,7 +316,7 @@ func sdkFrameworkAidlPath(ctx android.PathContext) android.OutputPath {
// Create api_fingerprint.txt
func createAPIFingerprint(ctx android.SingletonContext) {
- out := apiFingerprintPath(ctx)
+ out := ApiFingerprintPath(ctx)
rule := android.NewRuleBuilder()
@@ -359,7 +359,7 @@ func createAPIFingerprint(ctx android.SingletonContext) {
rule.Build(pctx, ctx, "api_fingerprint", "generate api_fingerprint.txt")
}
-func apiFingerprintPath(ctx android.PathContext) android.OutputPath {
+func ApiFingerprintPath(ctx android.PathContext) android.OutputPath {
return ctx.Config().Once(apiFingerprintPathKey, func() interface{} {
return android.PathForOutput(ctx, "api_fingerprint.txt")
}).(android.OutputPath)
@@ -371,5 +371,5 @@ func sdkMakeVars(ctx android.MakeVarsContext) {
}
ctx.Strict("FRAMEWORK_AIDL", sdkFrameworkAidlPath(ctx).String())
- ctx.Strict("API_FINGERPRINT", apiFingerprintPath(ctx).String())
+ ctx.Strict("API_FINGERPRINT", ApiFingerprintPath(ctx).String())
}