Class DefaultDependencyResolver
java.lang.Object
com.google.javascript.jscomp.deps.DefaultDependencyResolver
- All Implemented Interfaces:
DependencyResolver
Class for resolving Closure dependencies.
Given a valid deps.js file the dependency tree is parsed and stored in
memory. The DependencyResolver can then be used to calculate the full list of
transitive dependencies from: a block of code (
getDependencies(String)), or a list of symbols
getDependencies(Collection).-
Constructor Summary
ConstructorsConstructorDescriptionDefaultDependencyResolver(List<DependencyFile> depsFiles, boolean strictRequires) Creates a new dependency resolver. -
Method Summary
Modifier and TypeMethodDescriptiongetDependencies(String code) Gets a list of dependencies for the provided code.getDependencies(String code, Set<String> seen, boolean addClosureBaseFile) getDependencies(Collection<String> symbols) Gets a list of dependencies for the provided list of symbols.getDependencies(Collection<String> symbols, Set<String> seen)
-
Constructor Details
-
DefaultDependencyResolver
Creates a new dependency resolver.- Parameters:
depsFiles- List of deps file.strictRequires- Determines if the resolver will through an exception on a missing dependency.
-
-
Method Details
-
getDependencies
Gets a list of dependencies for the provided code.- Specified by:
getDependenciesin interfaceDependencyResolver- Throws:
ServiceException
-
getDependencies
Gets a list of dependencies for the provided list of symbols.- Specified by:
getDependenciesin interfaceDependencyResolver- Throws:
ServiceException
-
getDependencies
public List<String> getDependencies(String code, Set<String> seen, boolean addClosureBaseFile) throws ServiceException - Specified by:
getDependenciesin interfaceDependencyResolver- Parameters:
code- The raw code to be parsed for requires.seen- The set of already seen symbols.addClosureBaseFile- Indicates whether the closure base file should be added to the dependency list.- Returns:
- A list of filenames for each of the dependencies for the provided code.
- Throws:
ServiceException
-
getDependencies
public List<String> getDependencies(Collection<String> symbols, Set<String> seen) throws ServiceException - Specified by:
getDependenciesin interfaceDependencyResolver- Parameters:
symbols- A list of required symbols.seen- The set of already seen symbols.- Returns:
- A list of filenames for each of the required symbols.
- Throws:
ServiceException
-