@GwtIncompatible(value="java.util.regex") public final class DepsFileParser extends JsFileLineParser
See //javascript/closure/deps.js for an example file.
PARSE_ERROR
Constructor and Description |
---|
DepsFileParser(ErrorManager errorManager)
Constructor
|
DepsFileParser(com.google.common.base.Function<java.lang.String,java.lang.String> pathTranslator,
ErrorManager errorManager) |
Modifier and Type | Method and Description |
---|---|
java.util.List<DependencyInfo> |
parseFile(java.lang.String filePath)
Parses the given file and returns a list of dependency information that it
contained.
|
java.util.List<DependencyInfo> |
parseFile(java.lang.String filePath,
java.lang.String fileContents)
Parses the given file and returns a list of dependency information that it
contained.
|
java.util.List<DependencyInfo> |
parseFileReader(java.lang.String filePath,
java.io.Reader reader)
Parses the file from the given reader and returns a list of
dependency information that it contained.
|
protected boolean |
parseLine(java.lang.String line)
Extracts dependency information from lines that look like
goog.addDependency('pathRelativeToClosure', ['provides'], ['requires']);
Adds the dependencies to depInfos.
|
didParseSucceed, setShortcutMode
public DepsFileParser(ErrorManager errorManager)
errorManager
- Handles parse errors.public DepsFileParser(com.google.common.base.Function<java.lang.String,java.lang.String> pathTranslator, ErrorManager errorManager)
pathTranslator
- Translates paths in different build systems.errorManager
- Handles parse errors.public java.util.List<DependencyInfo> parseFile(java.lang.String filePath) throws java.io.IOException
filePath
- Path to the file to parse.java.io.IOException
- Thrown if the file could not be read.public java.util.List<DependencyInfo> parseFile(java.lang.String filePath, java.lang.String fileContents)
filePath
- Path to the file to parse.fileContents
- The contents to parse.public java.util.List<DependencyInfo> parseFileReader(java.lang.String filePath, java.io.Reader reader)
filePath
- Path to the file to parse.reader
- A reader for the file.protected boolean parseLine(java.lang.String line) throws com.google.javascript.jscomp.deps.JsFileLineParser.ParseException
line
- The line to parse.ParseException
- Thrown if the given line has a malformed
goog.addDependency().com.google.javascript.jscomp.deps.JsFileLineParser.ParseException
Copyright © 2009-2017 Google. All Rights Reserved.