Documentation ¶
Index ¶
- func VirtualInputs(f *flags.CommandFlags, vip VirtualInputsProcessor) []*command.VirtualInput
- type CPPDependencyScanner
- type ClangParser
- type Preprocessor
- func (p *Preprocessor) AppendVirtualInput(res []*command.VirtualInput, flag, path string) []*command.VirtualInput
- func (p *Preprocessor) BuildCommandLine(outputFlag string, outputFlagJoined bool, toAbsArgs map[string]bool) []string
- func (p *Preprocessor) ComputeSpec() error
- func (p *Preprocessor) FindDependencies(args []string) ([]string, error)
- func (p *Preprocessor) IsVirtualInput(flag string) bool
- func (p *Preprocessor) ParseFlags() error
- func (p *Preprocessor) ResourceDir(args []string, resourceDirFlag string, ...) string
- type StdoutToResourceDirMapper
- type VirtualInputsProcessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VirtualInputs ¶
func VirtualInputs(f *flags.CommandFlags, vip VirtualInputsProcessor) []*command.VirtualInput
VirtualInputs returns paths extracted from virtualInputFlags. If paths are absolute, they're transformed to working dir relative.
Types ¶
type CPPDependencyScanner ¶
type CPPDependencyScanner interface { ProcessInputs(ctx context.Context, execID string, command []string, filename, directory string, cmdEnv []string) ([]string, bool, error) Capabilities() *spb.CapabilitiesResponse }
CPPDependencyScanner is an interface to dependency scanner which provides functionality to find input dependencies given a compile command.
type ClangParser ¶
type ClangParser struct{}
ClangParser parses clang command args to produce a CommandFlags object.
func (ClangParser) ParseFlags ¶
func (cp ClangParser) ParseFlags(ctx context.Context, command []string, workingDir, execRoot string) (*flags.CommandFlags, error)
ParseFlags is used to translate the given action command into clang compiler options, so that they can be used during input processing. Android build, throw error for unsupported flags.
type Preprocessor ¶
type Preprocessor struct { *inputprocessor.BasePreprocessor // CPPDepScanner is used to perform include processing by invoking // clang-scan-deps library. // https://github.com/llvm/llvm-project/tree/main/clang/tools/clang-scan-deps CPPDepScanner CPPDependencyScanner // DepScanTimeout is the max duration allowed for CPP dependency scanning operation // before it's interrupted DepScanTimeout time.Duration Rec *logger.LogRecord // DepsCache is a cache for cpp header dependencies. DepsCache *depscache.Cache // CmdEnvironment captures the environment of the command to be executed, in the form "key=value" strings. CmdEnvironment []string Slots *semaphore.Weighted // contains filtered or unexported fields }
Preprocessor is the preprocessor of clang cpp compile actions.
func (*Preprocessor) AppendVirtualInput ¶
func (p *Preprocessor) AppendVirtualInput(res []*command.VirtualInput, flag, path string) []*command.VirtualInput
AppendVirtualInput appends a virtual input to res.
func (*Preprocessor) BuildCommandLine ¶
func (p *Preprocessor) BuildCommandLine(outputFlag string, outputFlagJoined bool, toAbsArgs map[string]bool) []string
BuildCommandLine builds a command line arguments from flags
func (*Preprocessor) ComputeSpec ¶
func (p *Preprocessor) ComputeSpec() error
ComputeSpec computes cpp header dependencies.
func (*Preprocessor) FindDependencies ¶
func (p *Preprocessor) FindDependencies(args []string) ([]string, error)
FindDependencies finds the dependencies of the given adjusted command args using the current include scanner.
func (*Preprocessor) IsVirtualInput ¶
func (p *Preprocessor) IsVirtualInput(flag string) bool
IsVirtualInput returns true if the flag specifies a virtual input to be added to InputSpec.
func (*Preprocessor) ParseFlags ¶
func (p *Preprocessor) ParseFlags() error
ParseFlags parses the commands flags and populates the ActionSpec object with inferred information.
func (*Preprocessor) ResourceDir ¶
func (p *Preprocessor) ResourceDir(args []string, resourceDirFlag string, stdoutToResourceDirMapper StdoutToResourceDirMapper) string
ResourceDir extracts clang command and runs it with provided resource the resourceDirFlag to return resource directory relative to the clang it maps the command output to resourceDir with provided stdoutToResourceDirMapper argument cache the results for reuse. It returns resource directory path associated with the give invocation command.
type StdoutToResourceDirMapper ¶
StdoutToResourceDirMapper maps clang output to resourceDir
type VirtualInputsProcessor ¶
type VirtualInputsProcessor interface { // IsVirtualInput returns true if the specified flag should result in appending a virtual input. IsVirtualInput(flag string) bool // AppendVirtualInput appends a virtual input to res. path arg should be exec root relative. AppendVirtualInput(res []*command.VirtualInput, flag, path string) []*command.VirtualInput }
VirtualInputsProcessor processes the flags and aappends virtual inputs to command's InputSpec.