Fix globbing bugs
Fix two bugs in globbing: check for excludes before globs so that
excludes that contain globs are not treated as includes, and
remove the Generator attribute from globRule so that the rule
reruns if the command line changes, for example if the glob or
excludes list changes.
Change-Id: I216c0c925eeb00a3814300548c005bcdf64a1f30
diff --git a/common/glob.go b/common/glob.go
index f4e083a..669d185 100644
--- a/common/glob.go
+++ b/common/glob.go
@@ -49,10 +49,9 @@
Command: fmt.Sprintf(`%s -o $out $excludes "$glob"`, globCmd),
Description: "glob $glob",
- Restat: true,
- Generator: true,
- Deps: blueprint.DepsGCC,
- Depfile: "$out.d",
+ Restat: true,
+ Deps: blueprint.DepsGCC,
+ Depfile: "$out.d",
},
"glob", "excludes")
)
@@ -81,9 +80,11 @@
out := make([]string, 0, len(in))
for _, s := range in {
- if glob.IsGlob(s) {
+ if s[0] == '-' {
+ continue
+ } else if glob.IsGlob(s) {
out = append(out, Glob(ctx, s, excludes)...)
- } else if s[0] != '-' {
+ } else {
out = append(out, s)
}
}