summaryrefslogtreecommitdiff
path: root/android/module.go
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2025-02-06 00:25:22 +0000
committer Yu Liu <yudiliu@google.com> 2025-02-12 18:34:40 +0000
commit5d3a2cfde6247422c1f788f436d517d9e1d4c7e3 (patch)
tree6447de6747f22f638152460fe48c5189cc327db9 /android/module.go
parentd8db8faba62a3cb77f75294e96deda9e53c15786 (diff)
Provide min sdk version as ApiLevel instead of string.
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I8c7b3b493877a9857ca433b015e6e49ad8387f91
Diffstat (limited to 'android/module.go')
-rw-r--r--android/module.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/android/module.go b/android/module.go
index 3295e93be..87ff27323 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1898,7 +1898,7 @@ type CommonModuleInfo struct {
SkipAndroidMkProcessing bool
BaseModuleName string
CanHaveApexVariants bool
- MinSdkVersion string
+ MinSdkVersion ApiLevelOrPlatform
SdkVersion string
NotAvailableForPlatform bool
// There some subtle differences between this one and the one above.
@@ -1914,6 +1914,11 @@ type CommonModuleInfo struct {
Host bool
}
+type ApiLevelOrPlatform struct {
+ ApiLevel *ApiLevel
+ IsPlatform bool
+}
+
var CommonModuleInfoKey = blueprint.NewProvider[CommonModuleInfo]()
type PrebuiltModuleInfo struct {
@@ -2255,11 +2260,16 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
MinSdkVersion(ctx EarlyModuleContext) ApiLevel
}); ok {
ver := mm.MinSdkVersion(ctx)
- if !ver.IsNone() {
- commonData.MinSdkVersion = ver.String()
- }
+ commonData.MinSdkVersion.ApiLevel = &ver
} else if mm, ok := m.module.(interface{ MinSdkVersion() string }); ok {
- commonData.MinSdkVersion = mm.MinSdkVersion()
+ ver := mm.MinSdkVersion()
+ // Compile against the current platform
+ if ver == "" {
+ commonData.MinSdkVersion.IsPlatform = true
+ } else {
+ api := ApiLevelFrom(ctx, ver)
+ commonData.MinSdkVersion.ApiLevel = &api
+ }
}
if mm, ok := m.module.(interface {