public final class JSModuleGraph
extends java.lang.Object
implements java.io.Serializable
JSModule
dependency graph that assigns a depth to each module and can answer
depth-related queries about them. For the purposes of this class, a module's depth is defined as
the number of hops in the longest (non cyclic) path from the module to a module with no
dependencies.Modifier and Type | Class and Description |
---|---|
static class |
JSModuleGraph.MissingModuleException
Another exception class
|
protected static class |
JSModuleGraph.ModuleDependenceException
Exception class for declaring when the modules being fed into a
JSModuleGraph as input aren't in dependence order, and so can't be
processed for caching of various dependency-related queries.
|
Constructor and Description |
---|
JSModuleGraph(JSModule[] modulesInDepOrder)
Creates a module graph from a list of modules in dependency order.
|
JSModuleGraph(java.util.List<JSModule> modulesInDepOrder)
Creates a module graph from a list of modules in dependency order.
|
Modifier and Type | Method and Description |
---|---|
void |
breakThisGraphSoItsModulesCanBeReused()
Deprecated.
Fix the tests that use this.
|
boolean |
dependsOn(JSModule src,
JSModule m)
Determines whether this module depends on a given module.
|
JSModule |
getDeepestCommonDependencyInclusive(java.util.Collection<JSModule> modules)
Returns the deepest common dependency of the given modules.
|
JSModule |
getDeepestCommonDependencyInclusive(JSModule m1,
JSModule m2)
Finds the deepest common dependency of two modules, including the
modules themselves.
|
JSModule |
getSmallestCoveringSubtree(JSModule parentTree,
java.util.BitSet dependentModules)
Finds the module with the fewest transitive dependents on which all of the given modules depend
and that is a subtree of the given parent module tree.
|
com.google.common.collect.ImmutableList<CompilerInput> |
manageDependencies(DependencyOptions dependencyOptions)
Apply the dependency options to the list of sources, returning a new source list re-ordering
and dropping files as necessary.
|
public JSModuleGraph(JSModule[] modulesInDepOrder)
public JSModuleGraph(java.util.List<JSModule> modulesInDepOrder)
@Deprecated public void breakThisGraphSoItsModulesCanBeReused()
public boolean dependsOn(JSModule src, JSModule m)
public JSModule getSmallestCoveringSubtree(JSModule parentTree, java.util.BitSet dependentModules)
If no such subtree can be found, the parent module is returned.
If multiple candidates have the same number of dependents, the module farthest down in the total ordering of modules will be chosen.
parentTree
- module on which the result must dependdependentModules
- indices of modules to considerpublic JSModule getDeepestCommonDependencyInclusive(JSModule m1, JSModule m2)
m1
- A module in this graphm2
- A module in this graphm1
and m2
, or null if
they have no common dependenciespublic JSModule getDeepestCommonDependencyInclusive(java.util.Collection<JSModule> modules)
public com.google.common.collect.ImmutableList<CompilerInput> manageDependencies(DependencyOptions dependencyOptions) throws SortedDependencies.MissingProvideException, JSModuleGraph.MissingModuleException
See DependencyOptions
for more information on how this works.
SortedDependencies.MissingProvideException
- if an entry point was not provided by any of the inputs.JSModuleGraph.MissingModuleException
Copyright © 2009-2019 Google. All Rights Reserved.