store

package
v1.1.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PredicateHasInput       = "has_input"
	PredicateHasOutput      = "has_output"
	PredicateHasImplicitDep = "has_implicit_dep"
	PredicateHasOrderDep    = "has_order_dep"
	PredicateDependsOn      = "depends_on"
)

Quad predicates for relationships

Variables

This section is empty.

Functions

This section is empty.

Types

type NinjaBuild

type NinjaBuild struct {
	ID        quad.IRI `json:"@id" quad:"@id"`
	Type      quad.IRI `json:"@type" quad:"@type"`
	BuildID   string   `json:"build_id" quad:"build_id"`
	Rule      quad.IRI `json:"rule" quad:"rule"`
	Variables string   `json:"variables,omitempty" quad:"variables"`
	Pool      string   `json:"pool,omitempty" quad:"pool"`
}

NinjaBuild represents a build statement

func (*NinjaBuild) GetVariables

func (nb *NinjaBuild) GetVariables() (map[string]string, error)

GetVariables converts JSON string back to map

func (*NinjaBuild) SetVariables

func (nb *NinjaBuild) SetVariables(variables map[string]string) error

SetVariables converts map to JSON string

type NinjaFile

type NinjaFile struct {
	ID       quad.IRI `json:"@id" quad:"@id"`
	Type     quad.IRI `json:"@type" quad:"@type"`
	Path     string   `json:"path" quad:"path"`
	FileType string   `json:"file_type" quad:"file_type"` // "source", "header", "object", etc.
}

NinjaFile represents source files and dependencies

type NinjaRule

type NinjaRule struct {
	ID          quad.IRI `json:"@id" quad:"@id"`
	Type        quad.IRI `json:"@type" quad:"@type"`
	Name        string   `json:"name" quad:"name"`
	Command     string   `json:"command" quad:"command"`
	Description string   `json:"description,omitempty" quad:"description"`
	Variables   string   `json:"variables,omitempty" quad:"variables"`
}

NinjaRule represents a build rule in Ninja

func (*NinjaRule) GetVariables

func (nr *NinjaRule) GetVariables() (map[string]string, error)

GetVariables converts JSON string back to map

func (*NinjaRule) SetVariables

func (nr *NinjaRule) SetVariables(variables map[string]string) error

SetVariables converts map to JSON string

type NinjaStore

type NinjaStore struct {
	// contains filtered or unexported fields
}

NinjaStore implements Ninja build graph using Cayley

func NewNinjaStore

func NewNinjaStore(dbPath string) (*NinjaStore, error)

NewNinjaStore creates a new Cayley-based Ninja graph store

func (*NinjaStore) AddBuild

func (ncs *NinjaStore) AddBuild(build *NinjaBuild, inputs, outputs, implicitDeps, orderDeps []string) error

AddBuild adds a build statement to the graph

func (*NinjaStore) AddRule

func (ncs *NinjaStore) AddRule(rule *NinjaRule) (quad.Value, error)

AddRule adds a build rule to the graph

func (*NinjaStore) Cleanup

func (ncs *NinjaStore) Cleanup() error

func (*NinjaStore) Close

func (ncs *NinjaStore) Close() error

Close closes the Cayley store

func (*NinjaStore) DebugDependencyGraph

func (ncs *NinjaStore) DebugDependencyGraph(filePath string)

DebugDependencyGraph Add this debug function to understand the graph structure

func (*NinjaStore) DebugQuads

func (ncs *NinjaStore) DebugQuads() error

DebugQuads prints all quads in the database for debugging

func (*NinjaStore) FindCycles

func (ncs *NinjaStore) FindCycles() ([][]string, error)

FindCycles detects circular dependencies in the build graph

func (*NinjaStore) GetAllTargets

func (ncs *NinjaStore) GetAllTargets() ([]*NinjaTarget, error)

GetAllTargets returns all targets in the graph

func (*NinjaStore) GetBuild

func (ncs *NinjaStore) GetBuild(id string) (*NinjaBuild, error)

GetBuild retrieves a build by name

func (*NinjaStore) GetBuildDependencies

func (ncs *NinjaStore) GetBuildDependencies(targetPath string) ([]*NinjaFile, error)

GetBuildDependencies returns all dependencies of a target

func (*NinjaStore) GetBuildOrder

func (ncs *NinjaStore) GetBuildOrder() ([]string, error)

GetBuildOrder returns targets in topological order

func (*NinjaStore) GetBuildStats

func (ncs *NinjaStore) GetBuildStats() (map[string]interface{}, error)

GetBuildStats returns statistics about the build graph

func (*NinjaStore) GetReverseDependencies

func (ncs *NinjaStore) GetReverseDependencies(filePath string) ([]*NinjaTarget, error)

GetReverseDependencies returns all targets that depend on a file

func (*NinjaStore) GetRule

func (ncs *NinjaStore) GetRule(name string) (*NinjaRule, error)

GetRule retrieves a rule by name

func (*NinjaStore) GetTarget

func (ncs *NinjaStore) GetTarget(path string) (*NinjaTarget, error)

GetTarget retrieves a target by path

func (*NinjaStore) GetTargetsByRule

func (ncs *NinjaStore) GetTargetsByRule(ruleName string) ([]*NinjaTarget, error)

GetTargetsByRule returns all targets built by a specific rule

func (*NinjaStore) UpdateTargetStatus

func (ncs *NinjaStore) UpdateTargetStatus(targetPath, status string) error

UpdateTargetStatus updates the status of a target

type NinjaTarget

type NinjaTarget struct {
	ID     quad.IRI `json:"@id" quad:"@id"`
	Type   quad.IRI `json:"@type" quad:"@type"`
	Path   string   `json:"path" quad:"path"`
	Status string   `json:"status" quad:"status"`
	Hash   string   `json:"hash,omitempty" quad:"hash"`
	Build  quad.IRI `json:"build" quad:"build"`
}

NinjaTarget represents a build target

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL