Loading android/apex.go +1 −1 Original line number Diff line number Diff line Loading @@ -845,7 +845,7 @@ type WalkPayloadDepsFunc func(ctx ModuleContext, do PayloadDepsCallback) // ModuleWithMinSdkVersionCheck represents a module that implements min_sdk_version checks type ModuleWithMinSdkVersionCheck interface { Module MinSdkVersion(ctx EarlyModuleContext) SdkSpec MinSdkVersion(ctx EarlyModuleContext) ApiLevel CheckMinSdkVersion(ctx ModuleContext) } Loading android/api_levels.go +18 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,14 @@ func (l ApiLevel) EffectiveVersionString(ctx EarlyModuleContext) (string, error) return ret.String(), nil } // Specified returns true if the module is targeting a recognzized api_level. // It returns false if either // 1. min_sdk_version is not an int or a recognized codename // 2. both min_sdk_version and sdk_version are empty. In this case, MinSdkVersion() defaults to SdkSpecPrivate.ApiLevel func (this ApiLevel) Specified() bool { return !this.IsInvalid() && !this.IsPrivate() } // Returns -1 if the current API level is less than the argument, 0 if they // are equal, and 1 if it is greater than the argument. func (this ApiLevel) CompareTo(other ApiLevel) int { Loading Loading @@ -289,6 +297,16 @@ func ReplaceFinalizedCodenames(config Config, raw string) string { return strconv.Itoa(num) } // ApiLevelFrom converts the given string `raw` to an ApiLevel. // If `raw` is invalid (empty string, unrecognized codename etc.) it returns an invalid ApiLevel func ApiLevelFrom(ctx PathContext, raw string) ApiLevel { ret, err := ApiLevelFromUser(ctx, raw) if err != nil { return NewInvalidApiLevel(raw) } return ret } // ApiLevelFromUser converts the given string `raw` to an ApiLevel, possibly returning an error. // // `raw` must be non-empty. Passing an empty string results in a panic. Loading android/sdk.go +2 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import ( // minApiLevelForSdkSnapshot provides access to the min_sdk_version for MinApiLevelForSdkSnapshot type minApiLevelForSdkSnapshot interface { MinSdkVersion(ctx EarlyModuleContext) SdkSpec MinSdkVersion(ctx EarlyModuleContext) ApiLevel } // MinApiLevelForSdkSnapshot returns the ApiLevel of the min_sdk_version of the supplied module. Loading @@ -34,7 +34,7 @@ type minApiLevelForSdkSnapshot interface { func MinApiLevelForSdkSnapshot(ctx EarlyModuleContext, module Module) ApiLevel { minApiLevel := NoneApiLevel if m, ok := module.(minApiLevelForSdkSnapshot); ok { minApiLevel = m.MinSdkVersion(ctx).ApiLevel minApiLevel = m.MinSdkVersion(ctx) } if minApiLevel == NoneApiLevel { // The default min API level is 1. Loading android/sdk_version.go +2 −2 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ type SdkContext interface { SdkVersion(ctx EarlyModuleContext) SdkSpec // SystemModules returns the system_modules property of the current module, or an empty string if it is not set. SystemModules() string // MinSdkVersion returns SdkSpec that corresponds to the min_sdk_version property of the current module, // MinSdkVersion returns ApiLevel that corresponds to the min_sdk_version property of the current module, // or from sdk_version if it is not set. MinSdkVersion(ctx EarlyModuleContext) SdkSpec MinSdkVersion(ctx EarlyModuleContext) ApiLevel // ReplaceMaxSdkVersionPlaceholder returns SdkSpec to replace the maxSdkVersion property of permission and // uses-permission tags if it is set. ReplaceMaxSdkVersionPlaceholder(ctx EarlyModuleContext) SdkSpec Loading apex/apex.go +2 −6 Original line number Diff line number Diff line Loading @@ -2949,12 +2949,8 @@ func (a *apexBundle) minSdkVersionValue(ctx android.EarlyModuleContext) string { } // Returns apex's min_sdk_version SdkSpec, honoring overrides func (a *apexBundle) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec { return android.SdkSpec{ Kind: android.SdkNone, ApiLevel: a.minSdkVersion(ctx), Raw: a.minSdkVersionValue(ctx), } func (a *apexBundle) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel { return a.minSdkVersion(ctx) } // Returns apex's min_sdk_version ApiLevel, honoring overrides Loading Loading
android/apex.go +1 −1 Original line number Diff line number Diff line Loading @@ -845,7 +845,7 @@ type WalkPayloadDepsFunc func(ctx ModuleContext, do PayloadDepsCallback) // ModuleWithMinSdkVersionCheck represents a module that implements min_sdk_version checks type ModuleWithMinSdkVersionCheck interface { Module MinSdkVersion(ctx EarlyModuleContext) SdkSpec MinSdkVersion(ctx EarlyModuleContext) ApiLevel CheckMinSdkVersion(ctx ModuleContext) } Loading
android/api_levels.go +18 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,14 @@ func (l ApiLevel) EffectiveVersionString(ctx EarlyModuleContext) (string, error) return ret.String(), nil } // Specified returns true if the module is targeting a recognzized api_level. // It returns false if either // 1. min_sdk_version is not an int or a recognized codename // 2. both min_sdk_version and sdk_version are empty. In this case, MinSdkVersion() defaults to SdkSpecPrivate.ApiLevel func (this ApiLevel) Specified() bool { return !this.IsInvalid() && !this.IsPrivate() } // Returns -1 if the current API level is less than the argument, 0 if they // are equal, and 1 if it is greater than the argument. func (this ApiLevel) CompareTo(other ApiLevel) int { Loading Loading @@ -289,6 +297,16 @@ func ReplaceFinalizedCodenames(config Config, raw string) string { return strconv.Itoa(num) } // ApiLevelFrom converts the given string `raw` to an ApiLevel. // If `raw` is invalid (empty string, unrecognized codename etc.) it returns an invalid ApiLevel func ApiLevelFrom(ctx PathContext, raw string) ApiLevel { ret, err := ApiLevelFromUser(ctx, raw) if err != nil { return NewInvalidApiLevel(raw) } return ret } // ApiLevelFromUser converts the given string `raw` to an ApiLevel, possibly returning an error. // // `raw` must be non-empty. Passing an empty string results in a panic. Loading
android/sdk.go +2 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import ( // minApiLevelForSdkSnapshot provides access to the min_sdk_version for MinApiLevelForSdkSnapshot type minApiLevelForSdkSnapshot interface { MinSdkVersion(ctx EarlyModuleContext) SdkSpec MinSdkVersion(ctx EarlyModuleContext) ApiLevel } // MinApiLevelForSdkSnapshot returns the ApiLevel of the min_sdk_version of the supplied module. Loading @@ -34,7 +34,7 @@ type minApiLevelForSdkSnapshot interface { func MinApiLevelForSdkSnapshot(ctx EarlyModuleContext, module Module) ApiLevel { minApiLevel := NoneApiLevel if m, ok := module.(minApiLevelForSdkSnapshot); ok { minApiLevel = m.MinSdkVersion(ctx).ApiLevel minApiLevel = m.MinSdkVersion(ctx) } if minApiLevel == NoneApiLevel { // The default min API level is 1. Loading
android/sdk_version.go +2 −2 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ type SdkContext interface { SdkVersion(ctx EarlyModuleContext) SdkSpec // SystemModules returns the system_modules property of the current module, or an empty string if it is not set. SystemModules() string // MinSdkVersion returns SdkSpec that corresponds to the min_sdk_version property of the current module, // MinSdkVersion returns ApiLevel that corresponds to the min_sdk_version property of the current module, // or from sdk_version if it is not set. MinSdkVersion(ctx EarlyModuleContext) SdkSpec MinSdkVersion(ctx EarlyModuleContext) ApiLevel // ReplaceMaxSdkVersionPlaceholder returns SdkSpec to replace the maxSdkVersion property of permission and // uses-permission tags if it is set. ReplaceMaxSdkVersionPlaceholder(ctx EarlyModuleContext) SdkSpec Loading
apex/apex.go +2 −6 Original line number Diff line number Diff line Loading @@ -2949,12 +2949,8 @@ func (a *apexBundle) minSdkVersionValue(ctx android.EarlyModuleContext) string { } // Returns apex's min_sdk_version SdkSpec, honoring overrides func (a *apexBundle) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec { return android.SdkSpec{ Kind: android.SdkNone, ApiLevel: a.minSdkVersion(ctx), Raw: a.minSdkVersionValue(ctx), } func (a *apexBundle) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel { return a.minSdkVersion(ctx) } // Returns apex's min_sdk_version ApiLevel, honoring overrides Loading