public class GraphEnhancementQueryEnvironment extends Object implements QueryEnvironment<QueryBuildTarget>
The query environment supports the following functions
attrfilter deps inputs except inputs intersect filter kind rdeps set unionThis query environment will only parse literal targets or the special macro '$declared_deps', so aliases and other patterns (such as ...) will throw an exception. The $declared_deps macro will evaluate to the declared dependencies passed into the constructor.
QueryEnvironment.Argument<ENV_NODE_TYPE>, QueryEnvironment.ArgumentType, QueryEnvironment.QueryFunction<OUTPUT_TYPE extends QueryTarget,ENV_NODE_TYPE>
Modifier and Type | Field and Description |
---|---|
static Iterable<QueryEnvironment.QueryFunction<? extends QueryTarget,QueryBuildTarget>> |
QUERY_FUNCTIONS |
Constructor and Description |
---|
GraphEnhancementQueryEnvironment(Optional<ActionGraphBuilder> graphBuilder,
Optional<TargetGraph> targetGraph,
TypeCoercerFactory typeCoercerFactory,
CellNameResolver cellNames,
UnconfiguredBuildTargetViewFactory unconfiguredBuildTargetFactory,
BaseName targetBaseName,
Set<BuildTarget> declaredDeps,
TargetConfiguration targetConfiguration) |
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".
|
com.google.common.collect.ImmutableSet<Object> |
filterAttributeContents(QueryBuildTarget target,
String attribute,
java.util.function.Predicate<Object> predicate)
Returns the objects in the `attribute` of the given `target` that satisfy `predicate`
|
void |
forEachFwdDep(Iterable<QueryBuildTarget> targets,
java.util.function.Consumer<QueryBuildTarget> action)
Applies
action to each forward dependencies of the specified targets. |
com.google.common.collect.ImmutableSet<QueryFileTarget> |
getBuildFiles(Set<QueryBuildTarget> targets)
Returns the build files that define the given targets.
|
com.google.common.collect.ImmutableSet<QueryBuildTarget> |
getFileOwners(com.google.common.collect.ImmutableList<String> files)
Returns the targets that own one or more of the given files.
|
java.util.stream.Stream<QueryTarget> |
getFirstOrderClasspath(Set<QueryTarget> targets) |
Iterable<QueryEnvironment.QueryFunction<?,QueryBuildTarget>> |
getFunctions()
Returns the set of query functions implemented by this query environment.
|
com.google.common.collect.ImmutableSet<QueryBuildTarget> |
getFwdDeps(Iterable<QueryBuildTarget> targets)
Returns the direct forward dependencies of the specified targets.
|
Set<QueryFileTarget> |
getInputs(QueryBuildTarget target) |
Set<QueryBuildTarget> |
getReverseDeps(Iterable<QueryBuildTarget> targets)
Returns the direct reverse dependencies of the specified targets.
|
QueryEnvironment.TargetEvaluator |
getTargetEvaluator()
Returns an evaluator for target patterns.
|
String |
getTargetKind(QueryBuildTarget target) |
com.google.common.collect.ImmutableSet<? extends QueryTarget> |
getTargetsInAttribute(QueryBuildTarget target,
String attribute)
Returns the existing targets in the value of `attribute` of the given `target`.
|
com.google.common.collect.ImmutableSet<QueryBuildTarget> |
getTestsForTarget(QueryBuildTarget target)
Returns the tests associated with the given target.
|
Set<QueryBuildTarget> |
getTransitiveClosure(Set<QueryBuildTarget> targets)
Returns the forward transitive closure of all of the targets in "targets".
|
protected java.util.stream.Stream<QueryTarget> |
restrictToInstancesOf(Set<QueryTarget> targets,
Class<?> clazz) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTargetsMatchingPattern, resolveTargetVariable
public static final Iterable<QueryEnvironment.QueryFunction<? extends QueryTarget,QueryBuildTarget>> QUERY_FUNCTIONS
public GraphEnhancementQueryEnvironment(Optional<ActionGraphBuilder> graphBuilder, Optional<TargetGraph> targetGraph, TypeCoercerFactory typeCoercerFactory, CellNameResolver cellNames, UnconfiguredBuildTargetViewFactory unconfiguredBuildTargetFactory, BaseName targetBaseName, Set<BuildTarget> declaredDeps, TargetConfiguration targetConfiguration)
public QueryEnvironment.TargetEvaluator getTargetEvaluator()
QueryEnvironment
getTargetEvaluator
in interface QueryEnvironment<QueryBuildTarget>
public com.google.common.collect.ImmutableSet<QueryBuildTarget> getFwdDeps(Iterable<QueryBuildTarget> targets)
QueryEnvironment
getFwdDeps
in interface QueryEnvironment<QueryBuildTarget>
public void forEachFwdDep(Iterable<QueryBuildTarget> targets, java.util.function.Consumer<QueryBuildTarget> action)
QueryEnvironment
action
to each forward dependencies of the specified targets.
Might apply more than once to the same target, so action
should be idempotent.
forEachFwdDep
in interface QueryEnvironment<QueryBuildTarget>
public Set<QueryBuildTarget> getReverseDeps(Iterable<QueryBuildTarget> targets)
QueryEnvironment
getReverseDeps
in interface QueryEnvironment<QueryBuildTarget>
public Set<QueryFileTarget> getInputs(QueryBuildTarget target)
getInputs
in interface QueryEnvironment<QueryBuildTarget>
public Set<QueryBuildTarget> getTransitiveClosure(Set<QueryBuildTarget> targets)
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<QueryBuildTarget>
public void buildTransitiveClosure(Set<? extends QueryTarget> targetNodes, int maxDepth)
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<QueryBuildTarget>
public String getTargetKind(QueryBuildTarget target)
getTargetKind
in interface QueryEnvironment<QueryBuildTarget>
public com.google.common.collect.ImmutableSet<QueryBuildTarget> getTestsForTarget(QueryBuildTarget target)
QueryEnvironment
getTestsForTarget
in interface QueryEnvironment<QueryBuildTarget>
public com.google.common.collect.ImmutableSet<QueryFileTarget> getBuildFiles(Set<QueryBuildTarget> targets)
QueryEnvironment
getBuildFiles
in interface QueryEnvironment<QueryBuildTarget>
public com.google.common.collect.ImmutableSet<QueryBuildTarget> getFileOwners(com.google.common.collect.ImmutableList<String> files)
QueryEnvironment
getFileOwners
in interface QueryEnvironment<QueryBuildTarget>
public com.google.common.collect.ImmutableSet<? extends QueryTarget> getTargetsInAttribute(QueryBuildTarget target, String attribute)
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<QueryBuildTarget>
public com.google.common.collect.ImmutableSet<Object> filterAttributeContents(QueryBuildTarget target, String attribute, java.util.function.Predicate<Object> predicate)
QueryEnvironment
filterAttributeContents
in interface QueryEnvironment<QueryBuildTarget>
protected java.util.stream.Stream<QueryTarget> restrictToInstancesOf(Set<QueryTarget> targets, Class<?> clazz)
public java.util.stream.Stream<QueryTarget> getFirstOrderClasspath(Set<QueryTarget> targets)
public Iterable<QueryEnvironment.QueryFunction<?,QueryBuildTarget>> getFunctions()
QueryEnvironment
getFunctions
in interface QueryEnvironment<QueryBuildTarget>