Update usages of min_sdk_version that relies on (kind+level)
The type of min_sdk_version is being migrated from android.SdkSpec(kind+level) to android.ApiLevel(level). This affects `ShouldSupportSdkVersion` for java modules. This function skips the check for modules compiling against `core`, and that requires access to SdkVersion and not MinSdkVersion after the migration. Skip the check explicitly using SdkVersion. Test: go test ./java Test: No change in ninja file Bug: 208456999 Change-Id: I14eca4f8e8c5d7477ded00c4fe54097323fab4a2
This commit is contained in:
13
java/java.go
13
java/java.go
@@ -2166,15 +2166,18 @@ func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Modu
|
||||
// Implements android.ApexModule
|
||||
func (j *Import) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
|
||||
sdkVersion android.ApiLevel) error {
|
||||
sdkSpec := j.MinSdkVersion(ctx)
|
||||
if !sdkSpec.Specified() {
|
||||
sdkVersionSpec := j.SdkVersion(ctx)
|
||||
minSdkVersionSpec := j.MinSdkVersion(ctx)
|
||||
if !minSdkVersionSpec.Specified() {
|
||||
return fmt.Errorf("min_sdk_version is not specified")
|
||||
}
|
||||
if sdkSpec.Kind == android.SdkCore {
|
||||
// If the module is compiling against core (via sdk_version), skip comparison check.
|
||||
if sdkVersionSpec.Kind == android.SdkCore {
|
||||
return nil
|
||||
}
|
||||
if sdkSpec.ApiLevel.GreaterThan(sdkVersion) {
|
||||
return fmt.Errorf("newer SDK(%v)", sdkSpec.ApiLevel)
|
||||
minSdkVersion := minSdkVersionSpec.ApiLevel
|
||||
if minSdkVersion.GreaterThan(sdkVersion) {
|
||||
return fmt.Errorf("newer SDK(%v)", minSdkVersion)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user