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