Class DefaultDependencyResolver
- java.lang.Object
-
- com.google.javascript.jscomp.deps.DefaultDependencyResolver
-
- All Implemented Interfaces:
DependencyResolver
public final class DefaultDependencyResolver extends java.lang.Object implements 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 symbolsgetDependencies(Collection).
-
-
Constructor Summary
Constructors Constructor Description DefaultDependencyResolver(java.util.List<DependencyFile> depsFiles, boolean strictRequires)Creates a new dependency resolver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>getDependencies(java.lang.String code)Gets a list of dependencies for the provided code.java.util.List<java.lang.String>getDependencies(java.lang.String code, java.util.Set<java.lang.String> seen, boolean addClosureBaseFile)java.util.List<java.lang.String>getDependencies(java.util.Collection<java.lang.String> symbols)Gets a list of dependencies for the provided list of symbols.java.util.List<java.lang.String>getDependencies(java.util.Collection<java.lang.String> symbols, java.util.Set<java.lang.String> seen)
-
-
-
Constructor Detail
-
DefaultDependencyResolver
public DefaultDependencyResolver(java.util.List<DependencyFile> depsFiles, boolean strictRequires)
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 Detail
-
getDependencies
public java.util.List<java.lang.String> getDependencies(java.lang.String code) throws ServiceExceptionGets a list of dependencies for the provided code.- Specified by:
getDependenciesin interfaceDependencyResolver- Throws:
ServiceException
-
getDependencies
public java.util.List<java.lang.String> getDependencies(java.util.Collection<java.lang.String> symbols) throws ServiceExceptionGets a list of dependencies for the provided list of symbols.- Specified by:
getDependenciesin interfaceDependencyResolver- Throws:
ServiceException
-
getDependencies
public java.util.List<java.lang.String> getDependencies(java.lang.String code, java.util.Set<java.lang.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 java.util.List<java.lang.String> getDependencies(java.util.Collection<java.lang.String> symbols, java.util.Set<java.lang.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
-
-