Skip to content

Commit

Permalink
Merge pull request #321 from tbs60/dev_tming
Browse files Browse the repository at this point in the history
feat:support experimental:log for ue5.5, issue: #320
  • Loading branch information
tming authored Nov 22, 2024
2 parents 93c4410 + 2873db9 commit d9153ac
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/backend/booster/bk_dist/handler/ue4/cl/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ type TaskCL struct {
// 在rsp中/I后面的参数,需要将这些目录全部发送到远端
// 有特殊场景:编译不需要该路径下的文件,但需要该路径作为跳板,去查找其它相对路径下的头文件(或其它依赖文件)
includePaths []string
logfilesarif string

// forcedepend 是我们主动导出依赖文件,showinclude 是编译命令已经指定了导出依赖文件
forcedepend bool
Expand Down Expand Up @@ -677,11 +678,12 @@ func (cl *TaskCL) trypump(command []string) (*dcSDK.BKDistCommand, error, error)
tstart = tend

// check whether support remote execute
_, err = scanArgs(args)
scandata, err := scanArgs(args)
if err != nil {
blog.Debugf("cl: try pump not support, scan args %v: %v", args, err)
return nil, err, ErrorNotSupportRemote
}
cl.logfilesarif = scandata.logfilesarif

inblack, _ := cl.inPumpBlack(responseFile, args)
if inblack {
Expand Down Expand Up @@ -775,6 +777,12 @@ func (cl *TaskCL) trypump(command []string) (*dcSDK.BKDistCommand, error, error)
if sourcedependfile != "" {
results = append(results, sourcedependfile)
}
if cl.logfilesarif != "" {
if !filepath.IsAbs(cl.logfilesarif) {
cl.logfilesarif, _ = filepath.Abs(filepath.Join(cl.sandbox.Dir, cl.logfilesarif))
}
results = append(results, cl.logfilesarif)
}

// set env which need append to remote
envs := []string{}
Expand Down Expand Up @@ -1016,6 +1024,11 @@ func (cl *TaskCL) preExecute(command []string) (*dcSDK.BKDistCommand, dcType.BKD
}

cl.customSave = true
results := []string{cl.outputFile}
if cl.logfilesarif != "" {
results = append(results, cl.logfilesarif)
}

return &dcSDK.BKDistCommand{
Commands: []dcSDK.BKCommand{
{
Expand All @@ -1025,9 +1038,7 @@ func (cl *TaskCL) preExecute(command []string) (*dcSDK.BKDistCommand, dcType.BKD
ExeToolChainKey: dcSDK.GetJsonToolChainKey(command[0]),
Params: params,
Inputfiles: inputFiles,
ResultFiles: []string{
cl.outputFile,
},
ResultFiles: results,
},
},
CustomSave: true,
Expand Down Expand Up @@ -1175,6 +1186,7 @@ func (cl *TaskCL) preBuild(args []string) error {
cl.rewriteCrossArgs = cl.scannedArgs
cl.includeRspFiles = scannedData.includeRspFiles
cl.includePaths = scannedData.includePaths
cl.logfilesarif = scannedData.logfilesarif

// handle the pch options
finalArgs := cl.scanPchFile(cl.scannedArgs)
Expand Down
22 changes: 22 additions & 0 deletions src/backend/booster/bk_dist/handler/ue4/cl/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,13 @@ type ccArgs struct {
specifiedSourceType bool
includeRspFiles []string
includePaths []string
logfilesarif string // for ue 5.5
}

const (
logsarifflag = "/experimental:log"
)

// scanArgs receive the complete compiling args, and the first item should always be a compiler name.
func scanArgs(args []string) (*ccArgs, error) {
blog.Debugf("cl: scanning arguments: %v", args)
Expand Down Expand Up @@ -669,6 +674,23 @@ func scanArgs(args []string) (*ccArgs, error) {
continue
}

if strings.HasPrefix(arg, logsarifflag) {
// if just a prefix, save the remain of this line.
if len(arg) > len(logsarifflag) {
r.logfilesarif = strings.Trim(arg[len(logsarifflag):], "\"")
continue
}

// if file name is in the next index, then take it.
index++
if index >= len(args) {
blog.Warnf("cl: scan args: no file found after %s", logsarifflag)
return nil, ErrorMissingOption
}
r.logfilesarif = strings.Trim(args[index], "\"")
continue
}

if strings.HasPrefix(arg, "/Fo") {
// /Fo should always appear once.
if seenOptionO {
Expand Down

0 comments on commit d9153ac

Please sign in to comment.