Add support for remote-execution / caching of turbine actions

Test: Ran a sample turbine action with:
RBE_TURBINE_EXEC_STRATEGY="remote" RBE_TURBINE="true" ... use_rbe m out/soong/.intermediates/external/protobuf/libprotobuf-java-micro/android_common/turbine/libprotobuf-java-micro.jar
and checked in reproxy_log.txt that remote-metadata had status SUCCESS.

Bug: b/156765475
Change-Id: I85c334e6998c6dd2a68460b3580d50fffd900e6f
This commit is contained in:
Kousik Kumar
2020-05-20 07:55:56 -07:00
parent 56b92cf177
commit 1372c1b430
3 changed files with 37 additions and 13 deletions

View File

@@ -75,6 +75,9 @@ type REParams struct {
// OutputFiles is a list of output file paths or ninja variables as placeholders for rule
// outputs.
OutputFiles []string
// OutputDirectories is a list of output directory paths or ninja variables as placeholders
// for rule outputs.
OutputDirectories []string
// ToolchainInputs is a list of paths or ninja variables pointing to the location of
// toolchain binaries used by the rule.
ToolchainInputs []string
@@ -151,6 +154,10 @@ func (r *REParams) wrapperArgs() string {
args += " --output_files=" + strings.Join(r.OutputFiles, ",")
}
if len(r.OutputDirectories) > 0 {
args += " --output_directories=" + strings.Join(r.OutputDirectories, ",")
}
if len(r.ToolchainInputs) > 0 {
args += " --toolchain_inputs=" + strings.Join(r.ToolchainInputs, ",")
}
@@ -159,7 +166,9 @@ func (r *REParams) wrapperArgs() string {
}
// StaticRules returns a pair of rules based on the given RuleParams, where the first rule is a
// locally executable rule and the second rule is a remotely executable rule.
// locally executable rule and the second rule is a remotely executable rule. commonArgs are args
// used for both the local and remotely executable rules. reArgs are used only for remote
// execution.
func StaticRules(ctx android.PackageContext, name string, ruleParams blueprint.RuleParams, reParams *REParams, commonArgs []string, reArgs []string) (blueprint.Rule, blueprint.Rule) {
ruleParamsRE := ruleParams
ruleParams.Command = strings.ReplaceAll(ruleParams.Command, "$reTemplate", "")