From 0ea7998208a84499509fcba59c9d889823c39edd Mon Sep 17 00:00:00 2001 From: Liz Kammer Date: Mon, 7 Feb 2022 08:51:47 -0500 Subject: [PATCH] Update error messages for failed globs. Currently error messages appear like: &fs.PathError{Op:"open", Path:"..." Err:0x18} which make them difficult to parse. Test: CI Change-Id: I18da18abc43230d0ea37d166179d07e585077f51 --- cc/library.go | 10 ++++++---- rust/library.go | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cc/library.go b/cc/library.go index cefbf6c44..de5d46fed 100644 --- a/cc/library.go +++ b/cc/library.go @@ -757,9 +757,10 @@ func GlobHeadersForSnapshot(ctx android.ModuleContext, paths android.Paths) andr if dir == "external/eigen" { // Only these two directories contains exported headers. for _, subdir := range []string{"Eigen", "unsupported/Eigen"} { - glob, err := ctx.GlobWithDeps("external/eigen/"+subdir+"/**/*", nil) + globDir := "external/eigen/" + subdir + "/**/*" + glob, err := ctx.GlobWithDeps(globDir, nil) if err != nil { - ctx.ModuleErrorf("glob failed: %#v", err) + ctx.ModuleErrorf("glob of %q failed: %s", globDir, err) return nil } for _, header := range glob { @@ -775,9 +776,10 @@ func GlobHeadersForSnapshot(ctx android.ModuleContext, paths android.Paths) andr } continue } - glob, err := ctx.GlobWithDeps(dir+"/**/*", nil) + globDir := dir + "/**/*" + glob, err := ctx.GlobWithDeps(globDir, nil) if err != nil { - ctx.ModuleErrorf("glob failed: %#v", err) + ctx.ModuleErrorf("glob of %q failed: %s", globDir, err) return nil } isLibcxx := strings.HasPrefix(dir, "external/libcxx/include") diff --git a/rust/library.go b/rust/library.go index baac3f0bc..62eaefd68 100644 --- a/rust/library.go +++ b/rust/library.go @@ -773,9 +773,10 @@ func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext, // Glob together the headers from the modules include_dirs property for _, path := range android.CopyOfPaths(l.includeDirs) { dir := path.String() - glob, err := ctx.GlobWithDeps(dir+"/**/*", nil) + globDir := dir + "/**/*" + glob, err := ctx.GlobWithDeps(globDir, nil) if err != nil { - ctx.ModuleErrorf("glob failed: %#v", err) + ctx.ModuleErrorf("glob of %q failed: %s", globDir, err) return }