Refactor RBE support for Javac/R8/D8 to use the remoteexec package.

Test: build with and without RBE_JAVAC/RBE_R8/RBE_D8 set.
Change-Id: I1607f8cfb4d2c3cbb3672152bbeb561d9968bc60
This commit is contained in:
Ramy Medhat
2020-04-21 21:36:23 -04:00
parent a6c19f792d
commit 1dcc27e47c
8 changed files with 77 additions and 122 deletions

View File

@@ -232,30 +232,10 @@ func (p PackageContext) StaticRule(name string, params blueprint.RuleParams,
}, argNames...)
}
// RBEExperimentalFlag indicates which flag should be set for the AndroidRemoteStaticRule
// to use RBE.
type RBEExperimentalFlag int
const (
// 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
Goma bool
RBE bool
}
// AndroidRemoteStaticRule wraps blueprint.StaticRule but uses goma or RBE's parallelism if goma or RBE are enabled
@@ -277,18 +257,6 @@ func (p PackageContext) AndroidRemoteStaticRule(name string, supports RemoteRule
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...)
}