summaryrefslogtreecommitdiff
path: root/android/paths.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/paths.go')
-rw-r--r--android/paths.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/android/paths.go b/android/paths.go
index 1c0321c02..977473fbd 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -209,6 +209,10 @@ type ModuleErrorfContext interface {
var _ ModuleErrorfContext = blueprint.ModuleContext(nil)
+type AddMissingDependenciesContext interface {
+ AddMissingDependencies([]string)
+}
+
// reportPathError will register an error with the attached context. It
// attempts ctx.ModuleErrorf for a better error message first, then falls
// back to ctx.Errorf.
@@ -220,7 +224,9 @@ func reportPathError(ctx PathContext, err error) {
// attempts ctx.ModuleErrorf for a better error message first, then falls
// back to ctx.Errorf.
func ReportPathErrorf(ctx PathContext, format string, args ...interface{}) {
- if mctx, ok := ctx.(ModuleErrorfContext); ok {
+ if mctx, ok := ctx.(AddMissingDependenciesContext); ok && ctx.Config().AllowMissingDependencies() {
+ mctx.AddMissingDependencies([]string{fmt.Sprintf(format, args...)})
+ } else if mctx, ok := ctx.(ModuleErrorfContext); ok {
mctx.ModuleErrorf(format, args...)
} else if ectx, ok := ctx.(errorfContext); ok {
ectx.Errorf(format, args...)
@@ -229,6 +235,8 @@ func ReportPathErrorf(ctx PathContext, format string, args ...interface{}) {
}
}
+// TODO(b/397766191): Change the signature to take ModuleProxy
+// Please only access the module's internal data through providers.
func pathContextName(ctx PathContext, module blueprint.Module) string {
if x, ok := ctx.(interface{ ModuleName(blueprint.Module) string }); ok {
return x.ModuleName(module)
@@ -675,7 +683,7 @@ func getPathsFromModuleDep(ctx ModuleWithDepsPathContext, path, moduleName, tag
if module == nil {
return nil, missingDependencyError{[]string{moduleName}}
}
- if !OtherModuleProviderOrDefault(ctx, *module, CommonModuleInfoKey).Enabled {
+ if !OtherModulePointerProviderOrDefault(ctx, *module, CommonModuleInfoProvider).Enabled {
return nil, missingDependencyError{[]string{moduleName}}
}