Documentation ¶
Index ¶
- Constants
- Variables
- func EscapeArg(s string) string
- func MakeCmdLine(args []string) string
- type ProjectExtraData
- type TaskCC
- func (cc *TaskCC) CanExecuteWithLocalIdleResource(command []string) bool
- func (cc *TaskCC) FinalExecute(args []string)
- func (cc *TaskCC) GetFilterRules() ([]dcSDK.FilterRuleItem, error)
- func (cc *TaskCC) GetPreloadConfig(config dcType.BoosterConfig) (*dcSDK.PreloadConfig, error)
- func (cc *TaskCC) Includes(responseFile string, args []string, workdir string, forcefresh bool) ([]*dcFile.Info, error)
- func (cc *TaskCC) InitExtra(extra []byte)
- func (cc *TaskCC) InitSandbox(sandbox *dcSyscall.Sandbox)
- func (cc *TaskCC) LocalExecute(command []string) dcType.BKDistCommonError
- func (cc *TaskCC) LocalExecuteNeed(command []string) bool
- func (cc *TaskCC) LocalLockWeight(command []string) int32
- func (cc *TaskCC) NeedRemoteResource(command []string) bool
- func (cc *TaskCC) NeedRetryOnRemoteFail(command []string) bool
- func (cc *TaskCC) OnRemoteFail(command []string) (*dcSDK.BKDistCommand, dcType.BKDistCommonError)
- func (cc *TaskCC) PostExecute(r *dcSDK.BKDistResult) dcType.BKDistCommonError
- func (cc *TaskCC) PostExecuteNeedLock(result *dcSDK.BKDistResult) bool
- func (cc *TaskCC) PostLockWeight(result *dcSDK.BKDistResult) int32
- func (cc *TaskCC) PostWork(config *dcType.BoosterConfig) error
- func (cc *TaskCC) PreExecute(command []string) (*dcSDK.BKDistCommand, dcType.BKDistCommonError)
- func (cc *TaskCC) PreExecuteNeedLock(command []string) bool
- func (cc *TaskCC) PreLockWeight(command []string) int32
- func (cc *TaskCC) PreWork(config *dcType.BoosterConfig) error
- func (cc *TaskCC) RemoteRetryTimes() int
- func (cc *TaskCC) RenderArgs(config dcType.BoosterConfig, originArgs string) string
- func (cc *TaskCC) ResultExtra() []byte
Constants ¶
const (
MaxWindowsCommandLength = 30000
)
Variables ¶
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
var ( DefaultForceLocalResponseFileKeys = make([]string, 0, 0) // DefaultForceLocalCppFileKeys force some cpp to compile locally DefaultForceLocalCppFileKeys = make([]string, 0, 0) )
Functions ¶
func EscapeArg ¶
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 ¶
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 (*TaskCC) CanExecuteWithLocalIdleResource ¶
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) InitSandbox ¶
InitSandbox set sandbox to task-cc
func (*TaskCC) LocalExecute ¶
func (cc *TaskCC) LocalExecute(command []string) dcType.BKDistCommonError
LocalExecute 无需自定义本地处理
func (*TaskCC) LocalExecuteNeed ¶
LocalExecuteNeed 无需自定义本地处理
func (*TaskCC) LocalLockWeight ¶
LocalLockWeight decide local-execute lock weight, default 1
func (*TaskCC) NeedRemoteResource ¶
NeedRemoteResource check whether this command need remote resource
func (*TaskCC) NeedRetryOnRemoteFail ¶
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 ¶
PreExecuteNeedLock 需要pre-lock来保证预处理不会跑满本地资源
func (*TaskCC) PreLockWeight ¶
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 ¶
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