Class SortedDependencies<InputT extends DependencyInfo>
Orders such that each input always comes after its dependencies. Circular references are allowed by emitting the current input in the moment before a loop would complete.
The resulting order is not the same as the user-provided order but is influenced by it since it may take more than one graph traversal to account for all provided inputs and the graph traversals start with the first user provided input and continue from there.
Also exposes other information about the inputs, like which inputs do not provide symbols.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetInputProviding
(String symbolName) Return the input that gives us the given symbol.com.google.common.collect.ImmutableList
<InputT> com.google.common.collect.ImmutableList
<InputT> getSortedStrongDependenciesOf
(List<InputT> roots) Gets all the strong dependencies of the given roots.com.google.common.collect.ImmutableList
<InputT> getSortedWeakDependenciesOf
(List<InputT> rootInputs) Gets all the weak dependencies of the given roots.com.google.common.collect.ImmutableList
<InputT> getStrongDependenciesOf
(List<InputT> rootInputs, boolean sorted) Gets all the strong dependencies of the given roots.maybeGetInputProviding
(String symbol) Return the input that gives us the given symbol, or null.
-
Constructor Details
-
SortedDependencies
-
-
Method Details
-
getStrongDependenciesOf
public com.google.common.collect.ImmutableList<InputT> getStrongDependenciesOf(List<InputT> rootInputs, boolean sorted) Gets all the strong dependencies of the given roots. The inputs must be returned in a stable order. In other words, if A comes before B, and A does not transitively depend on B, then A must also come before B in the returned list.- Parameters:
sorted
- If true, get them in topologically sorted order. If false, get them in the original order they were passed to the compiler.
-
getInputProviding
public InputT getInputProviding(String symbolName) throws SortedDependencies.MissingProvideException Return the input that gives us the given symbol.- Throws:
SortedDependencies.MissingProvideException
- An exception if there is no input for this symbol.
-
getInputsWithoutProvides
-
getSortedStrongDependenciesOf
public com.google.common.collect.ImmutableList<InputT> getSortedStrongDependenciesOf(List<InputT> roots) Gets all the strong dependencies of the given roots. The inputs must be returned in a stable order. In other words, if A comes before B, and A does not transitively depend on B, then A must also come before B in the returned list. -
getSortedWeakDependenciesOf
public com.google.common.collect.ImmutableList<InputT> getSortedWeakDependenciesOf(List<InputT> rootInputs) Gets all the weak dependencies of the given roots. The inputs must be returned in stable order. In other words, if A comes before B, and A does not * transitively depend on B, then A must also come before B in the returned * list.The weak dependencies are those that are only reachable via type requires from the roots. Note that if a root weakly requires another input, then all of its transitive dependencies (strong or weak) that are not strongly reachable from the roots will be included. e.g. if A weakly requires B, and B strongly requires C, and A is the sole root, then this will return B and C. However, if we add D as a root, and D strongly requires C, then this will only return B.
Root inputs will never be in the returned list as they are all considered strong.
-
getSortedList
-
maybeGetInputProviding
Return the input that gives us the given symbol, or null.
-