@Immutable
public abstract class DependencyOptions
extends java.lang.Object
implements java.io.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.
Modifier and Type | Class and Description |
---|---|
static class |
DependencyOptions.DependencyMode
Describes how the compiler should manage dependencies.
|
Constructor and Description |
---|
DependencyOptions() |
Modifier and Type | Method and Description |
---|---|
static DependencyOptions |
fromFlags(DependencyOptions.DependencyMode dependencyModeFlag,
java.util.List<java.lang.String> entryPointFlag,
java.util.List<java.lang.String> closureEntryPointFlag,
java.lang.String commonJsEntryModuleFlag,
boolean manageClosureDependenciesFlag,
boolean onlyClosureDependenciesFlag)
A helper function for validating dependency management flags and converting them into a
DependencyOptions object. |
abstract com.google.common.collect.ImmutableList<ModuleIdentifier> |
getEntryPoints()
Returns the list of explicit entry points.
|
abstract DependencyOptions.DependencyMode |
getMode()
Returns the dependency management mode.
|
boolean |
needsManagement()
Returns whether dependency management is enabled.
|
static DependencyOptions |
none()
Returns a
DependencyOptions using the DependencyOptions.DependencyMode.NONE mode. |
static DependencyOptions |
pruneForEntryPoints(java.lang.Iterable<ModuleIdentifier> entryPoints)
Returns a
DependencyOptions using the DependencyOptions.DependencyMode.PRUNE mode with the given
entry points. |
static DependencyOptions |
pruneLegacyForEntryPoints(java.lang.Iterable<ModuleIdentifier> entryPoints)
Deprecated.
Prefer
pruneForEntryPoints(Iterable) with a complete list of entry points. |
boolean |
shouldDropMoochers()
Returns whether moochers should be dropped.
|
boolean |
shouldPrune()
Returns whether files should be pruned.
|
boolean |
shouldSort()
Returns whether files should be sorted.
|
static DependencyOptions |
sortOnly()
Returns a
DependencyOptions using the DependencyOptions.DependencyMode.SORT_ONLY mode. |
public abstract DependencyOptions.DependencyMode getMode()
public abstract com.google.common.collect.ImmutableList<ModuleIdentifier> getEntryPoints()
public boolean needsManagement()
public boolean shouldSort()
If true, the input files should be sorted in dependency order. Otherwise, input files should not be reordered.
public boolean shouldPrune()
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.
public boolean shouldDropMoochers()
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.
public static DependencyOptions none()
DependencyOptions
using the DependencyOptions.DependencyMode.NONE
mode.public static DependencyOptions sortOnly()
DependencyOptions
using the DependencyOptions.DependencyMode.SORT_ONLY
mode.@Deprecated public static DependencyOptions pruneLegacyForEntryPoints(java.lang.Iterable<ModuleIdentifier> entryPoints)
pruneForEntryPoints(Iterable)
with a complete list of entry points.DependencyOptions
using the DependencyOptions.DependencyMode.PRUNE_LEGACY
mode with the
given entry points.public static DependencyOptions pruneForEntryPoints(java.lang.Iterable<ModuleIdentifier> entryPoints)
DependencyOptions
using the DependencyOptions.DependencyMode.PRUNE
mode with the given
entry points.@Nullable public static DependencyOptions fromFlags(@Nullable DependencyOptions.DependencyMode dependencyModeFlag, java.util.List<java.lang.String> entryPointFlag, java.util.List<java.lang.String> closureEntryPointFlag, java.lang.String commonJsEntryModuleFlag, boolean manageClosureDependenciesFlag, boolean onlyClosureDependenciesFlag)
DependencyOptions
object.
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.
Copyright © 2009-2020 Google. All Rights Reserved.