bldy.build / build / graph

Index | Files | Exmaples | Directories
go get bldy.build/build/graph

Package graph parses and generates build graphs

Index

Package Files

graph.go hash.go node.go

type ByName

type ByName []*Node

ByName sorts dependencies by name so we can have reproduceable builds.

func (ByName) Len

func (a ByName) Len() int

func (ByName) Less

func (a ByName) Less(i, j int) bool

func (ByName) Swap

func (a ByName) Swap(i, j int)

type Graph

type Graph struct {
    Root *Node

    Nodes map[string]*Node
    // contains filtered or unexported fields
}

Graph represents a build graph

func New

func New(wd, target string) (*Graph, error)

New returns a new build graph relatvie to the working directory

func (*Graph) Workspace

func (g *Graph) Workspace() workspace.Workspace

Workspace returns the Workspace in which this graph exists.

type Node

type Node struct {
    IsRoot        bool       `json:"-"`
    Target        build.Rule `json:"-"`
    Type          string
    Parents       map[string]*Node `json:"-"`
    Label         label.Label
    Worker        string
    PriorityCount int
    WG            sync.WaitGroup
    Status        build.Status
    Cached        bool
    Start, End    int64
    Hash          string
    Output        string `json:"-"`
    Once          sync.Once
    sync.Mutex
    Children map[string]*Node
    // contains filtered or unexported fields
}

Node encapsulates a target and represents a node in the build graph.

func NewNode

func NewNode(l label.Label, t build.Rule) Node

NewNode takes a label and a rule and returns it as a Graph Node

func (*Node) HashNode

func (n *Node) HashNode() []byte

HashNode calculates the hash of a node

func (*Node) Priority

func (n *Node) Priority() int

Priority counts how many nodes directly and indirectly depend on this node

Subdirectories