public class RuleAnalysisCompatibleDelegatingActionGraphBuilder extends AbstractActionGraphBuilder implements RuleAnalysisGraph
ActionGraphBuilder
that manages both rule analysis computation and the legacy action
graph construction.
This builder delegates to the new RuleAnalysisGraph
and ActionGraphBuilder
as
appropriate depending on the rule that is requested.
It satisfies the API of both computations to provide compatibility between them
Constructor and Description |
---|
RuleAnalysisCompatibleDelegatingActionGraphBuilder(TargetNodeToBuildRuleTransformer buildRuleGenerator,
java.util.function.Function<TargetNodeToBuildRuleTransformer,ActionGraphBuilder> delegateBuilderConstructor,
RuleAnalysisGraph delegateRuleAnalysisComputation) |
Modifier and Type | Method and Description |
---|---|
<T extends BuildRule> |
addToIndex(T buildRule)
Deprecated.
|
BuildRule |
computeIfAbsent(BuildTarget target,
java.util.function.Function<BuildTarget,BuildRule> mappingFunction)
Retrieve the
BuildRule for the given BuildTarget . |
RuleAnalysisResult |
get(RuleAnalysisKey lookupKey)
Finds the
RuleAnalysisResult of the given RuleAnalysisKey , starting computation
as necessary. |
com.google.common.collect.ImmutableMap<RuleAnalysisKey,RuleAnalysisResult> |
getAll(Set<RuleAnalysisKey> lookupKeys)
same as
RuleAnalysisGraph.get(RuleAnalysisKey) but for multiple RuleAnalysisKey s |
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.
|
<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) |
checkRuleIsBuiltForCorrectTarget, computeAllIfAbsent, requireAllRules
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 RuleAnalysisCompatibleDelegatingActionGraphBuilder(TargetNodeToBuildRuleTransformer buildRuleGenerator, java.util.function.Function<TargetNodeToBuildRuleTransformer,ActionGraphBuilder> delegateBuilderConstructor, RuleAnalysisGraph delegateRuleAnalysisComputation)
public Iterable<BuildRule> getBuildRules()
getBuildRules
in interface ActionGraphBuilder
public Iterable<BuildRule> getSuccessfullyConstructedBuildRules()
getSuccessfullyConstructedBuildRules
in interface ActionGraphBuilder
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.computeIfAbsent
in interface ActionGraphBuilder
target
- target with which the BuildRule is associated.mappingFunction
- function to compute the rule.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.requireRule
in interface ActionGraphBuilder
public com.google.common.util.concurrent.ListenableFuture<BuildRule> requireRuleFuture(BuildTarget target)
requireRuleFuture
in interface ActionGraphBuilder
requireRuleFuture
in class AbstractActionGraphBuilder
public <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>)
.requireMetadata
in interface ActionGraphBuilder
@Deprecated public <T extends BuildRule> T addToIndex(T buildRule)
ActionGraphBuilder
buildRule
's target to itself and returns buildRule
.
Please use computeIfAbsent
instead
addToIndex
in interface ActionGraphBuilder
public Parallelizer getParallelizer()
ActionGraphBuilder
getParallelizer
in interface ActionGraphBuilder
public void invalidate()
ActionGraphBuilder
invalidate
in interface ActionGraphBuilder
public Optional<BuildRule> getRuleOptional(BuildTarget buildTarget)
BuildRuleResolver
BuildRule
associated with the given BuildTarget
if it is already
present.getRuleOptional
in interface BuildRuleResolver
public RuleAnalysisResult get(RuleAnalysisKey lookupKey)
RuleAnalysisGraph
RuleAnalysisResult
of the given RuleAnalysisKey
, starting computation
as necessary. All dependencies required will also be transformed, and cached.get
in interface RuleAnalysisGraph
lookupKey
- the RuleAnalysisKey
to find the result forRuleAnalysisResult
from analyzing the given RuleAnalysisKey
public com.google.common.collect.ImmutableMap<RuleAnalysisKey,RuleAnalysisResult> getAll(Set<RuleAnalysisKey> lookupKeys)
RuleAnalysisGraph
RuleAnalysisGraph.get(RuleAnalysisKey)
but for multiple RuleAnalysisKey
sgetAll
in interface RuleAnalysisGraph