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.
|
checkRuleIsBuiltForCorrectTargetfilterBuildRuleInputs, filterBuildRuleInputs, filterBuildRuleInputs, filterBuildRuleInputs, getAllRules, getRule, getRule, getRule, getRuleOptionalWithType, getRuleWithType, getSourcePathResolverclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAllRules, getRule, getRuleOptionalWithType, getRuleWithTypefilterBuildRuleInputs, filterBuildRuleInputs, filterBuildRuleInputs, filterBuildRuleInputs, getRule, getRule, getSourcePathResolverpublic 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)
BuildRuleResolverBuildRule associated with the given BuildTarget if it is already
present.public BuildRule computeIfAbsent(BuildTarget target, java.util.function.Function<BuildTarget,BuildRule> mappingFunction)
ActionGraphBuilderBuildRule 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 ActionGraphBuilderrequireAllRules in class AbstractActionGraphBuilderpublic com.google.common.collect.ImmutableSortedMap<BuildTarget,BuildRule> computeAllIfAbsent(com.google.common.collect.ImmutableMap<BuildTarget,java.util.function.Function<BuildTarget,BuildRule>> mappings)
computeAllIfAbsent in interface ActionGraphBuildercomputeAllIfAbsent in class AbstractActionGraphBuilderpublic Parallelizer getParallelizer()
ActionGraphBuilderpublic BuildRule requireRule(BuildTarget target)
ActionGraphBuilderBuildRule 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 ActionGraphBuilderrequireRuleFuture in class AbstractActionGraphBuilder@Deprecated public <T extends BuildRule> T addToIndex(T buildRule)
computeIfAbsent insteadpublic <T> Optional<T> requireMetadata(BuildTarget target, Class<T> metadataClass)
ActionGraphBuilderMetadataProvidingDescription.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