public final class JSModule extends java.lang.Object implements DependencyInfo, java.io.Serializable
DependencyInfo.Base
Modifier and Type | Field and Description |
---|---|
(package private) static DiagnosticType |
CIRCULAR_DEPENDENCY_ERROR |
private java.util.List<JSModule> |
deps
Modules that this module depends on
|
private int |
depth |
private java.util.List<CompilerInput> |
inputs
Source code inputs
|
private java.lang.String |
name
Module name
|
private static long |
serialVersionUID |
Constructor and Description |
---|
JSModule(java.lang.String name)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(CompilerInput input)
Adds a source code input to this module.
|
void |
add(SourceFile file)
Adds a source file input to this module.
|
void |
addAfter(CompilerInput input,
CompilerInput other)
Adds a source code input to this module directly after other.
|
(package private) void |
addAndOverrideModule(CompilerInput input)
Adds a source code input to this module.
|
void |
addDependency(JSModule dep)
Adds a dependency on another module.
|
void |
clearAsts()
Removes any references to nodes of the AST.
|
java.util.Set<JSModule> |
getAllDependencies()
Returns the transitive closure of dependencies starting from the
dependencies of this module.
|
CompilerInput |
getByName(java.lang.String name)
Returns the input with the given name or null if none.
|
java.util.List<JSModule> |
getDependencies()
Gets the list of modules that this module depends on.
|
int |
getDepth() |
java.util.List<CompilerInput> |
getInputs()
Gets this module's list of source code inputs.
|
com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> |
getLoadFlags()
Gets the loading information for this file.
|
java.lang.String |
getName()
Gets the module name.
|
java.lang.String |
getPathRelativeToClosureBase()
Gets the path of this file relative to Closure's base.js file.
|
java.util.List<java.lang.String> |
getProvides()
Gets the symbols provided by this file.
|
java.util.List<java.lang.String> |
getRequires()
Gets the symbols required by this file.
|
(package private) java.util.List<java.lang.String> |
getSortedDependencyNames()
Gets the names of the modules that this module depends on,
sorted alphabetically.
|
java.util.Set<JSModule> |
getThisAndAllDependencies()
Returns this module and all of its dependencies in one list.
|
boolean |
isModule()
Whether the symbol is provided by a module
|
void |
remove(CompilerInput input)
Removes an input from this module.
|
void |
removeAll()
Removes all of the inputs from this module.
|
boolean |
removeByName(java.lang.String name)
Removes any input with the given name.
|
void |
setDepth(int dep) |
void |
sortInputsByDeps(Compiler compiler)
Puts the JS files into a topologically sorted order by their dependencies.
|
java.lang.String |
toString()
Returns the module name (primarily for debugging).
|
private static final long serialVersionUID
static final DiagnosticType CIRCULAR_DEPENDENCY_ERROR
private final java.lang.String name
private final java.util.List<CompilerInput> inputs
private final java.util.List<JSModule> deps
private int depth
public JSModule(java.lang.String name)
name
- A unique name for the modulepublic java.lang.String getName()
getName
in interface DependencyInfo
public java.util.List<java.lang.String> getProvides()
DependencyInfo
getProvides
in interface DependencyInfo
public java.util.List<java.lang.String> getRequires()
DependencyInfo
getRequires
in interface DependencyInfo
public java.lang.String getPathRelativeToClosureBase()
DependencyInfo
getPathRelativeToClosureBase
in interface DependencyInfo
public com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> getLoadFlags()
DependencyInfo
getLoadFlags
in interface DependencyInfo
public boolean isModule()
DependencyInfo
isModule
in interface DependencyInfo
public void add(SourceFile file)
public void add(CompilerInput input)
void addAndOverrideModule(CompilerInput input)
public void addAfter(CompilerInput input, CompilerInput other)
public void addDependency(JSModule dep)
public void remove(CompilerInput input)
public void removeAll()
public java.util.List<JSModule> getDependencies()
java.util.List<java.lang.String> getSortedDependencyNames()
public java.util.Set<JSModule> getAllDependencies()
public java.util.Set<JSModule> getThisAndAllDependencies()
public java.util.List<CompilerInput> getInputs()
public CompilerInput getByName(java.lang.String name)
public boolean removeByName(java.lang.String name)
public java.lang.String toString()
toString
in class java.lang.Object
public void clearAsts()
public void sortInputsByDeps(Compiler compiler)
public void setDepth(int dep)
dep
- the depth to setpublic int getDepth()