cc

package
v0.0.0-...-32b710e Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxWindowsCommandLength = 30000
)

Variables

View Source
var (
	ErrorMissingOption          = fmt.Errorf("missing option/operand")
	ErrorInvalidOption          = fmt.Errorf("invalid option/operand")
	ErrorUnrecognizedOption     = fmt.Errorf("unrecognized option")
	ErrorNoAvailable4Remote     = fmt.Errorf("no available for remote")
	ErrorFileNotExist           = fmt.Errorf("file/path not exist")
	ErrorFileInvalid            = fmt.Errorf("file/path invalid")
	ErrorInvalidParam           = fmt.Errorf("param is invalid")
	ErrorNotSupportE            = fmt.Errorf("-E must be local")
	ErrorNotSupportMarchNative  = fmt.Errorf("-march=native must be local")
	ErrorNotSupportMtuneNative  = fmt.Errorf("-mtune=native must be local")
	ErrorNotSupportCoverage     = fmt.Errorf("[-fprofile-arcs|-ftest-coverage|--coverage] must be local")
	ErrorNotSupportFrepo        = fmt.Errorf("-frepo must be local")
	ErrorNotSupportM            = fmt.Errorf("-M must be local")
	ErrorNotSupportWa           = fmt.Errorf("-Wa[,-a|--MD] must be local")
	ErrorNotSupportSpecs        = fmt.Errorf("-specs= must be local")
	ErrorNotSupportX            = fmt.Errorf("-x must be local")
	ErrorNotSupportDr           = fmt.Errorf("-dr must be local")
	ErrorNotSupportFsanitize    = fmt.Errorf("-fsanitize must be local")
	ErrorNotSupportConftest     = fmt.Errorf("tmp.conftest. must be local")
	ErrorNotSupportOutputStdout = fmt.Errorf("output with - to stdout, must be local")
	ErrorNotSupportGch          = fmt.Errorf("output with .gch, must be local")
	ErrorNoPumpHeadFile         = fmt.Errorf("pump head file not exist")
	ErrorNoDependFile           = fmt.Errorf("depend file not exist")
	ErrorInvalidDependFile      = fmt.Errorf("depend file invalid")
	ErrorNotSupportRemote       = fmt.Errorf("not support to remote execute")
	ErrorInPumpBlack            = fmt.Errorf("in pump black list")
)

define errors

View Source
var (
	DefaultForceLocalResponseFileKeys = make([]string, 0, 0)
	// DefaultForceLocalCppFileKeys force some cpp to compile locally
	DefaultForceLocalCppFileKeys = make([]string, 0, 0)
)
View Source
var (
	XcodeIncludeLinkFileslock sync.RWMutex
	XcodeIncludeReal2link     = make(map[string]string, 0)
	XcodeIncludeLink2real     = make(map[string]string, 0)
	XcodeIncludeLinkResolved  = false
)

Functions

func EscapeArg

func EscapeArg(s string) string

EscapeArg rewrites command line argument s as prescribed in https://msdn.microsoft.com/en-us/library/ms880421. This function returns "" (2 double quotes) if s is empty. Alternatively, these transformations are done:

  • every back slash (\) is doubled, but only if immediately followed by double quote (");
  • every double quote (") is escaped by back slash (\);
  • finally, s is wrapped with double quotes (arg -> "arg"), but only if there is space or tab inside s.

func MakeCmdLine

func MakeCmdLine(args []string) string

MakeCmdLine builds a command line out of args by escaping "special" characters and joining the arguments with spaces.

Types

type ProjectExtraData

type ProjectExtraData struct {
	CCacheEnable bool `json:"ccache_enable"`
}

ProjectExtraData describe the extra data store in project

type TaskCC

type TaskCC struct {
	ForceLocalResponseFileKeys []string
	ForceLocalCppFileKeys      []string
	// contains filtered or unexported fields
}

TaskCC 定义了c/c++编译的描述处理对象, 一般用来处理ue4-mac下的clang编译

func NewTaskCC

func NewTaskCC() *TaskCC

NewTaskCC get a new task-cc handler

func (*TaskCC) CanExecuteWithLocalIdleResource

func (cc *TaskCC) CanExecuteWithLocalIdleResource(command []string) bool

func (*TaskCC) FinalExecute

func (cc *TaskCC) FinalExecute(args []string)

FinalExecute 清理临时文件

func (*TaskCC) GetFilterRules

func (cc *TaskCC) GetFilterRules() ([]dcSDK.FilterRuleItem, error)

GetFilterRules add file send filter

func (*TaskCC) GetPreloadConfig

func (cc *TaskCC) GetPreloadConfig(config dcType.BoosterConfig) (*dcSDK.PreloadConfig, error)

GetPreloadConfig 获取preload配置

func (*TaskCC) Includes

func (cc *TaskCC) Includes(responseFile string, args []string, workdir string, forcefresh bool) ([]*dcFile.Info, error)

search all include files for this compile command

func (*TaskCC) InitExtra

func (cc *TaskCC) InitExtra(extra []byte)

InitExtra receive disttask custom extra data and initialize its settings

func (*TaskCC) InitSandbox

func (cc *TaskCC) InitSandbox(sandbox *dcSyscall.Sandbox)

InitSandbox set sandbox to task-cc

func (*TaskCC) LocalExecute

func (cc *TaskCC) LocalExecute(command []string) dcType.BKDistCommonError

LocalExecute 无需自定义本地处理

func (*TaskCC) LocalExecuteNeed

func (cc *TaskCC) LocalExecuteNeed(command []string) bool

LocalExecuteNeed 无需自定义本地处理

func (*TaskCC) LocalLockWeight

func (cc *TaskCC) LocalLockWeight(command []string) int32

LocalLockWeight decide local-execute lock weight, default 1

func (*TaskCC) NeedRemoteResource

func (cc *TaskCC) NeedRemoteResource(command []string) bool

NeedRemoteResource check whether this command need remote resource

func (*TaskCC) NeedRetryOnRemoteFail

func (cc *TaskCC) NeedRetryOnRemoteFail(command []string) bool

NeedRetryOnRemoteFail check whether need retry on remote fail

func (*TaskCC) OnRemoteFail

func (cc *TaskCC) OnRemoteFail(command []string) (*dcSDK.BKDistCommand, dcType.BKDistCommonError)

TODO : OnRemoteFail give chance to try other way if failed to remote execute

func (*TaskCC) PostExecute

func (cc *TaskCC) PostExecute(r *dcSDK.BKDistResult) dcType.BKDistCommonError

PostExecute 后置处理, 判断远程执行的结果是否正确

func (*TaskCC) PostExecuteNeedLock

func (cc *TaskCC) PostExecuteNeedLock(result *dcSDK.BKDistResult) bool

PostExecuteNeedLock 不需要post-lock

func (*TaskCC) PostLockWeight

func (cc *TaskCC) PostLockWeight(result *dcSDK.BKDistResult) int32

PostLockWeight decide post-execute lock weight, default 1

func (*TaskCC) PostWork

func (cc *TaskCC) PostWork(config *dcType.BoosterConfig) error

PostWork 处理整个编译的后置工作, 收集ccache数据

func (*TaskCC) PreExecute

func (cc *TaskCC) PreExecute(command []string) (*dcSDK.BKDistCommand, dcType.BKDistCommonError)

PreExecute 预处理

func (*TaskCC) PreExecuteNeedLock

func (cc *TaskCC) PreExecuteNeedLock(command []string) bool

PreExecuteNeedLock 需要pre-lock来保证预处理不会跑满本地资源

func (*TaskCC) PreLockWeight

func (cc *TaskCC) PreLockWeight(command []string) int32

PreLockWeight decide pre-execute lock weight, default 1

func (*TaskCC) PreWork

func (cc *TaskCC) PreWork(config *dcType.BoosterConfig) error

PreWork 处理整个编译的前置工作, 例如清除ccache数据缓存, 更新launcher脚本等

func (*TaskCC) RemoteRetryTimes

func (cc *TaskCC) RemoteRetryTimes() int

RemoteRetryTimes will return the remote retry times

func (*TaskCC) RenderArgs

func (cc *TaskCC) RenderArgs(config dcType.BoosterConfig, originArgs string) string

RenderArgs receive the user's origin commands, and render some extra thins to it For instance: bazel command should be add extra --action_env

func (*TaskCC) ResultExtra

func (cc *TaskCC) ResultExtra() []byte

ResultExtra no need

Jump to

Keyboard shortcuts

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