Esempio n. 1
0
func (self *Runtime) makeRule(astrule *dsl.ASTBuildRule) (*BuildRule, []error) {
	targets, sources, errs := self.makeRuleNodes(astrule)
	if len(errs) > 0 {
		return nil, errs
	}

	allactions := NewSequenceAction()
	for _, action_ := range astrule.Actions() {
		switch action := action_.(type) {
		case *dsl.ASTString:
			allactions.AddCommand(action)
		case *dsl.ASTAssignment:
			allactions.AddAssignment(action)
		case *dsl.ASTFunctionCall:
			allactions.AddFunctionCall(action)
		}
	}

	rule := NewBuildRule(self, targets, sources)
	rule.action = allactions
	return rule, nil
}