Class DependencyOptions
- All Implemented Interfaces:
Serializable
Dependency information is pulled out from the JS code by looking for import and export primitives (like ES import and export statements, Closure Library's goog.module, goog.provide and goog.require calls, or CommonJS require calls). The compiler can optionally use this information to sort input files in dependency order and/or prune unnecessary input files.
Also see CodingConvention.extractClassNameIfProvide(Node, Node) and CodingConvention.extractClassNameIfRequire(Node, Node), which affect what the compiler considers
to be goog.provide and goog.require statements.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDescribes how the compiler should manage dependencies. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable DependencyOptionsfromFlags(@Nullable DependencyOptions.DependencyMode dependencyModeFlag, List<String> entryPointFlag, List<String> closureEntryPointFlag, String commonJsEntryModuleFlag, boolean manageClosureDependenciesFlag, boolean onlyClosureDependenciesFlag) A helper function for validating dependency management flags and converting them into aDependencyOptionsobject.abstract com.google.common.collect.ImmutableList<ModuleIdentifier> Returns the list of explicit entry points.abstract DependencyOptions.DependencyModegetMode()Returns the dependency management mode.booleanReturns whether dependency management is enabled.static DependencyOptionsnone()Returns aDependencyOptionsusing theDependencyOptions.DependencyMode.NONEmode.static DependencyOptionspruneAllowNoEntryPoints(Iterable<ModuleIdentifier> entryPoints) Returns aDependencyOptionsusing theDependencyOptions.DependencyMode.PRUNEmode with the given entry points.static DependencyOptionspruneForEntryPoints(Iterable<ModuleIdentifier> entryPoints) Returns aDependencyOptionsusing theDependencyOptions.DependencyMode.PRUNEmode with the given entry points.static DependencyOptionspruneLegacyForEntryPoints(Iterable<ModuleIdentifier> entryPoints) Deprecated.booleanReturns whether moochers should be dropped.booleanReturns whether files should be pruned.booleanReturns whether files should be sorted.static DependencyOptionssortOnly()Returns aDependencyOptionsusing theDependencyOptions.DependencyMode.SORT_ONLYmode.
-
Constructor Details
-
DependencyOptions
public DependencyOptions()
-
-
Method Details
-
getMode
Returns the dependency management mode. -
getEntryPoints
Returns the list of explicit entry points. -
needsManagement
public boolean needsManagement()Returns whether dependency management is enabled. -
shouldSort
public boolean shouldSort()Returns whether files should be sorted.If true, the input files should be sorted in dependency order. Otherwise, input files should not be reordered.
-
shouldPrune
public boolean shouldPrune()Returns whether files should be pruned.If true, an input file should be excluded from the compilation if it is not a transitive dependency of an entry point. Otherwise, all input files should be included.
-
shouldDropMoochers
public boolean shouldDropMoochers()Returns whether moochers should be dropped.A moocher is a strong file that does not goog.provide a namespace and is not a goog.module, ES module or CommonJS module. Weak files are never considered moochers.
If true, moochers should not be considered implicit entry points.
-
none
Returns aDependencyOptionsusing theDependencyOptions.DependencyMode.NONEmode. -
sortOnly
Returns aDependencyOptionsusing theDependencyOptions.DependencyMode.SORT_ONLYmode. -
pruneLegacyForEntryPoints
@Deprecated public static DependencyOptions pruneLegacyForEntryPoints(Iterable<ModuleIdentifier> entryPoints) Deprecated.PreferpruneForEntryPoints(Iterable)with a complete list of entry points.Returns aDependencyOptionsusing theDependencyOptions.DependencyMode.PRUNE_LEGACYmode with the given entry points. -
pruneAllowNoEntryPoints
Returns aDependencyOptionsusing theDependencyOptions.DependencyMode.PRUNEmode with the given entry points. -
pruneForEntryPoints
Returns aDependencyOptionsusing theDependencyOptions.DependencyMode.PRUNEmode with the given entry points. -
fromFlags
public static @Nullable DependencyOptions fromFlags(@Nullable DependencyOptions.DependencyMode dependencyModeFlag, List<String> entryPointFlag, List<String> closureEntryPointFlag, String commonJsEntryModuleFlag, boolean manageClosureDependenciesFlag, boolean onlyClosureDependenciesFlag) A helper function for validating dependency management flags and converting them into aDependencyOptionsobject.Returns null when no dependency management flags have been specified.
TODO(tjgq): Simplify this once we deprecate and remove all legacy flags and standardize on --dependency_mode and --entry_point.
-
pruneForEntryPoints(Iterable)with a complete list of entry points.