Fixes
This commit is contained in:
parent
f70ee5c8be
commit
a4fd33cbfd
@ -33,9 +33,10 @@ import (
|
||||
)
|
||||
|
||||
type config struct {
|
||||
Tasks map[string]*task
|
||||
Macros map[string]*macro
|
||||
Tasks map[string]task
|
||||
Macros map[string]macro
|
||||
|
||||
handled map[string]bool
|
||||
srcDir string
|
||||
dstDir string
|
||||
variant string
|
||||
@ -48,7 +49,7 @@ func newConfig(filename string) (*config, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
conf := new(config)
|
||||
conf := &config{handled: make(map[string]bool)}
|
||||
switch path.Ext(filename) {
|
||||
case ".json":
|
||||
if err := json.Unmarshal(bytes, &conf); err != nil {
|
||||
|
11
task.go
11
task.go
@ -32,17 +32,9 @@ type task struct {
|
||||
Links [][]string
|
||||
Cmds [][]string
|
||||
Envs [][]string
|
||||
|
||||
handled bool
|
||||
}
|
||||
|
||||
func (t *task) process(conf *config) error {
|
||||
if t.handled {
|
||||
return nil
|
||||
}
|
||||
|
||||
t.handled = true
|
||||
|
||||
for _, currTask := range t.Deps {
|
||||
if err := processTask(currTask, conf); err != nil {
|
||||
return err
|
||||
@ -82,7 +74,7 @@ func processTask(taskName string, conf *config) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if t.handled {
|
||||
if conf.handled[tn] {
|
||||
if conf.flags&flagVerbose != 0 {
|
||||
log.Printf("skipping processed task: %s", tn)
|
||||
}
|
||||
@ -91,6 +83,7 @@ func processTask(taskName string, conf *config) error {
|
||||
log.Printf("processing task: %s", tn)
|
||||
}
|
||||
|
||||
conf.handled[tn] = true
|
||||
if err := t.process(conf); err != nil {
|
||||
return err
|
||||
}
|
||||
|
6
util.go
6
util.go
@ -48,14 +48,14 @@ func makeAbsPath(path string) string {
|
||||
}
|
||||
|
||||
func makeVariantNames(name, variant string) []string {
|
||||
if strings.HasSuffix(name, "%") {
|
||||
name = strings.TrimSuffix(name, "%")
|
||||
if strings.HasSuffix(name, "__") {
|
||||
name = strings.TrimSuffix(name, "__")
|
||||
variant = ""
|
||||
}
|
||||
|
||||
names := []string{name}
|
||||
if len(variant) > 0 {
|
||||
names = append(names, fmt.Sprint(name, "%", variant))
|
||||
names = append(names, fmt.Sprint(name, "__", variant))
|
||||
}
|
||||
|
||||
return names
|
||||
|
Loading…
Reference in New Issue
Block a user