public class MultiThreadedActionGraphBuilder extends AbstractActionGraphBuilder
In order to prevent race-conditions and duplicate work, this implementation imposes additional semantics for concurrent access:
This means that a task that is doing work will only recursively process tasks that it has directly asked for (i.e. stack traces will look nice). In the case where work is done by another thread, stack traces will be captured on that thread and then re-thrown from the thread that requested the work.
Constructor and Description |
---|
MultiThreadedActionGraphBuilder(com.google.common.util.concurrent.ListeningExecutorService executor,
TargetGraph targetGraph,
ConfigurationRuleRegistry configurationRuleRegistry,
TargetNodeToBuildRuleTransformer buildRuleGenerator,
CellProvider cellProvider) |
Modifier and Type | Method and Description |
---|---|
<T extends BuildRule> |
addToIndex(T buildRule)
Deprecated.
|
com.google.common.collect.ImmutableSortedMap<BuildTarget,BuildRule> |
computeAllIfAbsent(com.google.common.collect.ImmutableMap<BuildTarget,java.util.function.Function<BuildTarget,BuildRule>> mappings) |
BuildRule |
computeIfAbsent(BuildTarget target,
java.util.function.Function<BuildTarget,BuildRule> mappingFunction)
Retrieve the
BuildRule for the given BuildTarget . |
Iterable<BuildRule> |
getBuildRules() |
Parallelizer |
getParallelizer()
Returns a parallelizer object that parallelizes if the current BuildRuleResolver supports
parallelism.
|
Optional<BuildRule> |
getRuleOptional(BuildTarget buildTarget)
Returns the
BuildRule associated with the given BuildTarget if it is already
present. |
Iterable<BuildRule> |
getSuccessfullyConstructedBuildRules() |
void |
invalidate()
Invalidates this object.
|
com.google.common.collect.ImmutableSortedSet<BuildRule> |
requireAllRules(Iterable<BuildTarget> buildTargets) |
<T> Optional<T> |
requireMetadata(BuildTarget target,
Class<T> metadataClass)
Retrieve a piece of metadata for a target.
|
BuildRule |
requireRule(BuildTarget target)
Retrieve the
BuildRule for the given BuildTarget . |
com.google.common.util.concurrent.ListenableFuture<BuildRule> |
requireRuleFuture(BuildTarget target)
Requires the rule asynchronously.
|
checkRuleIsBuiltForCorrectTarget
filterBuildRuleInputs, filterBuildRuleInputs, filterBuildRuleInputs, filterBuildRuleInputs, getAllRules, getRule, getRule, getRule, getRuleOptionalWithType, getRuleWithType, getSourcePathResolver
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllRules, getRule, getRuleOptionalWithType, getRuleWithType
filterBuildRuleInputs, filterBuildRuleInputs, filterBuildRuleInputs, filterBuildRuleInputs, getRule, getRule, getSourcePathResolver
public MultiThreadedActionGraphBuilder(com.google.common.util.concurrent.ListeningExecutorService executor, TargetGraph targetGraph, ConfigurationRuleRegistry configurationRuleRegistry, TargetNodeToBuildRuleTransformer buildRuleGenerator, CellProvider cellProvider)
public Iterable<BuildRule> getBuildRules()
public Iterable<BuildRule> getSuccessfullyConstructedBuildRules()
public Optional<BuildRule> getRuleOptional(BuildTarget buildTarget)
BuildRuleResolver
BuildRule
associated with the given BuildTarget
if it is already
present.public BuildRule computeIfAbsent(BuildTarget target, java.util.function.Function<BuildTarget,BuildRule> mappingFunction)
ActionGraphBuilder
BuildRule
for the given BuildTarget
. If no rules are associated
with the target, compute the rule using the given supplier and update the mapping.target
- target with which the BuildRule is associated.mappingFunction
- function to compute the rule.public com.google.common.collect.ImmutableSortedSet<BuildRule> requireAllRules(Iterable<BuildTarget> buildTargets)
requireAllRules
in interface ActionGraphBuilder
requireAllRules
in class AbstractActionGraphBuilder
public com.google.common.collect.ImmutableSortedMap<BuildTarget,BuildRule> computeAllIfAbsent(com.google.common.collect.ImmutableMap<BuildTarget,java.util.function.Function<BuildTarget,BuildRule>> mappings)
computeAllIfAbsent
in interface ActionGraphBuilder
computeAllIfAbsent
in class AbstractActionGraphBuilder
public Parallelizer getParallelizer()
ActionGraphBuilder
public BuildRule requireRule(BuildTarget target)
ActionGraphBuilder
BuildRule
for the given BuildTarget
. If no rules are associated
with the target, compute it by transforming the TargetNode
associated with this build
target using the TargetNodeToBuildRuleTransformer
associated with this
instance.public com.google.common.util.concurrent.ListenableFuture<BuildRule> requireRuleFuture(BuildTarget target)
requireRuleFuture
in interface ActionGraphBuilder
requireRuleFuture
in class AbstractActionGraphBuilder
@Deprecated public <T extends BuildRule> T addToIndex(T buildRule)
computeIfAbsent
insteadpublic <T> Optional<T> requireMetadata(BuildTarget target, Class<T> metadataClass)
ActionGraphBuilder
MetadataProvidingDescription.createMetadata(com.facebook.buck.core.model.BuildTarget, com.facebook.buck.core.rules.ActionGraphBuilder, com.facebook.buck.core.cell.CellPathResolver, T, java.util.Optional<com.google.common.collect.ImmutableMap<com.facebook.buck.core.model.BuildTarget, com.facebook.buck.versions.Version>>, java.lang.Class<U>)
.public void invalidate()
ActionGraphBuilder