Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev tming #276

Merged
merged 6 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,13 @@ func searchToolChain(cmd string) (*types.ToolChain, error) {
blog.Infof("basic: real start search toolchian for cmd:%s", cmd)
defer blog.Infof("basic: end search toolchian for cmd:%s", cmd)

if strings.HasSuffix(cmd, "clang") || strings.HasSuffix(cmd, "clang++") {
cmdbase := filepath.Base(cmd)
switch cmdbase {
case "clang", "clang++":
return searchClang(cmd)
}

if strings.HasSuffix(cmd, "gcc") || strings.HasSuffix(cmd, "g++") {
case "gcc", "g++":
return searchGcc(cmd)
case "cc", "c++":
return searchGcc(cmd)
}

Expand Down
2 changes: 1 addition & 1 deletion src/backend/booster/bk_dist/handler/cc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ func (cc *TaskCC) preBuild(args []string) error {
}

// strip the args and get the server side args.
serverSideArgs := stripLocalArgs(finalArgs)
serverSideArgs := stripLocalArgs(finalArgs, cc.sandbox.Env)
if cc.supportDirectives {
serverSideArgs = append(serverSideArgs, "-fdirectives-only")
}
Expand Down
6 changes: 4 additions & 2 deletions src/backend/booster/bk_dist/handler/cc/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ func getPreprocessedExt(inputFile string) string {
// are pointed to by that array are aliased with the values pointed
// to by 'from'. The caller is responsible for calling free() on
// '*out_argv'.
func stripLocalArgs(args []string) []string {
func stripLocalArgs(args []string, env *env.Sandbox) []string {
r := make([]string, 0, len(args))

// skip through argv, copying all arguments but skipping ones that ought to be omitted
Expand Down Expand Up @@ -549,7 +549,9 @@ func stripLocalArgs(args []string) []string {
r = append(r, arg)
}

r[0] = filepath.Base(r[0])
if !dcSyscall.NeedSearchToolchain(env) {
r[0] = filepath.Base(r[0])
}

return r
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/booster/bk_dist/handler/ue4/cc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ func (cc *TaskCC) preBuild(args []string) error {
// debugRecordFileName(fmt.Sprintf("cc: pre-build ready stripLocalArgs"))

// strip the args and get the server side args.
serverSideArgs := stripLocalArgs(finalArgs)
serverSideArgs := stripLocalArgs(finalArgs, cc.sandbox.Env)

// replace the input file into preprocessedFile, for the next server side process.
for index := range serverSideArgs {
Expand Down
7 changes: 5 additions & 2 deletions src/backend/booster/bk_dist/handler/ue4/cc/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/TencentBlueKing/bk-turbo/src/backend/booster/bk_dist/common/protocol"
dcPump "github.com/TencentBlueKing/bk-turbo/src/backend/booster/bk_dist/common/pump"
dcSDK "github.com/TencentBlueKing/bk-turbo/src/backend/booster/bk_dist/common/sdk"
dcSyscall "github.com/TencentBlueKing/bk-turbo/src/backend/booster/bk_dist/common/syscall"
dcUtil "github.com/TencentBlueKing/bk-turbo/src/backend/booster/bk_dist/common/util"
"github.com/TencentBlueKing/bk-turbo/src/backend/booster/common/blog"
"github.com/TencentBlueKing/bk-turbo/src/backend/booster/common/codec"
Expand Down Expand Up @@ -583,7 +584,7 @@ func getPreprocessedExt(inputFile string) string {
// are pointed to by that array are aliased with the values pointed
// to by 'from'. The caller is responsible for calling free() on
// '*out_argv'.
func stripLocalArgs(args []string) []string {
func stripLocalArgs(args []string, env *env.Sandbox) []string {
r := make([]string, 0, len(args))

// skip through argv, copying all arguments but skipping ones that ought to be omitted
Expand Down Expand Up @@ -616,7 +617,9 @@ func stripLocalArgs(args []string) []string {
r = append(r, arg)
}

r[0] = filepath.Base(r[0])
if !dcSyscall.NeedSearchToolchain(env) {
r[0] = filepath.Base(r[0])
}
return r
}

Expand Down
Loading