Loading android/config.go +12 −0 Original line number Diff line number Diff line Loading @@ -816,6 +816,18 @@ func (c *config) UseRBE() bool { return Bool(c.productVariables.UseRBE) } func (c *config) UseRBEJAVAC() bool { return Bool(c.productVariables.UseRBEJAVAC) } func (c *config) UseRBER8() bool { return Bool(c.productVariables.UseRBER8) } func (c *config) UseRBED8() bool { return Bool(c.productVariables.UseRBED8) } func (c *config) UseRemoteBuild() bool { return c.UseGoma() || c.UseRBE() } Loading android/package_ctx.go +36 −8 Original line number Diff line number Diff line Loading @@ -232,16 +232,32 @@ func (p PackageContext) StaticRule(name string, params blueprint.RuleParams, }, argNames...) } // RemoteRuleSupports selects if a AndroidRemoteStaticRule supports goma, RBE, or both. type RemoteRuleSupports int // RBEExperimentalFlag indicates which flag should be set for the AndroidRemoteStaticRule // to use RBE. type RBEExperimentalFlag int const ( SUPPORTS_NONE = 0 SUPPORTS_GOMA = 1 << iota SUPPORTS_RBE = 1 << iota SUPPORTS_BOTH = SUPPORTS_GOMA | SUPPORTS_RBE // RBE_NOT_EXPERIMENTAL indicates the rule should use RBE in every build that has // UseRBE set. RBE_NOT_EXPERIMENTAL RBEExperimentalFlag = iota // RBE_JAVAC indicates the rule should use RBE only if the RBE_JAVAC variable is // set in an RBE enabled build. RBE_JAVAC // RBE_R8 indicates the rule should use RBE only if the RBE_R8 variable is set in // an RBE enabled build. RBE_R8 // RBE_D8 indicates the rule should use RBE only if the RBE_D8 variable is set in // an RBE enabled build. RBE_D8 ) // RemoteRuleSupports configures rules with whether they have Goma and/or RBE support. type RemoteRuleSupports struct { Goma bool RBE bool RBEFlag RBEExperimentalFlag } // AndroidRemoteStaticRule wraps blueprint.StaticRule but uses goma or RBE's parallelism if goma or RBE are enabled // and the appropriate SUPPORTS_* flag is set. func (p PackageContext) AndroidRemoteStaticRule(name string, supports RemoteRuleSupports, params blueprint.RuleParams, Loading @@ -249,18 +265,30 @@ func (p PackageContext) AndroidRemoteStaticRule(name string, supports RemoteRule return p.PackageContext.RuleFunc(name, func(config interface{}) (blueprint.RuleParams, error) { ctx := &configErrorWrapper{p, config.(Config), nil} if ctx.Config().UseGoma() && supports&SUPPORTS_GOMA == 0 { if ctx.Config().UseGoma() && !supports.Goma { // When USE_GOMA=true is set and the rule is not supported by goma, restrict jobs to the // local parallelism value params.Pool = localPool } if ctx.Config().UseRBE() && supports&SUPPORTS_RBE == 0 { if ctx.Config().UseRBE() && !supports.RBE { // When USE_RBE=true is set and the rule is not supported by RBE, restrict jobs to the // local parallelism value params.Pool = localPool } if ctx.Config().UseRBE() && supports.RBE { if supports.RBEFlag == RBE_JAVAC && !ctx.Config().UseRBEJAVAC() { params.Pool = localPool } if supports.RBEFlag == RBE_R8 && !ctx.Config().UseRBER8() { params.Pool = localPool } if supports.RBEFlag == RBE_D8 && !ctx.Config().UseRBED8() { params.Pool = localPool } } return params, nil }, argNames...) } android/rule_builder.go +3 −3 Original line number Diff line number Diff line Loading @@ -417,10 +417,10 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string } var pool blueprint.Pool if ctx.Config().UseGoma() && r.remoteable&SUPPORTS_GOMA != 0 { if ctx.Config().UseGoma() && r.remoteable.Goma { // When USE_GOMA=true is set and the rule is supported by goma, allow jobs to run outside the local pool. } else if ctx.Config().UseRBE() && r.remoteable&SUPPORTS_RBE != 0 { // When USE_GOMA=true is set and the rule is supported by RBE, allow jobs to run outside the local pool. } else if ctx.Config().UseRBE() && r.remoteable.RBE { // When USE_RBE=true is set and the rule is supported by RBE, allow jobs to run outside the local pool. } else if r.highmem { pool = highmemPool } else if ctx.Config().UseRemoteBuild() { Loading android/variable.go +3 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,9 @@ type productVariables struct { Binder32bit *bool `json:",omitempty"` UseGoma *bool `json:",omitempty"` UseRBE *bool `json:",omitempty"` UseRBEJAVAC *bool `json:",omitempty"` UseRBER8 *bool `json:",omitempty"` UseRBED8 *bool `json:",omitempty"` Debuggable *bool `json:",omitempty"` Eng *bool `json:",omitempty"` Treble_linker_namespaces *bool `json:",omitempty"` Loading bpf/bpf.go +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ func init() { var ( pctx = android.NewPackageContext("android/soong/bpf") ccRule = pctx.AndroidRemoteStaticRule("ccRule", android.SUPPORTS_GOMA, ccRule = pctx.AndroidRemoteStaticRule("ccRule", android.RemoteRuleSupports{Goma: true}, blueprint.RuleParams{ Depfile: "${out}.d", Deps: blueprint.DepsGCC, Loading Loading
android/config.go +12 −0 Original line number Diff line number Diff line Loading @@ -816,6 +816,18 @@ func (c *config) UseRBE() bool { return Bool(c.productVariables.UseRBE) } func (c *config) UseRBEJAVAC() bool { return Bool(c.productVariables.UseRBEJAVAC) } func (c *config) UseRBER8() bool { return Bool(c.productVariables.UseRBER8) } func (c *config) UseRBED8() bool { return Bool(c.productVariables.UseRBED8) } func (c *config) UseRemoteBuild() bool { return c.UseGoma() || c.UseRBE() } Loading
android/package_ctx.go +36 −8 Original line number Diff line number Diff line Loading @@ -232,16 +232,32 @@ func (p PackageContext) StaticRule(name string, params blueprint.RuleParams, }, argNames...) } // RemoteRuleSupports selects if a AndroidRemoteStaticRule supports goma, RBE, or both. type RemoteRuleSupports int // RBEExperimentalFlag indicates which flag should be set for the AndroidRemoteStaticRule // to use RBE. type RBEExperimentalFlag int const ( SUPPORTS_NONE = 0 SUPPORTS_GOMA = 1 << iota SUPPORTS_RBE = 1 << iota SUPPORTS_BOTH = SUPPORTS_GOMA | SUPPORTS_RBE // RBE_NOT_EXPERIMENTAL indicates the rule should use RBE in every build that has // UseRBE set. RBE_NOT_EXPERIMENTAL RBEExperimentalFlag = iota // RBE_JAVAC indicates the rule should use RBE only if the RBE_JAVAC variable is // set in an RBE enabled build. RBE_JAVAC // RBE_R8 indicates the rule should use RBE only if the RBE_R8 variable is set in // an RBE enabled build. RBE_R8 // RBE_D8 indicates the rule should use RBE only if the RBE_D8 variable is set in // an RBE enabled build. RBE_D8 ) // RemoteRuleSupports configures rules with whether they have Goma and/or RBE support. type RemoteRuleSupports struct { Goma bool RBE bool RBEFlag RBEExperimentalFlag } // AndroidRemoteStaticRule wraps blueprint.StaticRule but uses goma or RBE's parallelism if goma or RBE are enabled // and the appropriate SUPPORTS_* flag is set. func (p PackageContext) AndroidRemoteStaticRule(name string, supports RemoteRuleSupports, params blueprint.RuleParams, Loading @@ -249,18 +265,30 @@ func (p PackageContext) AndroidRemoteStaticRule(name string, supports RemoteRule return p.PackageContext.RuleFunc(name, func(config interface{}) (blueprint.RuleParams, error) { ctx := &configErrorWrapper{p, config.(Config), nil} if ctx.Config().UseGoma() && supports&SUPPORTS_GOMA == 0 { if ctx.Config().UseGoma() && !supports.Goma { // When USE_GOMA=true is set and the rule is not supported by goma, restrict jobs to the // local parallelism value params.Pool = localPool } if ctx.Config().UseRBE() && supports&SUPPORTS_RBE == 0 { if ctx.Config().UseRBE() && !supports.RBE { // When USE_RBE=true is set and the rule is not supported by RBE, restrict jobs to the // local parallelism value params.Pool = localPool } if ctx.Config().UseRBE() && supports.RBE { if supports.RBEFlag == RBE_JAVAC && !ctx.Config().UseRBEJAVAC() { params.Pool = localPool } if supports.RBEFlag == RBE_R8 && !ctx.Config().UseRBER8() { params.Pool = localPool } if supports.RBEFlag == RBE_D8 && !ctx.Config().UseRBED8() { params.Pool = localPool } } return params, nil }, argNames...) }
android/rule_builder.go +3 −3 Original line number Diff line number Diff line Loading @@ -417,10 +417,10 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string } var pool blueprint.Pool if ctx.Config().UseGoma() && r.remoteable&SUPPORTS_GOMA != 0 { if ctx.Config().UseGoma() && r.remoteable.Goma { // When USE_GOMA=true is set and the rule is supported by goma, allow jobs to run outside the local pool. } else if ctx.Config().UseRBE() && r.remoteable&SUPPORTS_RBE != 0 { // When USE_GOMA=true is set and the rule is supported by RBE, allow jobs to run outside the local pool. } else if ctx.Config().UseRBE() && r.remoteable.RBE { // When USE_RBE=true is set and the rule is supported by RBE, allow jobs to run outside the local pool. } else if r.highmem { pool = highmemPool } else if ctx.Config().UseRemoteBuild() { Loading
android/variable.go +3 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,9 @@ type productVariables struct { Binder32bit *bool `json:",omitempty"` UseGoma *bool `json:",omitempty"` UseRBE *bool `json:",omitempty"` UseRBEJAVAC *bool `json:",omitempty"` UseRBER8 *bool `json:",omitempty"` UseRBED8 *bool `json:",omitempty"` Debuggable *bool `json:",omitempty"` Eng *bool `json:",omitempty"` Treble_linker_namespaces *bool `json:",omitempty"` Loading
bpf/bpf.go +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ func init() { var ( pctx = android.NewPackageContext("android/soong/bpf") ccRule = pctx.AndroidRemoteStaticRule("ccRule", android.SUPPORTS_GOMA, ccRule = pctx.AndroidRemoteStaticRule("ccRule", android.RemoteRuleSupports{Goma: true}, blueprint.RuleParams{ Depfile: "${out}.d", Deps: blueprint.DepsGCC, Loading