diff --git a/android/config.go b/android/config.go index a1e97c981..13e55bc19 100644 --- a/android/config.go +++ b/android/config.go @@ -1393,7 +1393,7 @@ func splitConfiguredJarPair(ctx PathContext, str string) (string, string) { if len(pair) == 2 { return pair[0], pair[1] } else { - reportPathErrorf(ctx, "malformed (apex, jar) pair: '%s', expected format: :", str) + ReportPathErrorf(ctx, "malformed (apex, jar) pair: '%s', expected format: :", str) return "error-apex", "error-jar" } } diff --git a/android/module.go b/android/module.go index b689a87f2..17bc205e0 100644 --- a/android/module.go +++ b/android/module.go @@ -2246,7 +2246,7 @@ func OutputFileForModule(ctx PathContext, module blueprint.Module, tag string) P return nil } if len(paths) > 1 { - reportPathErrorf(ctx, "got multiple output files from module %q, expected exactly one", + ReportPathErrorf(ctx, "got multiple output files from module %q, expected exactly one", pathContextName(ctx, module)) return nil } diff --git a/android/paths.go b/android/paths.go index 65f129ce8..6b603ba41 100644 --- a/android/paths.go +++ b/android/paths.go @@ -86,13 +86,13 @@ var _ moduleErrorf = blueprint.ModuleContext(nil) // attempts ctx.ModuleErrorf for a better error message first, then falls // back to ctx.Errorf. func reportPathError(ctx PathContext, err error) { - reportPathErrorf(ctx, "%s", err.Error()) + ReportPathErrorf(ctx, "%s", err.Error()) } -// reportPathErrorf will register an error with the attached context. It +// ReportPathErrorf will register an error with the attached context. It // attempts ctx.ModuleErrorf for a better error message first, then falls // back to ctx.Errorf. -func reportPathErrorf(ctx PathContext, format string, args ...interface{}) { +func ReportPathErrorf(ctx PathContext, format string, args ...interface{}) { if mctx, ok := ctx.(moduleErrorf); ok { mctx.ModuleErrorf(format, args...) } else if ectx, ok := ctx.(errorfContext); ok { @@ -155,7 +155,7 @@ func GenPathWithExt(ctx ModuleContext, subdir string, p Path, ext string) Module if path, ok := p.(genPathProvider); ok { return path.genPathWithExt(ctx, subdir, ext) } - reportPathErrorf(ctx, "Tried to create generated file from unsupported path: %s(%s)", reflect.TypeOf(p).Name(), p) + ReportPathErrorf(ctx, "Tried to create generated file from unsupported path: %s(%s)", reflect.TypeOf(p).Name(), p) return PathForModuleGen(ctx) } @@ -165,7 +165,7 @@ func ObjPathWithExt(ctx ModuleContext, subdir string, p Path, ext string) Module if path, ok := p.(objPathProvider); ok { return path.objPathWithExt(ctx, subdir, ext) } - reportPathErrorf(ctx, "Tried to create object file from unsupported path: %s (%s)", reflect.TypeOf(p).Name(), p) + ReportPathErrorf(ctx, "Tried to create object file from unsupported path: %s (%s)", reflect.TypeOf(p).Name(), p) return PathForModuleObj(ctx) } @@ -176,7 +176,7 @@ func ResPathWithName(ctx ModuleContext, p Path, name string) ModuleResPath { if path, ok := p.(resPathProvider); ok { return path.resPathWithName(ctx, name) } - reportPathErrorf(ctx, "Tried to create res file from unsupported path: %s (%s)", reflect.TypeOf(p).Name(), p) + ReportPathErrorf(ctx, "Tried to create res file from unsupported path: %s (%s)", reflect.TypeOf(p).Name(), p) return PathForModuleRes(ctx) } @@ -416,9 +416,9 @@ func expandOneSrcPath(ctx ModuleContext, s string, expandedExcludes []string) (P } else { p := pathForModuleSrc(ctx, s) if exists, _, err := ctx.Config().fs.Exists(p.String()); err != nil { - reportPathErrorf(ctx, "%s: %s", p, err.Error()) + ReportPathErrorf(ctx, "%s: %s", p, err.Error()) } else if !exists && !ctx.Config().testAllowNonExistentPaths { - reportPathErrorf(ctx, "module source path %q does not exist", p) + ReportPathErrorf(ctx, "module source path %q does not exist", p) } if InList(p.String(), expandedExcludes) { @@ -445,7 +445,7 @@ func pathsForModuleSrcFromFullPath(ctx EarlyModuleContext, paths []string, incDi } path := filepath.Clean(p) if !strings.HasPrefix(path, prefix) { - reportPathErrorf(ctx, "Path %q is not in module source directory %q", p, prefix) + ReportPathErrorf(ctx, "Path %q is not in module source directory %q", p, prefix) continue } @@ -801,7 +801,7 @@ func PathForSource(ctx PathContext, pathComponents ...string) SourcePath { } if pathtools.IsGlob(path.String()) { - reportPathErrorf(ctx, "path may not contain a glob: %s", path.String()) + ReportPathErrorf(ctx, "path may not contain a glob: %s", path.String()) } if modCtx, ok := ctx.(ModuleContext); ok && ctx.Config().AllowMissingDependencies() { @@ -813,9 +813,9 @@ func PathForSource(ctx PathContext, pathComponents ...string) SourcePath { modCtx.AddMissingDependencies([]string{path.String()}) } } else if exists, _, err := ctx.Config().fs.Exists(path.String()); err != nil { - reportPathErrorf(ctx, "%s: %s", path, err.Error()) + ReportPathErrorf(ctx, "%s: %s", path, err.Error()) } else if !exists && !ctx.Config().testAllowNonExistentPaths { - reportPathErrorf(ctx, "source path %q does not exist", path) + ReportPathErrorf(ctx, "source path %q does not exist", path) } return path } @@ -831,7 +831,7 @@ func ExistentPathForSource(ctx PathContext, pathComponents ...string) OptionalPa } if pathtools.IsGlob(path.String()) { - reportPathErrorf(ctx, "path may not contain a glob: %s", path.String()) + ReportPathErrorf(ctx, "path may not contain a glob: %s", path.String()) return OptionalPath{} } @@ -876,17 +876,17 @@ func (p SourcePath) OverlayPath(ctx ModuleContext, path Path) OptionalPath { if srcPath, ok := path.(SourcePath); ok { relDir = srcPath.path } else { - reportPathErrorf(ctx, "Cannot find relative path for %s(%s)", reflect.TypeOf(path).Name(), path) + ReportPathErrorf(ctx, "Cannot find relative path for %s(%s)", reflect.TypeOf(path).Name(), path) return OptionalPath{} } dir := filepath.Join(p.config.srcDir, p.path, relDir) // Use Glob so that we are run again if the directory is added. if pathtools.IsGlob(dir) { - reportPathErrorf(ctx, "Path may not contain a glob: %s", dir) + ReportPathErrorf(ctx, "Path may not contain a glob: %s", dir) } paths, err := ctx.GlobWithDeps(dir, nil) if err != nil { - reportPathErrorf(ctx, "glob: %s", err.Error()) + ReportPathErrorf(ctx, "glob: %s", err.Error()) return OptionalPath{} } if len(paths) == 0 { @@ -977,7 +977,7 @@ func (p OutputPath) Join(ctx PathContext, paths ...string) OutputPath { // ReplaceExtension creates a new OutputPath with the extension replaced with ext. func (p OutputPath) ReplaceExtension(ctx PathContext, ext string) OutputPath { if strings.Contains(ext, "/") { - reportPathErrorf(ctx, "extension %q cannot contain /", ext) + ReportPathErrorf(ctx, "extension %q cannot contain /", ext) } ret := PathForOutput(ctx, pathtools.ReplaceExtension(p.path, ext)) ret.rel = pathtools.ReplaceExtension(p.rel, ext) @@ -1030,10 +1030,10 @@ func PathForModuleSrc(ctx ModuleContext, pathComponents ...string) Path { } return nil } else if len(paths) == 0 { - reportPathErrorf(ctx, "%q produced no files, expected exactly one", p) + ReportPathErrorf(ctx, "%q produced no files, expected exactly one", p) return nil } else if len(paths) > 1 { - reportPathErrorf(ctx, "%q produced %d files, expected exactly one", p, len(paths)) + ReportPathErrorf(ctx, "%q produced %d files, expected exactly one", p, len(paths)) } return paths[0] } @@ -1447,7 +1447,7 @@ func validatePath(pathComponents ...string) (string, error) { func PathForPhony(ctx PathContext, phony string) WritablePath { if strings.ContainsAny(phony, "$/") { - reportPathErrorf(ctx, "Phony target contains invalid character ($ or /): %s", phony) + ReportPathErrorf(ctx, "Phony target contains invalid character ($ or /): %s", phony) } return PhonyPath{basePath{phony, ctx.Config(), ""}} } @@ -1513,7 +1513,7 @@ func PathContextForTesting(config Config) PathContext { func Rel(ctx PathContext, basePath string, targetPath string) string { rel, isRel := MaybeRel(ctx, basePath, targetPath) if !isRel { - reportPathErrorf(ctx, "path %q is not under path %q", targetPath, basePath) + ReportPathErrorf(ctx, "path %q is not under path %q", targetPath, basePath) return "" } return rel