diff options
Diffstat (limited to 'remoteexec/remoteexec.go')
-rw-r--r-- | remoteexec/remoteexec.go | 61 |
1 files changed, 3 insertions, 58 deletions
diff --git a/remoteexec/remoteexec.go b/remoteexec/remoteexec.go index 5f0426a7f..166f68c54 100644 --- a/remoteexec/remoteexec.go +++ b/remoteexec/remoteexec.go @@ -17,10 +17,6 @@ package remoteexec import ( "sort" "strings" - - "android/soong/android" - - "github.com/google/blueprint" ) const ( @@ -56,7 +52,6 @@ const ( var ( defaultLabels = map[string]string{"type": "tool"} defaultExecStrategy = LocalExecStrategy - pctx = android.NewPackageContext("android/soong/remoteexec") ) // REParams holds information pertinent to the remote execution of a rule. @@ -87,28 +82,18 @@ type REParams struct { } func init() { - pctx.VariableFunc("Wrapper", func(ctx android.PackageVarContext) string { - return wrapper(ctx.Config()) - }) -} - -func wrapper(cfg android.Config) string { - if override := cfg.Getenv("RBE_WRAPPER"); override != "" { - return override - } - return DefaultWrapperPath } // Template generates the remote execution wrapper template to be added as a prefix to the rule's // command. func (r *REParams) Template() string { - return "${remoteexec.Wrapper}" + r.wrapperArgs() + return "${android.RBEWrapper}" + r.wrapperArgs() } // NoVarTemplate generates the remote execution wrapper template without variables, to be used in // RuleBuilder. -func (r *REParams) NoVarTemplate(cfg android.Config) string { - return wrapper(cfg) + r.wrapperArgs() +func (r *REParams) NoVarTemplate(wrapper string) string { + return wrapper + r.wrapperArgs() } func (r *REParams) wrapperArgs() string { @@ -171,43 +156,3 @@ func (r *REParams) wrapperArgs() string { return args + " -- " } - -// 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. 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", "") - ruleParamsRE.Command = strings.ReplaceAll(ruleParamsRE.Command, "$reTemplate", reParams.Template()) - - return ctx.AndroidStaticRule(name, ruleParams, commonArgs...), - 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 { - return func(ctx android.PackageVarContext) string { - if override := ctx.Config().Getenv(envVar); override != "" { - return override - } - return defaultVal - } -} |