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.
|
java.util.List<CompilerInput> |
manageDependencies(DependencyOptions depOptions,
java.util.List<CompilerInput> inputs)
Apply the dependency options to the list of sources, returning a new
source list re-ordering and dropping files as necessary.
|
java.util.List<CompilerInput> |
manageDependencies(java.util.List<ModuleIdentifier> entryPoints,
java.util.List<CompilerInput> inputs)
Applies a DependencyOptions in "dependency sorting" and "dependency pruning"
mode to the given list of inputs.
|
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 java.util.List<CompilerInput> manageDependencies(java.util.List<ModuleIdentifier> entryPoints, java.util.List<CompilerInput> inputs) throws JSModuleGraph.MissingModuleException, SortedDependencies.MissingProvideException
manageDependencies(DependencyOptions, List<CompilerInput>)
.entryPoints
- The entry points into the program.
Expressed as JS symbols.inputs
- The original list of sources. Used to ensure that the sort
is stable.SortedDependencies.MissingProvideException
- if an entry point was not provided
by any of the inputs.JSModuleGraph.MissingModuleException
for more info on how this works.
public java.util.List<CompilerInput> manageDependencies(DependencyOptions depOptions, java.util.List<CompilerInput> inputs) throws SortedDependencies.MissingProvideException, JSModuleGraph.MissingModuleException
inputs
- The original list of sources. Used to ensure that the sort
is stable.SortedDependencies.MissingProvideException
- if an entry point was not provided
by any of the inputs.JSModuleGraph.MissingModuleException
for more info on how this works.
Copyright © 2009-2017 Google. All Rights Reserved.