aboutsummaryrefslogtreecommitdiffstats
path: root/remoteexec
diff options
context:
space:
mode:
authorKousik Kumar <kousikk@google.com>2020-05-20 11:27:16 -0700
committerKousik Kumar <kousikk@google.com>2020-05-30 19:59:10 +0000
commitc05da0a90e29184df74c50a49a7905277a56aa3e (patch)
treec07f644d812bed4ab3797a2a9ccf1e14294eb60e /remoteexec
parent15e9d0dbf8717d1224370c513fdaf733f6b3d456 (diff)
downloadbuild_soong-c05da0a90e29184df74c50a49a7905277a56aa3e.tar.gz
build_soong-c05da0a90e29184df74c50a49a7905277a56aa3e.tar.bz2
build_soong-c05da0a90e29184df74c50a49a7905277a56aa3e.zip
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 Merged-In: Ia17b532fbb282be414adf879914870082dd0841b
Diffstat (limited to 'remoteexec')
-rw-r--r--remoteexec/remoteexec.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/remoteexec/remoteexec.go b/remoteexec/remoteexec.go
index 578af4ed..c7d518ee 100644
--- a/remoteexec/remoteexec.go
+++ b/remoteexec/remoteexec.go
@@ -164,6 +164,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 {