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
diff --git a/android/module.go b/android/module.go
index 3295e93..87ff273 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1898,7 +1898,7 @@
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 @@
Host bool
}
+type ApiLevelOrPlatform struct {
+ ApiLevel *ApiLevel
+ IsPlatform bool
+}
+
var CommonModuleInfoKey = blueprint.NewProvider[CommonModuleInfo]()
type PrebuiltModuleInfo struct {
@@ -2255,11 +2260,16 @@
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 {