Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BazelFlagValues ¶
func (BazelFlagValues) FlagValue ¶
func (c BazelFlagValues) FlagValue(flagname string) *string
FlagValue gets the effective (i.e. last) value for a particular flag. It has no awareness of what flags are allowed multiple values, or default values.
type BazelRcParser ¶
type BazelRcParser struct {
// contains filtered or unexported fields
}
func NewBazelRcParser ¶
func NewBazelRcParser(workspaceDirectory string, knownFlagData *FlagData) *BazelRcParser
NewBazelRcParser makes a parser of bazelrc files.
func (*BazelRcParser) Parsefile ¶
func (p *BazelRcParser) Parsefile(file io.Reader, filePath string) (*BazelrcContents, error)
Parsefile parses a bazelrc file.
type BazelrcContents ¶
type BazelrcContents struct {
// contains filtered or unexported fields
}
BazelrcContents holds the output of parsing a Bazelrc file.
type CommandLineArgsAfterCommand ¶
type CommandLineArgsAfterCommand struct { // Targets contains any targets (i.e. things that don't look like Bazel flags or flag-values) found Targets []string // BazelFlags contains anything we could recognize as a Bazel flag. BazelFlags BazelFlagValues // ExecutableArgs contains anything that came after a standalone `--` flag. ExecutableArgs []string }
CommandLineArgsAfterCommand represents the constituent components of the parsed arguments to an invocation of Bazel.
func ParseCommandLineArgsAfterCommand ¶
func ParseCommandLineArgsAfterCommand(knownFlagData *FlagData, tokens []string) (*CommandLineArgsAfterCommand, error)
ParseCommandLineArgsAfterCommand parses a command line (rather than a bazelrc line) to find a list of targets and arguments there-to. This function expects to be given a slice which comes after the command (i.e. for `bazel --host_jvm_debug build //blah --jobs=10` it should be passed `["//blah", "--jobs=10"]`. This function lives here to re-use most of the internals of bazelrc parsing, but is unrelated to bazelrc files itself.
type FlagData ¶
type FlagData struct { // BooleanFlags contains the flags which are enabled without specifying a value for the flag (e.g. --subcommands). BooleanFlags map[string]bool // FlagAbbreviation maps short names to long names, e.g. maps `j` to `jobs`. FlagAbbreviations map[string]string }
FlagData holds information about Bazel's flag schema (i.e. metadata about the flag definitions). Note that this schema changes across different Bazel versions.
func GetFlagDataFromBazel ¶
GetFlagDataFromBazel returns a FlagData by invoking bazel to learn about flags. The passed command should be an exec.Cmd which is configured to run bazel in the correct directory with whatever startup args are needed. This function will add a bazel commands and flags to that command, and redirect the stdout. It relies on features only present from Bazel 7, and will return misleading data for BooleanFlags if run with an older Bazel.