Merge "Support two active sdks in EffectiveVersionString"
This commit is contained in:
@@ -211,7 +211,29 @@ func (s SdkSpec) EffectiveVersionString(ctx EarlyModuleContext) (string, error)
|
||||
if !s.ApiLevel.IsPreview() {
|
||||
return s.ApiLevel.String(), nil
|
||||
}
|
||||
return ctx.Config().DefaultAppTargetSdk(ctx).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
|
||||
}
|
||||
|
||||
var (
|
||||
|
Reference in New Issue
Block a user