From 82ea3fb273ba7b60fc53acf73931b58ca4b0a93e Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 5 Apr 2021 17:48:26 -0700 Subject: [PATCH] Follow blueprint change to return GlobResult from Glob Follow I2159cc9d85f388073198eac7456e5bf43e813096 that makes Glob return a GlobResult. Bug: 159845846 Test: glob_test.go Change-Id: Ia771bdbdf1eb668623c4b3f00bf65e0e1e3a55c0 --- android/paths.go | 7 ++++--- zip/zip.go | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/android/paths.go b/android/paths.go index ba1ab1138..1ad548bea 100644 --- a/android/paths.go +++ b/android/paths.go @@ -1095,11 +1095,12 @@ func existsWithDependencies(ctx PathContext, path SourcePath) (exists bool, err // a single file. files, err = gctx.GlobWithDeps(path.String(), nil) } else { - var deps []string + var result pathtools.GlobResult // We cannot add build statements in this context, so we fall back to // AddNinjaFileDeps - files, deps, err = ctx.Config().fs.Glob(path.String(), nil, pathtools.FollowSymlinks) - ctx.AddNinjaFileDeps(deps...) + result, err = ctx.Config().fs.Glob(path.String(), nil, pathtools.FollowSymlinks) + ctx.AddNinjaFileDeps(result.Deps...) + files = result.Matches } if err != nil { diff --git a/zip/zip.go b/zip/zip.go index a6490d452..84e974bce 100644 --- a/zip/zip.go +++ b/zip/zip.go @@ -292,11 +292,11 @@ func zipTo(args ZipArgs, w io.Writer) error { continue } - globbed, _, err := z.fs.Glob(s, nil, followSymlinks) + result, err := z.fs.Glob(s, nil, followSymlinks) if err != nil { return err } - if len(globbed) == 0 { + if len(result.Matches) == 0 { err := &os.PathError{ Op: "lstat", Path: s, @@ -308,7 +308,7 @@ func zipTo(args ZipArgs, w io.Writer) error { return err } } - srcs = append(srcs, globbed...) + srcs = append(srcs, result.Matches...) } if fa.GlobDir != "" { if exists, isDir, err := z.fs.Exists(fa.GlobDir); err != nil { @@ -336,11 +336,11 @@ func zipTo(args ZipArgs, w io.Writer) error { return err } } - globbed, _, err := z.fs.Glob(filepath.Join(fa.GlobDir, "**/*"), nil, followSymlinks) + result, err := z.fs.Glob(filepath.Join(fa.GlobDir, "**/*"), nil, followSymlinks) if err != nil { return err } - srcs = append(srcs, globbed...) + srcs = append(srcs, result.Matches...) } for _, src := range srcs { err := fillPathPairs(fa, src, &pathMappings, args.NonDeflatedFiles, noCompression)