inputprocessor

package
v0.0.0-...-64cddde Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 35 Imported by: 1

Documentation

Overview

Package inputprocessor is used to find non-obvious inputs for action types like C++ compile, Java compile, C++ link etc.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIPTimeout is an error returned when IP action times out
	ErrIPTimeout = errors.New("Input Processor timeout")
)

Functions

This section is empty.

Types

type CommandIO

type CommandIO struct {
	// InputSpec holds information about files and environment variables required to
	// run the command.
	InputSpec *command.InputSpec
	// OutputFiles is a list of output files produced by the command.
	OutputFiles []string
	// OutputDirectories is a list of output directories produced by the command.
	OutputDirectories []string
	// EmiitedDependencyFile is the name of the dependency file produced by the command.
	EmittedDependencyFile string
	// UsedShallowMode indicates whether the shallow input processor was used to
	// determine inputs.
	UsedShallowMode bool
}

CommandIO encapsulates the inputs and outputs a command. All paths are relative to the exec root.

type Executor

type Executor interface {
	Execute(ctx context.Context, cmd *command.Command) (string, string, error)
	ExecuteInBackground(ctx context.Context, cmd *command.Command, oe outerr.OutErr, ch chan *command.Result) error
}

Executor can run commands and retrieve their outputs.

type InputProcessor

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

InputProcessor retrieves the input spec for commands.

func NewInputProcessor

func NewInputProcessor(ctx context.Context, executor Executor, resMgr *localresources.Manager, fmc filemetadata.Cache, l *logger.Logger, opt *Options) (*InputProcessor, func(), error)

NewInputProcessor creates a new input processor. Its resources are bound by the local resources manager.

func NewInputProcessorWithStubDependencyScanner

func NewInputProcessorWithStubDependencyScanner(ds cppcompile.CPPDependencyScanner, cppLinkDeepScan bool, executor Executor, resMgr *localresources.Manager) *InputProcessor

NewInputProcessorWithStubDependencyScanner creates a new input processor with given parallelism and a stub CPP dependency scanner. It is meant to be only used for testing.

func (*InputProcessor) ProcessInputs

func (p *InputProcessor) ProcessInputs(ctx context.Context, opts *ProcessInputsOptions, rec *logger.LogRecord) (*CommandIO, error)

ProcessInputs receives a valid action command and returns the set of inputs needed to successfully run the command remotely. Also returns a struct of parsed flags and the .d file produced by the command if exists.

type Options

type Options struct {
	EnableDepsCache    bool
	CacheDir           string
	LogDir             string
	DepsCacheMaxMb     int
	CppLinkDeepScan    bool
	IPTimeout          time.Duration
	DepsScannerAddress string
	ProxyServerAddress string
}

Options adds extra control for the input processor

type ProcessInputsOptions

type ProcessInputsOptions struct {
	// ExecutionID is the ID of the action.
	ExecutionID string
	// Cmd is the list of args.
	Cmd []string
	// WorkingDir is the working directory of the action.
	WorkingDir string
	// ExecRoot is the exec root of the action.
	ExecRoot string
	// Inputs is the InputSpec passed explicitly with the action request.
	Inputs *command.InputSpec
	// Labels is a map of label keys to values.
	Labels map[string]string
	// ToolchainInputs is a list of toolchain inputs in addition to the toolchains
	// inferred from the command.
	ToolchainInputs []string

	// WindowsCross indicates whether use linux worker for Windows.
	WindowsCross bool

	// ExecStrategy indicates which execution strategy was used
	ExecStrategy ppb.ExecutionStrategy_Value

	// CmdEnvironment captures the environment of the command to be executed, in the form "key=value" strings.
	CmdEnvironment []string
}

ProcessInputsOptions encapsulates options for a ProcessInputs call.

Directories

Path Synopsis
Package fake defines fakes to be used for testing integration with the input processor.
Package fake defines fakes to be used for testing integration with the input processor.

Jump to

Keyboard shortcuts

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