Merge "Use localPool consistently for UseGoma() == true"
This commit is contained in:
@@ -1189,6 +1189,12 @@ 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.UseGoma() && params.Pool == nil {
|
||||||
|
// When USE_GOMA=true is set and the rule is not supported by goma, restrict jobs to the
|
||||||
|
// local parallelism value
|
||||||
|
params.Pool = localPool
|
||||||
|
}
|
||||||
|
|
||||||
rule := m.bp.Rule(pctx.PackageContext, name, params, argNames...)
|
rule := m.bp.Rule(pctx.PackageContext, name, params, argNames...)
|
||||||
|
|
||||||
if m.config.captureBuild {
|
if m.config.captureBuild {
|
||||||
|
@@ -104,7 +104,8 @@ func (p PackageContext) PoolFunc(name string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RuleFunc wraps blueprint.PackageContext.RuleFunc, converting the interface{} config
|
// RuleFunc wraps blueprint.PackageContext.RuleFunc, converting the interface{} config
|
||||||
// argument to a Context that supports Config().
|
// argument to a Context that supports Config(), and provides a default Pool if none is
|
||||||
|
// specified.
|
||||||
func (p PackageContext) RuleFunc(name string,
|
func (p PackageContext) RuleFunc(name string,
|
||||||
f func(PackageRuleContext) blueprint.RuleParams, argNames ...string) blueprint.Rule {
|
f func(PackageRuleContext) blueprint.RuleParams, argNames ...string) blueprint.Rule {
|
||||||
|
|
||||||
@@ -114,6 +115,11 @@ func (p PackageContext) RuleFunc(name string,
|
|||||||
if len(ctx.errors) > 0 {
|
if len(ctx.errors) > 0 {
|
||||||
return params, ctx.errors[0]
|
return params, ctx.errors[0]
|
||||||
}
|
}
|
||||||
|
if ctx.Config().UseGoma() && params.Pool == nil {
|
||||||
|
// When USE_GOMA=true is set and the rule is not supported by goma, restrict jobs to the
|
||||||
|
// local parallelism value
|
||||||
|
params.Pool = localPool
|
||||||
|
}
|
||||||
return params, nil
|
return params, nil
|
||||||
}, argNames...)
|
}, argNames...)
|
||||||
}
|
}
|
||||||
@@ -234,10 +240,16 @@ func (p PackageContext) PrefixedExistentPathsForSourcesVariable(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// AndroidStaticRule wraps blueprint.StaticRule and provides a default Pool if none is specified
|
// AndroidStaticRule is an alias for StaticRule.
|
||||||
func (p PackageContext) AndroidStaticRule(name string, params blueprint.RuleParams,
|
func (p PackageContext) AndroidStaticRule(name string, params blueprint.RuleParams,
|
||||||
argNames ...string) blueprint.Rule {
|
argNames ...string) blueprint.Rule {
|
||||||
return p.AndroidRuleFunc(name, func(PackageRuleContext) blueprint.RuleParams {
|
return p.StaticRule(name, params, argNames...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// StaticRule wraps blueprint.StaticRule and provides a default Pool if none is specified.
|
||||||
|
func (p PackageContext) StaticRule(name string, params blueprint.RuleParams,
|
||||||
|
argNames ...string) blueprint.Rule {
|
||||||
|
return p.RuleFunc(name, func(PackageRuleContext) blueprint.RuleParams {
|
||||||
return params
|
return params
|
||||||
}, argNames...)
|
}, argNames...)
|
||||||
}
|
}
|
||||||
@@ -245,18 +257,6 @@ func (p PackageContext) AndroidStaticRule(name string, params blueprint.RulePara
|
|||||||
// AndroidGomaStaticRule wraps blueprint.StaticRule but uses goma's parallelism if goma is enabled
|
// AndroidGomaStaticRule wraps blueprint.StaticRule but uses goma's parallelism if goma is enabled
|
||||||
func (p PackageContext) AndroidGomaStaticRule(name string, params blueprint.RuleParams,
|
func (p PackageContext) AndroidGomaStaticRule(name string, params blueprint.RuleParams,
|
||||||
argNames ...string) blueprint.Rule {
|
argNames ...string) blueprint.Rule {
|
||||||
return p.StaticRule(name, params, argNames...)
|
// bypass android.PackageContext.StaticRule so that Pool does not get set to local_pool.
|
||||||
}
|
return p.PackageContext.StaticRule(name, params, argNames...)
|
||||||
|
|
||||||
func (p PackageContext) AndroidRuleFunc(name string,
|
|
||||||
f func(PackageRuleContext) blueprint.RuleParams, argNames ...string) blueprint.Rule {
|
|
||||||
return p.RuleFunc(name, func(ctx PackageRuleContext) blueprint.RuleParams {
|
|
||||||
params := f(ctx)
|
|
||||||
if ctx.Config().UseGoma() && params.Pool == nil {
|
|
||||||
// When USE_GOMA=true is set and the rule is not supported by goma, restrict jobs to the
|
|
||||||
// local parallelism value
|
|
||||||
params.Pool = localPool
|
|
||||||
}
|
|
||||||
return params
|
|
||||||
}, argNames...)
|
|
||||||
}
|
}
|
||||||
|
@@ -127,6 +127,11 @@ 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().UseGoma() && params.Pool == nil {
|
||||||
|
// When USE_GOMA=true is set and the rule is not supported by goma, restrict jobs to the
|
||||||
|
// local parallelism value
|
||||||
|
params.Pool = localPool
|
||||||
|
}
|
||||||
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 {
|
||||||
s.ruleParams[rule] = params
|
s.ruleParams[rule] = params
|
||||||
|
@@ -195,7 +195,7 @@ var (
|
|||||||
|
|
||||||
_ = pctx.SourcePathVariable("sAbiDiffer", "prebuilts/clang-tools/${config.HostPrebuiltTag}/bin/header-abi-diff")
|
_ = pctx.SourcePathVariable("sAbiDiffer", "prebuilts/clang-tools/${config.HostPrebuiltTag}/bin/header-abi-diff")
|
||||||
|
|
||||||
sAbiDiff = pctx.AndroidRuleFunc("sAbiDiff",
|
sAbiDiff = pctx.RuleFunc("sAbiDiff",
|
||||||
func(ctx android.PackageRuleContext) blueprint.RuleParams {
|
func(ctx android.PackageRuleContext) blueprint.RuleParams {
|
||||||
// TODO(b/78139997): Add -check-all-apis back
|
// TODO(b/78139997): Add -check-all-apis back
|
||||||
commandStr := "($sAbiDiffer ${allowFlags} -lib ${libName} -arch ${arch} -o ${out} -new ${in} -old ${referenceDump})"
|
commandStr := "($sAbiDiffer ${allowFlags} -lib ${libName} -arch ${arch} -o ${out} -new ${in} -old ${referenceDump})"
|
||||||
|
Reference in New Issue
Block a user