Class DepsFileParser
java.lang.Object
com.google.javascript.jscomp.deps.JsFileLineParser
com.google.javascript.jscomp.deps.DepsFileParser
A parser that can extract dependency information from existing deps.js files.
See //javascript/closure/deps.js for an example file.
-
Constructor Summary
ConstructorsConstructorDescriptionDepsFileParser(com.google.common.base.Function<String, String> pathTranslator, ErrorManager errorManager) DepsFileParser(ErrorManager errorManager) Constructor -
Method Summary
Modifier and TypeMethodDescriptionParses the given file and returns a list of dependency information that it contained.Parses the given file and returns a list of dependency information that it contained.parseFileReader(String filePath, Reader reader) Parses the file from the given reader and returns a list of dependency information that it contained.protected booleanExtracts dependency information from lines that look like goog.addDependency('pathRelativeToClosure', ['provides'], ['requires']); Adds the dependencies to depInfos.Methods inherited from class com.google.javascript.jscomp.deps.JsFileLineParser
didParseSucceed, setShortcutMode
-
Constructor Details
-
DepsFileParser
Constructor- Parameters:
errorManager- Handles parse errors.
-
DepsFileParser
public DepsFileParser(com.google.common.base.Function<String, String> pathTranslator, ErrorManager errorManager) - Parameters:
pathTranslator- Translates paths in different build systems.errorManager- Handles parse errors.
-
-
Method Details
-
parseFile
Parses the given file and returns a list of dependency information that it contained.- Parameters:
filePath- Path to the file to parse.- Returns:
- A list of DependencyInfo objects.
- Throws:
IOException- Thrown if the file could not be read.
-
parseFile
Parses the given file and returns a list of dependency information that it contained. It uses the passed in fileContents instead of reading the file.- Parameters:
filePath- Path to the file to parse.fileContents- The contents to parse.- Returns:
- A list of DependencyInfo objects.
-
parseFileReader
Parses the file from the given reader and returns a list of dependency information that it contained.- Parameters:
filePath- Path to the file to parse.reader- A reader for the file.- Returns:
- A list of DependencyInfo objects.
-
parseLine
protected boolean parseLine(String line) throws com.google.javascript.jscomp.deps.JsFileLineParser.ParseException Extracts dependency information from lines that look like goog.addDependency('pathRelativeToClosure', ['provides'], ['requires']); Adds the dependencies to depInfos.- Throws:
com.google.javascript.jscomp.deps.JsFileLineParser.ParseException- Thrown if the given line has a malformed goog.addDependency().
-