public final class DependencyAggregation extends AbstractBuildRule implements HasRuntimeDeps
In cases where many rules require largely the same sets of dependencies, such as cxx compilation of files in a target, explicitly copying the dependencies to every such rule imposes slow down and memory usage proportional to the number of rules that share a dependency set. This class curtails the copying of all shared dependencies between rules, and instead allow each rule to depend on this single rule, which captures the shared dependencies.
This class is distinct from NoopBuildRuleWithDeclaredAndExtraDeps to make clear the
requirements for its operation, namely, that it cannot be cached. This rule must not be cached in
order for its dependencies to always be evaluated in different build strategies (in particular,
top-down).
| Constructor and Description |
|---|
DependencyAggregation(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
Iterable<BuildRule> deps) |
| Modifier and Type | Method and Description |
|---|---|
SortedSet<BuildRule> |
getBuildDeps() |
com.google.common.collect.ImmutableList<Step> |
getBuildSteps(BuildContext context,
BuildableContext buildableContext) |
java.util.stream.Stream<BuildTarget> |
getRuntimeDeps(BuildRuleResolver buildRuleResolver) |
SourcePath |
getSourcePathToOutput() |
boolean |
isCacheable()
Whether this
BuildRule can be cached. |
equals, getBuildTarget, getDependencies, getProjectFilesystem, getSourcePathOutputs, getType, hasBuildSteps, hashCode, injectFields, toString, updateBuildRuleResolverclone, finalize, getClass, notify, notifyAll, wait, wait, waitcompareTo, getBuildTarget, getFullyQualifiedName, getProjectFilesystem, hasBuildSteps, outputFileCanBeCopied, shouldRespectInputSizeLimitForRemoteExecution, toString, updateBuildRuleResolvergetDependencies, getSourcePathOutputsgetTypepublic DependencyAggregation(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, Iterable<BuildRule> deps)
public SortedSet<BuildRule> getBuildDeps()
getBuildDeps in interface BuildRuledeps argument for this build rule in the build file in which it was defined.
However, there are special cases where other arguments pull in implicit dependencies
(e.g., the keystore argument in android_binary). In these cases, the
implicit dependencies are also included in the set returned by this method. The value of
the original deps argument, as defined in the build file, must be accessed via a
custom getter provided by the build rule.
public com.google.common.collect.ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext)
getBuildSteps in interface BuildRule@Nullable public SourcePath getSourcePathToOutput()
getSourcePathToOutput in interface BuildRulepublic boolean isCacheable()
BuildRuleBuildRule can be cached.
Uncached build rules are never written out to cache, never read from cache, and does not count in cache statistics. This rule is useful for artifacts which cannot be easily normalized.
Uncached rules are not always rebuilt, however, as long as the existing on-disk
representation is up to date. This means that these rules can take advantage of SupportsInputBasedRuleKey to prevent rebuilding.
isCacheable in interface BuildEngineActionisCacheable in interface BuildRuleisCacheable in class AbstractBuildRulepublic java.util.stream.Stream<BuildTarget> getRuntimeDeps(BuildRuleResolver buildRuleResolver)
getRuntimeDeps in interface HasRuntimeDeps