コード例 #1
0
func makeTarget(g *core.BuildGraph, packageName string, labelName string, outputs []string) *core.BuildTarget {
	l := core.ParseBuildLabel(fmt.Sprintf("//%s:%s", packageName, labelName), "")
	t := core.NewBuildTarget(l)

	p := g.Package(packageName)
	if p == nil {
		p = core.NewPackage(packageName)
		g.AddPackage(p)
	}
	for _, out := range outputs {
		t.AddOutput(out)
		p.MustRegisterOutput(out, t)
	}
	p.Targets[labelName] = t
	g.AddTarget(t)
	return t
}