summaryrefslogtreecommitdiff
path: root/rust/rust.go
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2025-02-12 18:27:03 +0000
committer Yu Liu <yudiliu@google.com> 2025-02-13 19:43:22 +0000
commitdf0b83966161d767714909dff032648c0d83d4c8 (patch)
tree8fbc01fd9a303604a99c73bd2a1f2a878e3f3088 /rust/rust.go
parentcbf8ee89a8d292ec0b4ba5052bd58c13289abb4f (diff)
Convert CheckMinSdkVersion to use providers.
Next step is to convert it to use ModuleProxy once IsDepInSameApex is converted to use providers. Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I20cb052666fa95eb964e63e3302ac892d3324183
Diffstat (limited to 'rust/rust.go')
-rw-r--r--rust/rust.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/rust/rust.go b/rust/rust.go
index 4fd800282..7a7b1064c 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -2085,26 +2085,23 @@ func (mod *Module) MinSdkVersion() string {
}
// Implements android.ApexModule
-func (mod *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion android.ApiLevel) error {
+func (mod *Module) MinSdkVersionSupported(ctx android.BaseModuleContext) android.ApiLevel {
minSdkVersion := mod.MinSdkVersion()
if minSdkVersion == "apex_inherit" {
- return nil
+ return android.MinApiLevel
}
+
if minSdkVersion == "" {
- return fmt.Errorf("min_sdk_version is not specificed")
+ return android.NoneApiLevel
}
-
// Not using nativeApiLevelFromUser because the context here is not
// necessarily a native context.
- ver, err := android.ApiLevelFromUser(ctx, minSdkVersion)
+ ver, err := android.ApiLevelFromUserWithConfig(ctx.Config(), minSdkVersion)
if err != nil {
- return err
+ return android.NoneApiLevel
}
- if ver.GreaterThan(sdkVersion) {
- return fmt.Errorf("newer SDK(%v)", ver)
- }
- return nil
+ return ver
}
// Implements android.ApexModule