diff options
author | 2025-02-12 18:27:03 +0000 | |
---|---|---|
committer | 2025-02-13 19:43:22 +0000 | |
commit | df0b83966161d767714909dff032648c0d83d4c8 (patch) | |
tree | 8fbc01fd9a303604a99c73bd2a1f2a878e3f3088 /cc/cc.go | |
parent | cbf8ee89a8d292ec0b4ba5052bd58c13289abb4f (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 'cc/cc.go')
-rw-r--r-- | cc/cc.go | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -4124,20 +4124,19 @@ func (c CcDepInSameApexChecker) IncomingDepIsInSameApex(depTag blueprint.Depende } // Implements android.ApexModule -func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, - sdkVersion android.ApiLevel) error { +func (c *Module) MinSdkVersionSupported(ctx android.BaseModuleContext) android.ApiLevel { // We ignore libclang_rt.* prebuilt libs since they declare sdk_version: 14(b/121358700) if strings.HasPrefix(ctx.OtherModuleName(c), "libclang_rt") { - return nil + return android.MinApiLevel } // We don't check for prebuilt modules if _, ok := c.linker.(prebuiltLinkerInterface); ok { - return nil + return android.MinApiLevel } minSdkVersion := c.MinSdkVersion() if minSdkVersion == "apex_inherit" { - return nil + return android.MinApiLevel } if minSdkVersion == "" { // JNI libs within APK-in-APEX fall into here @@ -4146,14 +4145,16 @@ func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, // non-SDK variant resets sdk_version, which works too. minSdkVersion = c.SdkVersion() } + if minSdkVersion == "" { - return fmt.Errorf("neither min_sdk_version nor sdk_version 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 } // A dependency only needs to support a min_sdk_version at least @@ -4161,15 +4162,14 @@ func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, // This allows introducing new architectures in the platform that // need to be included in apexes that normally require an older // min_sdk_version. - minApiForArch := MinApiForArch(ctx, c.Target().Arch.ArchType) - if sdkVersion.LessThan(minApiForArch) { - sdkVersion = minApiForArch + if c.Enabled(ctx) { + minApiForArch := MinApiForArch(ctx, c.Target().Arch.ArchType) + if ver.LessThanOrEqualTo(minApiForArch) { + ver = android.MinApiLevel + } } - if ver.GreaterThan(sdkVersion) { - return fmt.Errorf("newer SDK(%v)", ver) - } - return nil + return ver } // Implements android.ApexModule |