diff options
author | 2023-03-22 19:57:52 +0000 | |
---|---|---|
committer | 2023-03-22 19:57:52 +0000 | |
commit | 7947b31a5577c3bb6dbcffb808dc8f71904249c5 (patch) | |
tree | 88498acf58c9b878d3f5e9dd721833f39111b47b /android/sdk_version.go | |
parent | f235505c9f70c2d29e943a32ad165ca7430b8fdc (diff) | |
parent | dd7057c715c4371fe7fc26df5ac32e6cde276898 (diff) |
Merge changes I10e8bea5,I8e013ec1
* changes:
Create EffectiveVersion* functions for ApiLevel
Create two sentinel api levels
Diffstat (limited to 'android/sdk_version.go')
-rw-r--r-- | android/sdk_version.go | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/android/sdk_version.go b/android/sdk_version.go index cace88a01..ab6e4f796 100644 --- a/android/sdk_version.go +++ b/android/sdk_version.go @@ -221,14 +221,7 @@ func (s SdkSpec) EffectiveVersion(ctx EarlyModuleContext) (ApiLevel, error) { if ctx.DeviceSpecific() || ctx.SocSpecific() { s = s.ForVendorPartition(ctx) } - if !s.ApiLevel.IsPreview() { - return s.ApiLevel, nil - } - ret := ctx.Config().DefaultAppTargetSdk(ctx) - if ret.IsPreview() { - return FutureApiLevel, nil - } - return ret, nil + return s.ApiLevel.EffectiveVersion(ctx) } // EffectiveVersionString converts an SdkSpec into the concrete version string that the module @@ -242,37 +235,12 @@ func (s SdkSpec) EffectiveVersionString(ctx EarlyModuleContext) (string, error) if ctx.DeviceSpecific() || ctx.SocSpecific() { s = s.ForVendorPartition(ctx) } - if !s.ApiLevel.IsPreview() { - return s.ApiLevel.String(), nil - } - // Determine the default sdk - ret := ctx.Config().DefaultAppTargetSdk(ctx) - if !ret.IsPreview() { - // If the default sdk has been finalized, return that - return ret.String(), nil - } - // There can be more than one active in-development sdks - // If an app is targeting an active sdk, but not the default one, return the requested active sdk. - // e.g. - // SETUP - // In-development: UpsideDownCake, VanillaIceCream - // Default: VanillaIceCream - // Android.bp - // min_sdk_version: `UpsideDownCake` - // RETURN - // UpsideDownCake and not VanillaIceCream - for _, preview := range ctx.Config().PreviewApiLevels() { - if s.ApiLevel.String() == preview.String() { - return preview.String(), nil - } - } - // Otherwise return the default one - return ret.String(), nil + return s.ApiLevel.EffectiveVersionString(ctx) } var ( SdkSpecNone = SdkSpec{SdkNone, NoneApiLevel, "(no version)"} - SdkSpecPrivate = SdkSpec{SdkPrivate, FutureApiLevel, ""} + SdkSpecPrivate = SdkSpec{SdkPrivate, PrivateApiLevel, ""} SdkSpecCorePlatform = SdkSpec{SdkCorePlatform, FutureApiLevel, "core_platform"} ) @@ -295,7 +263,7 @@ func SdkSpecFromWithConfig(config Config, str string) SdkSpec { var kindString string if sep == 0 { - return SdkSpec{SdkInvalid, NoneApiLevel, str} + return SdkSpec{SdkInvalid, NewInvalidApiLevel(str), str} } else if sep == -1 { kindString = "" } else { @@ -323,7 +291,7 @@ func SdkSpecFromWithConfig(config Config, str string) SdkSpec { apiLevel, err := ApiLevelFromUserWithConfig(config, versionString) if err != nil { - return SdkSpec{SdkInvalid, apiLevel, str} + return SdkSpec{SdkInvalid, NewInvalidApiLevel(versionString), str} } return SdkSpec{kind, apiLevel, str} } |