public class TargetVariablesQueryEnvironment<NODE_TYPE> extends Object implements QueryEnvironment<NODE_TYPE>
QueryEnvironment
augmented with additional target
variables.QueryEnvironment.Argument<ENV_NODE_TYPE>, QueryEnvironment.ArgumentType, QueryEnvironment.QueryFunction<OUTPUT_TYPE extends QueryTarget,ENV_NODE_TYPE>, QueryEnvironment.TargetEvaluator
Constructor and Description |
---|
TargetVariablesQueryEnvironment(com.google.common.collect.ImmutableMap<String,Set<NODE_TYPE>> targetVariables,
QueryEnvironment<NODE_TYPE> delegate) |
Modifier and Type | Method and Description |
---|---|
void |
buildTransitiveClosure(Set<? extends QueryTarget> targetNodes,
int maxDepth)
Construct the dependency graph for a depth-bounded forward transitive closure of all nodes in
"targetNodes".
|
Set<Object> |
filterAttributeContents(NODE_TYPE target,
String attribute,
java.util.function.Predicate<Object> predicate)
Returns the objects in the `attribute` of the given `target` that satisfy `predicate`
|
Set<QueryFileTarget> |
getBuildFiles(Set<NODE_TYPE> targets)
Returns the build files that define the given targets.
|
Set<NODE_TYPE> |
getFileOwners(com.google.common.collect.ImmutableList<String> files)
Returns the targets that own one or more of the given files.
|
Iterable<QueryEnvironment.QueryFunction<?,NODE_TYPE>> |
getFunctions()
Returns the set of query functions implemented by this query environment.
|
Set<NODE_TYPE> |
getFwdDeps(Iterable<NODE_TYPE> targets)
Returns the direct forward dependencies of the specified targets.
|
Set<QueryFileTarget> |
getInputs(NODE_TYPE target) |
Set<NODE_TYPE> |
getReverseDeps(Iterable<NODE_TYPE> targets)
Returns the direct reverse dependencies of the specified targets.
|
QueryEnvironment.TargetEvaluator |
getTargetEvaluator()
Returns an evaluator for target patterns.
|
String |
getTargetKind(NODE_TYPE target) |
Set<? extends QueryTarget> |
getTargetsInAttribute(NODE_TYPE target,
String attribute)
Returns the existing targets in the value of `attribute` of the given `target`.
|
Set<NODE_TYPE> |
getTestsForTarget(NODE_TYPE target)
Returns the tests associated with the given target.
|
Set<NODE_TYPE> |
getTransitiveClosure(Set<NODE_TYPE> targets)
Returns the forward transitive closure of all of the targets in "targets".
|
Set<NODE_TYPE> |
resolveTargetVariable(String name) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachFwdDep, getTargetsMatchingPattern
public TargetVariablesQueryEnvironment(com.google.common.collect.ImmutableMap<String,Set<NODE_TYPE>> targetVariables, QueryEnvironment<NODE_TYPE> delegate)
public QueryEnvironment.TargetEvaluator getTargetEvaluator()
QueryEnvironment
getTargetEvaluator
in interface QueryEnvironment<NODE_TYPE>
public Set<NODE_TYPE> getFwdDeps(Iterable<NODE_TYPE> targets) throws QueryException
QueryEnvironment
getFwdDeps
in interface QueryEnvironment<NODE_TYPE>
QueryException
public Set<NODE_TYPE> getReverseDeps(Iterable<NODE_TYPE> targets) throws QueryException
QueryEnvironment
getReverseDeps
in interface QueryEnvironment<NODE_TYPE>
QueryException
public Set<QueryFileTarget> getInputs(NODE_TYPE target) throws QueryException
getInputs
in interface QueryEnvironment<NODE_TYPE>
QueryException
public Set<NODE_TYPE> getTransitiveClosure(Set<NODE_TYPE> targets) throws QueryException
QueryEnvironment
QueryEnvironment.buildTransitiveClosure(java.util.Set<? extends com.facebook.buck.core.model.QueryTarget>, int)
has been called for the relevant subgraph.getTransitiveClosure
in interface QueryEnvironment<NODE_TYPE>
QueryException
public void buildTransitiveClosure(Set<? extends QueryTarget> targetNodes, int maxDepth) throws QueryException
QueryEnvironment
If a larger transitive closure was already built, returns it to improve incrementality, since all depth-constrained methods filter it after it is built anyway.
buildTransitiveClosure
in interface QueryEnvironment<NODE_TYPE>
QueryException
public String getTargetKind(NODE_TYPE target) throws QueryException
getTargetKind
in interface QueryEnvironment<NODE_TYPE>
QueryException
public Set<NODE_TYPE> getTestsForTarget(NODE_TYPE target) throws QueryException
QueryEnvironment
getTestsForTarget
in interface QueryEnvironment<NODE_TYPE>
QueryException
public Set<QueryFileTarget> getBuildFiles(Set<NODE_TYPE> targets) throws QueryException
QueryEnvironment
getBuildFiles
in interface QueryEnvironment<NODE_TYPE>
QueryException
public Set<NODE_TYPE> getFileOwners(com.google.common.collect.ImmutableList<String> files) throws QueryException
QueryEnvironment
getFileOwners
in interface QueryEnvironment<NODE_TYPE>
QueryException
public Set<? extends QueryTarget> getTargetsInAttribute(NODE_TYPE target, String attribute) throws QueryException
QueryEnvironment
Note that unlike most methods in this interface, this method can return a heterogeneous
collection of objects that implement QueryTarget
.
getTargetsInAttribute
in interface QueryEnvironment<NODE_TYPE>
QueryException
public Set<Object> filterAttributeContents(NODE_TYPE target, String attribute, java.util.function.Predicate<Object> predicate) throws QueryException
QueryEnvironment
filterAttributeContents
in interface QueryEnvironment<NODE_TYPE>
QueryException
public Iterable<QueryEnvironment.QueryFunction<?,NODE_TYPE>> getFunctions()
QueryEnvironment
getFunctions
in interface QueryEnvironment<NODE_TYPE>
public Set<NODE_TYPE> resolveTargetVariable(String name)
resolveTargetVariable
in interface QueryEnvironment<NODE_TYPE>
QueryTarget
s expanded from the given variable name
.