com.google.javascript.jscomp.deps
Class DepsGenerator

java.lang.Object
  extended by com.google.javascript.jscomp.deps.DepsGenerator

public class DepsGenerator
extends Object

Generates deps.js files by scanning JavaScript files for calls to goog.provide(), goog.require() and goog.addDependency().


Nested Class Summary
static class DepsGenerator.InclusionStrategy
           
 
Constructor Summary
DepsGenerator(Collection<SourceFile> deps, Collection<SourceFile> srcs, DepsGenerator.InclusionStrategy mergeStrategy, String closurePathAbs, ErrorManager errorManager)
          Creates a new DepsGenerator.
 
Method Summary
protected  void cleanUpDuplicatedFiles(Map<String,DependencyInfo> depsFiles, Map<String,DependencyInfo> jsFiles)
          Removes duplicated depsInfo from jsFiles if this info already present in some of the parsed deps.js
 String computeDependencyCalls()
          Performs the parsing inputs and writing of outputs.
protected  DepsFileParser createDepsFileParser()
           
protected  String formatPathToDepsFile(String path)
          Format the deps file path so that it can be included in the output file.
protected  boolean shouldSkipDepsFile(SourceFile file)
          Returns whether we should ignore dependency info in the given deps file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DepsGenerator

public DepsGenerator(Collection<SourceFile> deps,
                     Collection<SourceFile> srcs,
                     DepsGenerator.InclusionStrategy mergeStrategy,
                     String closurePathAbs,
                     ErrorManager errorManager)
Creates a new DepsGenerator.

Method Detail

computeDependencyCalls

public String computeDependencyCalls()
                              throws IOException
Performs 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:
IOException - Occurs upon an IO error.

cleanUpDuplicatedFiles

protected void cleanUpDuplicatedFiles(Map<String,DependencyInfo> depsFiles,
                                      Map<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 dependencies
jsFiles - DepsInfo from some of jsSources

createDepsFileParser

protected DepsFileParser createDepsFileParser()

shouldSkipDepsFile

protected boolean shouldSkipDepsFile(SourceFile file)
Returns whether we should ignore dependency info in the given deps file.


formatPathToDepsFile

protected String formatPathToDepsFile(String path)
Format the deps file path so that it can be included in the output file.