Class DepsGenerator
- java.lang.Object
-
- com.google.javascript.jscomp.deps.DepsGenerator
-
public class DepsGenerator extends java.lang.ObjectGenerates deps.js files by scanning JavaScript files for calls to goog.provide(), goog.require() and goog.addDependency().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDepsGenerator.InclusionStrategy
-
Constructor Summary
Constructors Constructor Description DepsGenerator(java.util.Collection<SourceFile> deps, java.util.Collection<SourceFile> srcs, DepsGenerator.InclusionStrategy mergeStrategy, java.lang.String closurePathAbs, ErrorManager errorManager, ModuleLoader loader)Creates a new DepsGenerator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanUpDuplicatedFiles(java.util.Map<java.lang.String,DependencyInfo> depsFiles, java.util.Map<java.lang.String,DependencyInfo> jsFiles)Removes duplicated depsInfo from jsFiles if this info already present in some of the parsed deps.jsjava.lang.StringcomputeDependencyCalls()Performs the parsing inputs and writing of outputs.protected DepsFileRegexParsercreateDepsFileParser()protected java.lang.StringformatPathToDepsFile(java.lang.String path)Format the deps file path so that it can be included in the output file.protected booleanshouldSkipDepsFile(SourceFile file)Returns whether we should ignore dependency info in the given deps file.
-
-
-
Constructor Detail
-
DepsGenerator
public DepsGenerator(java.util.Collection<SourceFile> deps, java.util.Collection<SourceFile> srcs, DepsGenerator.InclusionStrategy mergeStrategy, java.lang.String closurePathAbs, ErrorManager errorManager, ModuleLoader loader)
Creates a new DepsGenerator.
-
-
Method Detail
-
computeDependencyCalls
public java.lang.String computeDependencyCalls() throws java.io.IOExceptionPerforms the parsing inputs and writing of outputs.- Returns:
- Returns a String of goog.addDependency calls that will build the dependency graph. Returns null if there was an error.
- Throws:
java.io.IOException- Occurs upon an IO error.
-
cleanUpDuplicatedFiles
protected void cleanUpDuplicatedFiles(java.util.Map<java.lang.String,DependencyInfo> depsFiles, java.util.Map<java.lang.String,DependencyInfo> jsFiles)
Removes duplicated depsInfo from jsFiles if this info already present in some of the parsed deps.js- Parameters:
depsFiles- DepsInfo from deps.js dependenciesjsFiles- DepsInfo from some of jsSources
-
createDepsFileParser
protected DepsFileRegexParser createDepsFileParser()
-
shouldSkipDepsFile
protected boolean shouldSkipDepsFile(SourceFile file)
Returns whether we should ignore dependency info in the given deps file.
-
formatPathToDepsFile
protected java.lang.String formatPathToDepsFile(java.lang.String path)
Format the deps file path so that it can be included in the output file.
-
-