Support multiple rsp files in REParams

rewrapper supports a comma separate list of rsp files, replace
REParams.RSPFile with REParmas.RSPFiles.

Test: remoteexec_test.go
Change-Id: I7850c071c23d368d6fad4480dd527d146c13c6d3
This commit is contained in:
Colin Cross 2021-03-24 14:09:28 -07:00
parent fd708b5651
commit a4eafddc41
6 changed files with 13 additions and 14 deletions

View File

@ -654,7 +654,7 @@ func (r *RuleBuilder) Build(name string, desc string) {
inputs = append(inputs, inputsListFile) inputs = append(inputs, inputsListFile)
r.rbeParams.OutputFiles = outputs.Strings() r.rbeParams.OutputFiles = outputs.Strings()
r.rbeParams.RSPFile = inputsListFile.String() r.rbeParams.RSPFiles = []string{inputsListFile.String()}
rewrapperCommand := r.rbeParams.NoVarTemplate(r.ctx.Config().RBEWrapper()) rewrapperCommand := r.rbeParams.NoVarTemplate(r.ctx.Config().RBEWrapper())
commandString = rewrapperCommand + " bash -c '" + strings.ReplaceAll(commandString, `'`, `'\''`) + "'" commandString = rewrapperCommand + " bash -c '" + strings.ReplaceAll(commandString, `'`, `'\''`) + "'"
} }

View File

@ -73,7 +73,7 @@ var (
Labels: map[string]string{"type": "link", "tool": "clang"}, Labels: map[string]string{"type": "link", "tool": "clang"},
ExecStrategy: "${config.RECXXLinksExecStrategy}", ExecStrategy: "${config.RECXXLinksExecStrategy}",
Inputs: []string{"${out}.rsp", "$implicitInputs"}, Inputs: []string{"${out}.rsp", "$implicitInputs"},
RSPFile: "${out}.rsp", RSPFiles: []string{"${out}.rsp"},
OutputFiles: []string{"${out}", "$implicitOutputs"}, OutputFiles: []string{"${out}", "$implicitOutputs"},
ToolchainInputs: []string{"$ldCmd"}, ToolchainInputs: []string{"$ldCmd"},
Platform: map[string]string{remoteexec.PoolKey: "${config.RECXXLinksPool}"}, Platform: map[string]string{remoteexec.PoolKey: "${config.RECXXLinksPool}"},
@ -256,7 +256,7 @@ var (
Labels: map[string]string{"type": "tool", "name": "abi-linker"}, Labels: map[string]string{"type": "tool", "name": "abi-linker"},
ExecStrategy: "${config.REAbiLinkerExecStrategy}", ExecStrategy: "${config.REAbiLinkerExecStrategy}",
Inputs: []string{"$sAbiLinkerLibs", "${out}.rsp", "$implicitInputs"}, Inputs: []string{"$sAbiLinkerLibs", "${out}.rsp", "$implicitInputs"},
RSPFile: "${out}.rsp", RSPFiles: []string{"${out}.rsp"},
OutputFiles: []string{"$out"}, OutputFiles: []string{"$out"},
ToolchainInputs: []string{"$sAbiLinker"}, ToolchainInputs: []string{"$sAbiLinker"},
Platform: map[string]string{remoteexec.PoolKey: "${config.RECXXPool}"}, Platform: map[string]string{remoteexec.PoolKey: "${config.RECXXPool}"},

View File

@ -150,7 +150,7 @@ var (
&remoteexec.REParams{Labels: map[string]string{"type": "tool", "name": "turbine"}, &remoteexec.REParams{Labels: map[string]string{"type": "tool", "name": "turbine"},
ExecStrategy: "${config.RETurbineExecStrategy}", ExecStrategy: "${config.RETurbineExecStrategy}",
Inputs: []string{"${config.TurbineJar}", "${out}.rsp", "$implicits"}, Inputs: []string{"${config.TurbineJar}", "${out}.rsp", "$implicits"},
RSPFile: "${out}.rsp", RSPFiles: []string{"${out}.rsp"},
OutputFiles: []string{"$out.tmp"}, OutputFiles: []string{"$out.tmp"},
OutputDirectories: []string{"$outDir"}, OutputDirectories: []string{"$outDir"},
ToolchainInputs: []string{"${config.JavaCmd}"}, ToolchainInputs: []string{"${config.JavaCmd}"},
@ -167,7 +167,7 @@ var (
&remoteexec.REParams{ &remoteexec.REParams{
ExecStrategy: "${config.REJarExecStrategy}", ExecStrategy: "${config.REJarExecStrategy}",
Inputs: []string{"${config.SoongZipCmd}", "${out}.rsp"}, Inputs: []string{"${config.SoongZipCmd}", "${out}.rsp"},
RSPFile: "${out}.rsp", RSPFiles: []string{"${out}.rsp"},
OutputFiles: []string{"$out"}, OutputFiles: []string{"$out"},
Platform: map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"}, Platform: map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"},
}, []string{"jarArgs"}, nil) }, []string{"jarArgs"}, nil)
@ -182,7 +182,7 @@ var (
&remoteexec.REParams{ &remoteexec.REParams{
ExecStrategy: "${config.REZipExecStrategy}", ExecStrategy: "${config.REZipExecStrategy}",
Inputs: []string{"${config.SoongZipCmd}", "${out}.rsp", "$implicits"}, Inputs: []string{"${config.SoongZipCmd}", "${out}.rsp", "$implicits"},
RSPFile: "${out}.rsp", RSPFiles: []string{"${out}.rsp"},
OutputFiles: []string{"$out"}, OutputFiles: []string{"$out"},
Platform: map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"}, Platform: map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"},
}, []string{"jarArgs"}, []string{"implicits"}) }, []string{"jarArgs"}, []string{"implicits"})

View File

@ -1231,7 +1231,7 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi
Labels: labels, Labels: labels,
ExecStrategy: execStrategy, ExecStrategy: execStrategy,
Inputs: inputs, Inputs: inputs,
RSPFile: implicitsRsp.String(), RSPFiles: []string{implicitsRsp.String()},
ToolchainInputs: []string{config.JavaCmd(ctx).String()}, ToolchainInputs: []string{config.JavaCmd(ctx).String()},
Platform: map[string]string{remoteexec.PoolKey: pool}, Platform: map[string]string{remoteexec.PoolKey: pool},
EnvironmentVariables: []string{"ANDROID_SDK_HOME"}, EnvironmentVariables: []string{"ANDROID_SDK_HOME"},

View File

@ -64,9 +64,8 @@ type REParams struct {
ExecStrategy string ExecStrategy string
// Inputs is a list of input paths or ninja variables. // Inputs is a list of input paths or ninja variables.
Inputs []string Inputs []string
// RSPFile is the name of the ninja variable used by the rule as a placeholder for an rsp // RSPFiles is the name of the files used by the rule as a placeholder for an rsp input.
// input. RSPFiles []string
RSPFile string
// OutputFiles is a list of output file paths or ninja variables as placeholders for rule // OutputFiles is a list of output file paths or ninja variables as placeholders for rule
// outputs. // outputs.
OutputFiles []string OutputFiles []string
@ -134,8 +133,8 @@ func (r *REParams) wrapperArgs() string {
args += " --inputs=" + strings.Join(r.Inputs, ",") args += " --inputs=" + strings.Join(r.Inputs, ",")
} }
if r.RSPFile != "" { if len(r.RSPFiles) > 0 {
args += " --input_list_paths=" + r.RSPFile args += " --input_list_paths=" + strings.Join(r.RSPFiles, ",")
} }
if len(r.OutputFiles) > 0 { if len(r.OutputFiles) > 0 {

View File

@ -45,14 +45,14 @@ func TestTemplate(t *testing.T) {
Inputs: []string{"$in"}, Inputs: []string{"$in"},
OutputFiles: []string{"$out"}, OutputFiles: []string{"$out"},
ExecStrategy: "remote", ExecStrategy: "remote",
RSPFile: "$out.rsp", RSPFiles: []string{"$out.rsp", "out2.rsp"},
ToolchainInputs: []string{"clang++"}, ToolchainInputs: []string{"clang++"},
Platform: map[string]string{ Platform: map[string]string{
ContainerImageKey: DefaultImage, ContainerImageKey: DefaultImage,
PoolKey: "default", PoolKey: "default",
}, },
}, },
want: fmt.Sprintf("${android.RBEWrapper} --labels=compiler=clang,lang=cpp,type=compile --platform=\"Pool=default,container-image=%s\" --exec_strategy=remote --inputs=$in --input_list_paths=$out.rsp --output_files=$out --toolchain_inputs=clang++ -- ", DefaultImage), want: fmt.Sprintf("${android.RBEWrapper} --labels=compiler=clang,lang=cpp,type=compile --platform=\"Pool=default,container-image=%s\" --exec_strategy=remote --inputs=$in --input_list_paths=$out.rsp,out2.rsp --output_files=$out --toolchain_inputs=clang++ -- ", DefaultImage),
}, },
} }
for _, test := range tests { for _, test := range tests {