Class DependencyOptions

java.lang.Object
com.google.javascript.jscomp.DependencyOptions
All Implemented Interfaces:
Serializable

public class DependencyOptions extends Object implements Serializable
Options for how to manage dependencies between input files. Dependency information is usually pulled out from the JS code by looking for primitive dependency functions (like Closure Library's goog.provide/goog.require). Analysis of this dependency information is controlled by CodingConvention, which lets you define those dependency primitives. This options class determines how we use that dependency information to change how code is built.
See Also:
  • Constructor Details

    • DependencyOptions

      public DependencyOptions()
  • Method Details

    • setDependencySorting

      public DependencyOptions setDependencySorting(boolean enabled)
      Enables or disables dependency sorting mode. If true, we will sort the input files based on dependency information in them. Otherwise, we will use the order of files specified on the command-line.
      Returns:
      this for easy building.
    • setDependencyPruning

      public DependencyOptions setDependencyPruning(boolean enabled)
      Enables or disables dependency pruning mode. In dependency pruning mode, we will look for all files that provide a symbol. Unless that file is a transitive dependency of a file that we're using, we will remove it from the compilation job. This does not affect how we handle files that do not provide symbols. See setMoocherDropping for information on how these are handled.
      Returns:
      this for easy chaining.
    • setMoocherDropping

      public DependencyOptions setMoocherDropping(boolean enabled)
      Enables or disables moocher dropping mode. A 'moocher' is a file that does not provide any symbols (though they may require symbols). This is usually because they don't want to tie themselves to a particular dependency system (e.g., Closure's goog.provide, CommonJS modules). So they rely on other people to manage dependencies on them. If true, we drop these files when we prune dependencies. If false, we always keep these files an anything they depend on. The default is false. Notice that this option only makes sense if dependency pruning is on, and a set of entry points is specified.
      Returns:
      this for easy chaining.
    • setEntryPoints

      public DependencyOptions setEntryPoints(Collection<String> symbols)
      Adds a collection of symbols to always keep. In dependency pruning mode, we will automatically keep all the transitive dependencies of these symbols. The syntactic form of a symbol depends on the type of dependency primitives we're using. For example, goog.provide('foo.bar') provides the symbol 'foo.bar'. Entry points can be scoped to a module by specifying 'mod2:foo.bar'.
      Returns:
      this for easy chaining.