예제 #1
0
파일: runtime.go 프로젝트: sbinet/fubsy
func (self *Runtime) makeRuleNodes(astrule *dsl.ASTBuildRule) (
	targets, sources []dag.Node, errs []error) {

	// Evaluate the target and source lists, so we get one FuObject
	// each. It might be a string, a list of strings, a FinderNode...
	// anything, really.
	var targetobj, sourceobj types.FuObject
	targetobj, errs = self.evaluate(astrule.Targets())
	if len(errs) > 0 {
		return
	}
	sourceobj, errs = self.evaluate(astrule.Sources())
	if len(errs) > 0 {
		return
	}

	// Convert each of those FuObjects to a list of DAG nodes.
	targets = self.nodify(targetobj)
	sources = self.nodify(sourceobj)
	return
}
예제 #2
0
파일: runtime.go 프로젝트: sbinet/fubsy
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
}