Loading android/config.go +1 −1 Original line number Diff line number Diff line Loading @@ -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: <apex>:<jar>", str) ReportPathErrorf(ctx, "malformed (apex, jar) pair: '%s', expected format: <apex>:<jar>", str) return "error-apex", "error-jar" } } Loading android/module.go +1 −1 Original line number Diff line number Diff line Loading @@ -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 } Loading android/paths.go +21 −21 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -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) } Loading @@ -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) } Loading @@ -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) } Loading Loading @@ -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) { Loading @@ -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 } Loading Loading @@ -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() { Loading @@ -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 } Loading @@ -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{} } Loading Loading @@ -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 { Loading Loading @@ -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) Loading Loading @@ -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] } Loading Loading @@ -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(), ""}} } Loading Loading @@ -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 Loading Loading
android/config.go +1 −1 Original line number Diff line number Diff line Loading @@ -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: <apex>:<jar>", str) ReportPathErrorf(ctx, "malformed (apex, jar) pair: '%s', expected format: <apex>:<jar>", str) return "error-apex", "error-jar" } } Loading
android/module.go +1 −1 Original line number Diff line number Diff line Loading @@ -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 } Loading
android/paths.go +21 −21 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -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) } Loading @@ -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) } Loading @@ -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) } Loading Loading @@ -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) { Loading @@ -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 } Loading Loading @@ -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() { Loading @@ -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 } Loading @@ -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{} } Loading Loading @@ -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 { Loading Loading @@ -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) Loading Loading @@ -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] } Loading Loading @@ -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(), ""}} } Loading Loading @@ -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 Loading