diff options
author | 2025-02-18 16:58:36 +0100 | |
---|---|---|
committer | 2025-02-21 10:23:03 +0100 | |
commit | 13ae6876120fa681b9b05d28d658591d59b2c92a (patch) | |
tree | 08653e60890078ab9d16b12eaa28dfc383ca980b | |
parent | e3360787a496405f01dcb7c16572a07035bea3f0 (diff) |
droidstubs: pass in --current-version <major.minor> to metalava
Instead of just passing the API level (or just the major SDK version) to
metalava via --current-version, pass in both major and minor version
(e.g. --current-version 36.1).
Ideally ApiLevel should be updated to support minor versions (and
potentially renamed SdkVersion), but that work falls outside the scope
of this CL which is intended to unblock work to support an SDK with a
non-zero minor version.
Bug: 392838750
Bug: 397644333
Test: m nothing
Ignore-AOSP-First: minor SDK development takes place on internal main
Change-Id: I17151b357dd06176dbaab3f9bdea29affe5c5011
-rw-r--r-- | android/config.go | 4 | ||||
-rw-r--r-- | java/droidstubs.go | 10 |
2 files changed, 13 insertions, 1 deletions
diff --git a/android/config.go b/android/config.go index acaad60ad..760a389c1 100644 --- a/android/config.go +++ b/android/config.go @@ -990,6 +990,10 @@ func (c *config) PlatformSdkVersion() ApiLevel { return uncheckedFinalApiLevel(*c.productVariables.Platform_sdk_version) } +func (c *config) PlatformSdkVersionFull() string { + return proptools.StringDefault(c.productVariables.Platform_sdk_version_full, "") +} + func (c *config) RawPlatformSdkVersion() *int { return c.productVariables.Platform_sdk_version } diff --git a/java/droidstubs.go b/java/droidstubs.go index 24dabdb36..40d6f18f2 100644 --- a/java/droidstubs.go +++ b/java/droidstubs.go @@ -564,7 +564,15 @@ func (d *Droidstubs) apiLevelsAnnotationsFlags(ctx android.ModuleContext, cmd *a }) } if apiVersions != nil { - cmd.FlagWithArg("--current-version ", ctx.Config().PlatformSdkVersion().String()) + // We are migrating from a single API level to major.minor + // versions and PlatformSdkVersionFull is not yet set in all + // release configs. If it is not set, fall back on the single + // API level. + if fullSdkVersion := ctx.Config().PlatformSdkVersionFull(); len(fullSdkVersion) > 0 { + cmd.FlagWithArg("--current-version ", fullSdkVersion) + } else { + cmd.FlagWithArg("--current-version ", ctx.Config().PlatformSdkVersion().String()) + } if ctx.Config().PlatformSdkVersion().String() != "36" || ctx.Config().PlatformSdkCodename() != "Baklava" { cmd.FlagWithArg("--current-codename ", ctx.Config().PlatformSdkCodename()) } |