Documentation
¶
Overview ¶
Package parse parses ninja build files and depfiles into the data structures consumed by the rest of ninjago, and defines the ParseBackend hook used to source file contents and observe the parsed result.
Index ¶
- func Parse(ctx context.Context, fn string) (*ninja.ParsedFiles, error)
- func ParseNinjaFile(ctx context.Context, name string, full []byte, parent *ninja.NinjaFile) (*ninja.NinjaFile, error)
- func ReadDepFile(targets []string, depFile string) ([]string, error)
- func ResolveDeps(targets []string, depsList []*DepsRecord) ([]string, error)
- type DepsRecord
- type ParseBackend
- type ReleaseFileFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse loads the ninja file at fn and every subninja it includes, returning the parsed and expanded result.
func ParseNinjaFile ¶
func ParseNinjaFile(ctx context.Context, name string, full []byte, parent *ninja.NinjaFile) (*ninja.NinjaFile, error)
ParseNinjaFile parses the contents of a ninja file. The input is split into segments and parsed in parallel using params.CliFlags.ConcurrencyLevel goroutines.
func ReadDepFile ¶
ReadDepFile reads a .d file and returns the dependencies of the first target in "targets" that appears in it.
func ResolveDeps ¶
func ResolveDeps(targets []string, depsList []*DepsRecord) ([]string, error)
ResolveDeps returns the dependencies of the first record in depsList whose target matches one of targets, with each dependency resolved through any symlinks.
Types ¶
type DepsRecord ¶
DepsRecord is a single Makefile-style dependency record: one target and the list of files it depends on.
func ParseDepFile ¶
func ParseDepFile(fileName string) ([]*DepsRecord, error)
ParseDepFile mmap-reads the depfile at fileName and parses its records.
func ParseDeps ¶
func ParseDeps(buf []byte) ([]*DepsRecord, error)
ParseDeps parses Makefile-style dependency records from buf.
type ParseBackend ¶
type ParseBackend interface {
ReadNinjaFile(file string) ([]byte, ReleaseFileFunc, error)
Parsed(ninjas *ninja.ParsedFiles) error
}
ParseBackend is implemented by backends that supply ninja file contents to the parser and observe the parsed result.
type ReleaseFileFunc ¶
type ReleaseFileFunc func() error
ReleaseFileFunc releases the resources associated with a previously read ninja file (e.g. unmaps a memory-mapped buffer).