diff options
author | Colin Cross <ccross@android.com> | 2019-04-18 14:27:12 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2019-04-22 10:08:35 -0700 |
commit | 5c87791a78fc31620b165300c7976d8cf5674f9c (patch) | |
tree | 256ca17a5e27c087a66107b04e38b6efa03f172b /java/android_manifest.go | |
parent | 9bdfaf059105ab75bd4ca99629ce02659fe850fd (diff) | |
download | build_soong-5c87791a78fc31620b165300c7976d8cf5674f9c.tar.gz build_soong-5c87791a78fc31620b165300c7976d8cf5674f9c.tar.bz2 build_soong-5c87791a78fc31620b165300c7976d8cf5674f9c.zip |
Allow codename.fingerprint format for targetSdkVersion
Use codename.fingerprint format for targetSdkVersion if it is unset
in the manifest and UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true.
Test: manual
Bug: 130541924
Change-Id: I4e3b1274cc32038b00b292dc6d67559eb320e9e4
Merged-In: I4e3b1274cc32038b00b292dc6d67559eb320e9e4
(cherry picked from commit 109328714ff626446e16cfdd3103a5b969284841)
Diffstat (limited to 'java/android_manifest.go')
-rw-r--r-- | java/android_manifest.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/java/android_manifest.go b/java/android_manifest.go index d72476d8..39cf4712 100644 --- a/java/android_manifest.go +++ b/java/android_manifest.go @@ -68,15 +68,27 @@ func manifestMerger(ctx android.ModuleContext, manifest android.Path, sdkContext args = append(args, "--use-embedded-dex=true") } + var deps android.Paths + targetSdkVersion := sdkVersionOrDefault(ctx, sdkContext.targetSdkVersion()) + if targetSdkVersion == ctx.Config().PlatformSdkCodename() && + ctx.Config().UnbundledBuild() && + !ctx.Config().UnbundledBuildUsePrebuiltSdks() && + ctx.Config().IsEnvTrue("UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT") { + apiFingerprint := apiFingerprintPath(ctx) + targetSdkVersion += fmt.Sprintf(".$$(cat %s)", apiFingerprint.String()) + deps = append(deps, apiFingerprint) + } + // Inject minSdkVersion into the manifest fixedManifest := android.PathForModuleOut(ctx, "manifest_fixer", "AndroidManifest.xml") ctx.Build(pctx, android.BuildParams{ - Rule: manifestFixerRule, - Input: manifest, - Output: fixedManifest, + Rule: manifestFixerRule, + Input: manifest, + Implicits: deps, + Output: fixedManifest, Args: map[string]string{ "minSdkVersion": sdkVersionOrDefault(ctx, sdkContext.minSdkVersion()), - "targetSdkVersion": sdkVersionOrDefault(ctx, sdkContext.targetSdkVersion()), + "targetSdkVersion": targetSdkVersion, "args": strings.Join(args, " "), }, }) |