walk

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk(c *config.Config, cexts []config.Configurer, dirs []string, mode Mode, wf WalkFunc)

Walk traverses the directory tree rooted at c.RepoRoot in depth-first order.

Walk calls the Configure method on each configuration extension in cexts in each directory in pre-order, whether a build file is present in the directory or not. cexts must contain a walk.Configurer.

Walk calls the callback wf in post-order.

Types

type Configurer added in v0.15.0

type Configurer struct{}

func (*Configurer) CheckFlags added in v0.15.0

func (_ *Configurer) CheckFlags(fs *flag.FlagSet, c *config.Config) error

func (*Configurer) Configure added in v0.15.0

func (_ *Configurer) Configure(c *config.Config, rel string, f *rule.File)

func (*Configurer) KnownDirectives added in v0.15.0

func (_ *Configurer) KnownDirectives() []string

func (*Configurer) RegisterFlags added in v0.15.0

func (_ *Configurer) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config)

type Mode added in v0.15.0

type Mode int

Mode determines which directories Walk visits and which directories should be updated.

const (
	// In VisitAllUpdateSubdirsMode, Walk visits every directory in the
	// repository. The directories given to Walk and their subdirectories are
	// updated.
	VisitAllUpdateSubdirsMode Mode = iota

	// In VisitAllUpdateDirsMode, Walk visits every directory in the repository.
	// Only the directories given to Walk are updated (not their subdirectories).
	VisitAllUpdateDirsMode

	// In UpdateDirsMode, Walk only visits and updates directories given to Walk.
	// Build files in parent directories are read in order to produce a complete
	// configuration, but the callback is not called for parent directories.
	UpdateDirsMode
)

type WalkFunc

type WalkFunc func(dir, rel string, c *config.Config, update bool, f *rule.File, subdirs, regularFiles, genFiles []string)

WalkFunc is a callback called by Walk in each visited directory.

dir is the absolute file system path to the directory being visited.

rel is the relative slash-separated path to the directory from the repository root. Will be "" for the repository root directory itself.

c is the configuration for the current directory. This may have been modified by directives in the directory's build file.

update is true when the build file may be updated.

f is the existing build file in the directory. Will be nil if there was no file.

subdirs is a list of base names of subdirectories within dir, not including excluded files.

regularFiles is a list of base names of regular files within dir, not including excluded files.

genFiles is a list of names of generated files, found by reading "out" and "outs" attributes of rules in f.

Jump to

Keyboard shortcuts

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