diff options
-rw-r--r-- | android/module.go | 19 | ||||
-rw-r--r-- | apex/builder.go | 16 |
2 files changed, 21 insertions, 14 deletions
diff --git a/android/module.go b/android/module.go index a9f6b9402..c2f4342b4 100644 --- a/android/module.go +++ b/android/module.go @@ -1871,6 +1871,8 @@ type CommonModuleInfo struct { SkipAndroidMkProcessing bool BaseModuleName string CanHaveApexVariants bool + MinSdkVersion string + NotAvailableForPlatform bool } var CommonModuleInfoKey = blueprint.NewProvider[CommonModuleInfo]() @@ -2141,13 +2143,26 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) SkipAndroidMkProcessing: shouldSkipAndroidMkProcessing(ctx, m), BaseModuleName: m.BaseModuleName(), } + if mm, ok := m.module.(interface { + MinSdkVersion(ctx EarlyModuleContext) ApiLevel + }); ok { + ver := mm.MinSdkVersion(ctx) + if !ver.IsNone() { + commonData.MinSdkVersion = ver.String() + } + } else if mm, ok := m.module.(interface{ MinSdkVersion() string }); ok { + commonData.MinSdkVersion = mm.MinSdkVersion() + } + if m.commonProperties.ForcedDisabled { commonData.Enabled = false } else { commonData.Enabled = m.commonProperties.Enabled.GetOrDefault(m.ConfigurableEvaluator(ctx), !m.Os().DefaultDisabled) } - am, ok := m.module.(ApexModule) - commonData.CanHaveApexVariants = ok && am.CanHaveApexVariants() + if am, ok := m.module.(ApexModule); ok { + commonData.CanHaveApexVariants = am.CanHaveApexVariants() + commonData.NotAvailableForPlatform = am.NotAvailableForPlatform() + } SetProvider(ctx, CommonModuleInfoKey, commonData) if p, ok := m.module.(PrebuiltInterface); ok && p.Prebuilt() != nil { SetProvider(ctx, PrebuiltModuleProviderKey, PrebuiltModuleProviderData{}) diff --git a/apex/builder.go b/apex/builder.go index e5ae10622..6204caa4c 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -1049,7 +1049,7 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) { } depInfos := android.DepNameToDepInfoMap{} - a.WalkPayloadDeps(ctx, func(ctx android.BaseModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool { + a.WalkPayloadDepsProxy(ctx, func(ctx android.BaseModuleContext, from, to android.ModuleProxy, externalDep bool) bool { if from.Name() == to.Name() { // This can happen for cc.reuseObjTag. We are not interested in tracking this. // As soon as the dependency graph crosses the APEX boundary, don't go further. @@ -1058,7 +1058,7 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) { // Skip dependencies that are only available to APEXes; they are developed with updatability // in mind and don't need manual approval. - if to.(android.ApexModule).NotAvailableForPlatform() { + if android.OtherModuleProviderOrDefault(ctx, to, android.CommonModuleInfoKey).NotAvailableForPlatform { return !externalDep } @@ -1076,16 +1076,8 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) { depInfos[to.Name()] = info } else { toMinSdkVersion := "(no version)" - if m, ok := to.(interface { - MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel - }); ok { - if v := m.MinSdkVersion(ctx); !v.IsNone() { - toMinSdkVersion = v.String() - } - } else if m, ok := to.(interface{ MinSdkVersion() string }); ok { - // TODO(b/175678607) eliminate the use of MinSdkVersion returning - // string - if v := m.MinSdkVersion(); v != "" { + if info, ok := android.OtherModuleProvider(ctx, to, android.CommonModuleInfoKey); ok { + if v := info.MinSdkVersion; v != "" { toMinSdkVersion = v } } |