public class CachingBuildEngine extends Object implements BuildEngine, Closeable
BuildRule
which also caches the results. If the current
RuleKey
of the build rules matches the one on disk, it does not do any work. It also
tries to fetch its output from an ArtifactCache
to avoid doing any computation.Modifier and Type | Class and Description |
---|---|
static class |
CachingBuildEngine.DefaultBuildRuleBuilderDelegate |
BuildEngine.BuildEngineResult
Modifier and Type | Field and Description |
---|---|
static ResourceAmounts |
CACHE_CHECK_RESOURCE_AMOUNTS |
static ResourceAmounts |
RULE_KEY_COMPUTATION_RESOURCE_AMOUNTS |
static ResourceAmounts |
SCHEDULING_MORE_WORK_RESOURCE_AMOUNTS |
Constructor and Description |
---|
CachingBuildEngine(CachingBuildEngineDelegate cachingBuildEngineDelegate,
Optional<BuildRuleStrategy> customBuildRuleStrategy,
WeightedListeningExecutorService service,
BuildType buildMode,
DepFiles depFiles,
long maxDepFileCacheEntries,
Optional<Long> artifactCacheSizeLimit,
BuildRuleResolver resolver,
BuildEngineActionToBuildRuleResolver actionToBuildRuleResolver,
TargetConfigurationSerializer targetConfigurationSerializer,
BuildInfoStoreManager buildInfoStoreManager,
ResourceAwareSchedulingInfo resourceAwareSchedulingInfo,
boolean consoleLogBuildFailuresInline,
RuleKeyFactories ruleKeyFactories) |
Modifier and Type | Method and Description |
---|---|
BuildEngine.BuildEngineResult |
build(BuildEngineBuildContext buildContext,
ExecutionContext executionContext,
BuildRule rule)
Build the given build rule and return a future to the build rule success.
|
void |
close() |
BuildResult |
getBuildRuleResult(BuildTarget buildTarget)
Returns the build result of the build rule associated with the given build target.
|
int |
getNumRulesToBuild(Iterable<BuildRule> rules)
Calculate the total number of transitive build rules processed from the given roots.
|
ParallelRuleKeyCalculator<RuleKey> |
getRuleKeyCalculator() |
boolean |
isRuleBuilt(BuildTarget buildTarget)
Returns whether the build rule associated with the build target has been successfully built.
|
void |
terminateBuildWithFailure(Throwable failure)
Marks build as failed with the given Throwable.
|
com.google.common.util.concurrent.ListenableFuture<?> |
walkRule(BuildRule rule,
Set<BuildRule> seen) |
public static final ResourceAmounts CACHE_CHECK_RESOURCE_AMOUNTS
public static final ResourceAmounts RULE_KEY_COMPUTATION_RESOURCE_AMOUNTS
public static final ResourceAmounts SCHEDULING_MORE_WORK_RESOURCE_AMOUNTS
public CachingBuildEngine(CachingBuildEngineDelegate cachingBuildEngineDelegate, Optional<BuildRuleStrategy> customBuildRuleStrategy, WeightedListeningExecutorService service, BuildType buildMode, DepFiles depFiles, long maxDepFileCacheEntries, Optional<Long> artifactCacheSizeLimit, BuildRuleResolver resolver, BuildEngineActionToBuildRuleResolver actionToBuildRuleResolver, TargetConfigurationSerializer targetConfigurationSerializer, BuildInfoStoreManager buildInfoStoreManager, ResourceAwareSchedulingInfo resourceAwareSchedulingInfo, boolean consoleLogBuildFailuresInline, RuleKeyFactories ruleKeyFactories)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public ParallelRuleKeyCalculator<RuleKey> getRuleKeyCalculator()
public boolean isRuleBuilt(BuildTarget buildTarget) throws InterruptedException
BuildEngine
isRuleBuilt
in interface BuildEngine
InterruptedException
public void terminateBuildWithFailure(Throwable failure)
BuildEngine
terminateBuildWithFailure
in interface BuildEngine
public com.google.common.util.concurrent.ListenableFuture<?> walkRule(BuildRule rule, Set<BuildRule> seen)
public int getNumRulesToBuild(Iterable<BuildRule> rules)
BuildEngine
getNumRulesToBuild
in interface BuildEngine
public BuildEngine.BuildEngineResult build(BuildEngineBuildContext buildContext, ExecutionContext executionContext, BuildRule rule)
BuildEngine
build
in interface BuildEngine
@Nullable public BuildResult getBuildRuleResult(BuildTarget buildTarget) throws ExecutionException, InterruptedException
BuildEngine
null
if the build rule has not yet been built.getBuildRuleResult
in interface BuildEngine
ExecutionException
InterruptedException