summaryrefslogtreecommitdiff
path: root/remoteexec/remoteexec.go
diff options
context:
space:
mode:
author Kousik Kumar <kousikk@google.com> 2020-05-20 11:27:16 -0700
committer Kousik Kumar <kousikk@google.com> 2020-05-28 11:56:48 -0700
commit366afc5011ca300d6bd14246c29e08b77387a12d (patch)
tree14ac254d861149ecb5ef995c6b3a07450ea26d0c /remoteexec/remoteexec.go
parent8f37ec82d9384bfcaa243c0a75174c067e05ab35 (diff)
Add support for remote-execution / caching of jar/zip actions
Test: Ran a build with `RBE_JAR="true" RBE_JAR_EXEC_STRATEGY="remote" RBE_ZIP="true" RBE_ZIP_EXEC_STRATEGY="remote" ... use_rbe m` and that succeeded. Bug: b/156765207 Change-Id: Ia17b532fbb282be414adf879914870082dd0841b
Diffstat (limited to 'remoteexec/remoteexec.go')
-rw-r--r--remoteexec/remoteexec.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/remoteexec/remoteexec.go b/remoteexec/remoteexec.go
index 11fc2826a..d6e2c0a75 100644
--- a/remoteexec/remoteexec.go
+++ b/remoteexec/remoteexec.go
@@ -178,6 +178,22 @@ func StaticRules(ctx android.PackageContext, name string, ruleParams blueprint.R
ctx.AndroidRemoteStaticRule(name+"RE", android.RemoteRuleSupports{RBE: true}, ruleParamsRE, append(commonArgs, reArgs...)...)
}
+// MultiCommandStaticRules 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. This
+// function supports multiple remote execution wrappers placed in the template when commands are
+// chained together with &&. commonArgs are args used for both the local and remotely executable
+// rules. reArgs are args used only for remote execution.
+func MultiCommandStaticRules(ctx android.PackageContext, name string, ruleParams blueprint.RuleParams, reParams map[string]*REParams, commonArgs []string, reArgs []string) (blueprint.Rule, blueprint.Rule) {
+ ruleParamsRE := ruleParams
+ for k, v := range reParams {
+ ruleParams.Command = strings.ReplaceAll(ruleParams.Command, k, "")
+ ruleParamsRE.Command = strings.ReplaceAll(ruleParamsRE.Command, k, v.Template())
+ }
+
+ return ctx.AndroidStaticRule(name, ruleParams, commonArgs...),
+ ctx.AndroidRemoteStaticRule(name+"RE", android.RemoteRuleSupports{RBE: true}, ruleParamsRE, append(commonArgs, reArgs...)...)
+}
+
// EnvOverrideFunc retrieves a variable func that evaluates to the value of the given environment
// variable if set, otherwise the given default.
func EnvOverrideFunc(envVar, defaultVal string) func(ctx android.PackageVarContext) string {