aboutsummaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorSpandan Das <spandandas@google.com>2023-02-24 18:38:56 +0000
committerSpandan Das <spandandas@google.com>2023-02-27 20:03:25 +0000
commit7fa982c0ecd1af67b1d83e8bc932e398efc22d21 (patch)
treea797fb79e2e154c3af39383824486b0b9b10aae9 /java/java.go
parent50885c052497ad4ef1691bfe21895455107a3336 (diff)
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
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/java/java.go b/java/java.go
index 27b2a6ec6..1df45b804 100644
--- a/java/java.go
+++ b/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
}