Merge "Fix RuleBuilder remoteable actions running in the local pool."
This commit is contained in:
@@ -100,6 +100,9 @@ var (
|
|||||||
// Used only when USE_GOMA=true is set, to restrict non-goma jobs to the local parallelism value
|
// Used only when USE_GOMA=true is set, to restrict non-goma jobs to the local parallelism value
|
||||||
localPool = blueprint.NewBuiltinPool("local_pool")
|
localPool = blueprint.NewBuiltinPool("local_pool")
|
||||||
|
|
||||||
|
// Used only by RuleBuilder to identify remoteable rules. Does not actually get created in ninja.
|
||||||
|
remotePool = blueprint.NewBuiltinPool("remote_pool")
|
||||||
|
|
||||||
// Used for processes that need significant RAM to ensure there are not too many running in parallel.
|
// Used for processes that need significant RAM to ensure there are not too many running in parallel.
|
||||||
highmemPool = blueprint.NewBuiltinPool("highmem_pool")
|
highmemPool = blueprint.NewBuiltinPool("highmem_pool")
|
||||||
)
|
)
|
||||||
|
@@ -908,7 +908,7 @@ func (m *ModuleBase) PartitionTag(config DeviceConfig) string {
|
|||||||
// partition at "system/vendor/odm".
|
// partition at "system/vendor/odm".
|
||||||
if config.OdmPath() == "odm" {
|
if config.OdmPath() == "odm" {
|
||||||
partition = "odm"
|
partition = "odm"
|
||||||
} else if strings.HasPrefix(config.OdmPath (), "vendor/") {
|
} else if strings.HasPrefix(config.OdmPath(), "vendor/") {
|
||||||
partition = "vendor"
|
partition = "vendor"
|
||||||
}
|
}
|
||||||
} else if m.ProductSpecific() {
|
} else if m.ProductSpecific() {
|
||||||
@@ -1506,10 +1506,17 @@ func (m *moduleContext) Variable(pctx PackageContext, name, value string) {
|
|||||||
func (m *moduleContext) Rule(pctx PackageContext, name string, params blueprint.RuleParams,
|
func (m *moduleContext) Rule(pctx PackageContext, name string, params blueprint.RuleParams,
|
||||||
argNames ...string) blueprint.Rule {
|
argNames ...string) blueprint.Rule {
|
||||||
|
|
||||||
if m.config.UseRemoteBuild() && params.Pool == nil {
|
if m.config.UseRemoteBuild() {
|
||||||
// When USE_GOMA=true or USE_RBE=true are set and the rule is not supported by goma/RBE, restrict
|
if params.Pool == nil {
|
||||||
// jobs to the local parallelism value
|
// When USE_GOMA=true or USE_RBE=true are set and the rule is not supported by goma/RBE, restrict
|
||||||
params.Pool = localPool
|
// jobs to the local parallelism value
|
||||||
|
params.Pool = localPool
|
||||||
|
} else if params.Pool == remotePool {
|
||||||
|
// remotePool is a fake pool used to identify rule that are supported for remoting. If the rule's
|
||||||
|
// pool is the remotePool, replace with nil so that ninja runs it at NINJA_REMOTE_NUM_JOBS
|
||||||
|
// parallelism.
|
||||||
|
params.Pool = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rule := m.bp.Rule(pctx.PackageContext, name, params, argNames...)
|
rule := m.bp.Rule(pctx.PackageContext, name, params, argNames...)
|
||||||
|
@@ -446,7 +446,8 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string
|
|||||||
if ctx.Config().UseGoma() && r.remoteable.Goma {
|
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.
|
// 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.RBE {
|
} 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.
|
// When USE_RBE=true is set and the rule is supported by RBE, use the remotePool.
|
||||||
|
pool = remotePool
|
||||||
} else if r.highmem {
|
} else if r.highmem {
|
||||||
pool = highmemPool
|
pool = highmemPool
|
||||||
} else if ctx.Config().UseRemoteBuild() {
|
} else if ctx.Config().UseRemoteBuild() {
|
||||||
|
@@ -128,10 +128,17 @@ func (s *singletonContextAdaptor) Variable(pctx PackageContext, name, value stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *singletonContextAdaptor) Rule(pctx PackageContext, name string, params blueprint.RuleParams, argNames ...string) blueprint.Rule {
|
func (s *singletonContextAdaptor) Rule(pctx PackageContext, name string, params blueprint.RuleParams, argNames ...string) blueprint.Rule {
|
||||||
if s.Config().UseRemoteBuild() && params.Pool == nil {
|
if s.Config().UseRemoteBuild() {
|
||||||
// When USE_GOMA=true or USE_RBE=true are set and the rule is not supported by goma/RBE, restrict
|
if params.Pool == nil {
|
||||||
// jobs to the local parallelism value
|
// When USE_GOMA=true or USE_RBE=true are set and the rule is not supported by goma/RBE, restrict
|
||||||
params.Pool = localPool
|
// jobs to the local parallelism value
|
||||||
|
params.Pool = localPool
|
||||||
|
} else if params.Pool == remotePool {
|
||||||
|
// remotePool is a fake pool used to identify rule that are supported for remoting. If the rule's
|
||||||
|
// pool is the remotePool, replace with nil so that ninja runs it at NINJA_REMOTE_NUM_JOBS
|
||||||
|
// parallelism.
|
||||||
|
params.Pool = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rule := s.SingletonContext.Rule(pctx.PackageContext, name, params, argNames...)
|
rule := s.SingletonContext.Rule(pctx.PackageContext, name, params, argNames...)
|
||||||
if s.Config().captureBuild {
|
if s.Config().captureBuild {
|
||||||
|
Reference in New Issue
Block a user