diff options
author | Fumitoshi Ukai <fumitoshi.ukai@gmail.com> | 2015-07-16 16:55:51 +0900 |
---|---|---|
committer | Fumitoshi Ukai <fumitoshi.ukai@gmail.com> | 2015-07-16 16:55:51 +0900 |
commit | e4574695494bfca030d74309bf149d965dbe093f (patch) | |
tree | 3db49fb14d190f28b4605cb8eb1cfdb89762b604 /exec.go | |
parent | b79b29005ce03ac1d93f8bd3f3d248ee32b49093 (diff) | |
download | android_build_kati-e4574695494bfca030d74309bf149d965dbe093f.tar.gz android_build_kati-e4574695494bfca030d74309bf149d965dbe093f.tar.bz2 android_build_kati-e4574695494bfca030d74309bf149d965dbe093f.zip |
[go] build specified targets or first target if not given.
Diffstat (limited to 'exec.go')
-rw-r--r-- | exec.go | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -151,8 +151,8 @@ func NewExecutor(opt *ExecutorOpt) (*Executor, error) { return ex, nil } -// Exec executes to build roots. -func (ex *Executor) Exec(g *DepGraph) error { +// Exec executes to build targets, or first target in DepGraph. +func (ex *Executor) Exec(g *DepGraph, targets []string) error { ex.ctx = newExecContext(g.vars, g.vpaths, false) // TODO: Handle target specific variables. @@ -169,7 +169,24 @@ func (ex *Executor) Exec(g *DepGraph) error { } startTime := time.Now() - for _, root := range g.nodes { + var nodes []*DepNode + if len(targets) == 0 { + if len(g.nodes) > 0 { + nodes = append(nodes, g.nodes[0]) + } + } else { + m := make(map[string]*DepNode) + for _, n := range g.nodes { + m[n.Output] = n + } + for _, t := range targets { + n := m[t] + if n != nil { + nodes = append(nodes, n) + } + } + } + for _, root := range nodes { err := ex.makeJobs(root, nil) if err != nil { break |