cwd, tgtOrig string,
level int,
deps map[string]map[string]struct{},
+ includeSrc bool,
) []string {
cwd, tgt := cwdAndTgt(path.Join(cwd, tgtOrig))
depPath := path.Join(cwd, RedoDir, tgt+DepSuffix)
if dep == "" {
return alwayses
}
- if dep == tgt || isSrc(cwd, dep) {
+ if dep == tgt {
+ continue
+ }
+ if !includeSrc && isSrc(cwd, dep) {
continue
}
if !returnReady {
if m, ok := deps[depRel]; ok {
m[tgtRel] = struct{}{}
} else {
- m = make(map[string]struct{}, 0)
+ m = map[string]struct{}{}
m[tgtRel] = struct{}{}
deps[depRel] = m
}
- alwayses = append(alwayses, collectDeps(cwd, dep, level+1, deps)...)
+ alwayses = append(
+ alwayses,
+ collectDeps(cwd, dep, level+1, deps, includeSrc)...,
+ )
}
}
return alwayses
seen := map[string]struct{}{}
deps := map[string]map[string]struct{}{}
for _, tgtInitial := range tgts {
- for _, tgt := range collectDeps(Cwd, tgtInitial, 0, deps) {
+ for _, tgt := range collectDeps(Cwd, tgtInitial, 0, deps, false) {
if tgt != tgtInitial {
seen[tgt] = struct{}{}
}
}
ok := true
for i := 0; i < len(seen); i++ {
- ok = ok && isOkRun(<-errs)
+ ok = isOkRun(<-errs) && ok
}
Jobs.Wait()
close(errs)
jobs++
}
for i := 0; i < jobs; i++ {
- ok = ok && isOkRun(<-errs)
+ ok = isOkRun(<-errs) && ok
}
if !ok {
trace(CDebug, "dependants failed, skipping them")
func ifchange(tgts []string, forced, traced bool) (bool, error) {
jsInit()
- defer jsAcquire("ifchange exiting")
+ if !IsTopRedo {
+ defer jsAcquire("ifchange exiting")
+ }
defer Jobs.Wait()
seen := buildDependants(tgts)
oodTgtsClear()
}
ok := true
for ; jobs > 0; jobs-- {
- ok = ok && isOkRun(<-errs)
+ ok = isOkRun(<-errs) && ok
}
return ok, nil
}