public abstract class AbstractBuildRule extends Object implements BuildRule
BuildRule
that can be cached. If its current RuleKey
matches the one on disk, then it has no work to do. It should also try to fetch its output from
an ArtifactCache
to avoid doing any computation.Modifier | Constructor and Description |
---|---|
protected |
AbstractBuildRule(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
BuildTarget |
getBuildTarget() |
com.google.common.collect.ImmutableSet<BuildTarget> |
getDependencies() |
ProjectFilesystem |
getProjectFilesystem() |
com.google.common.collect.ImmutableSet<SourcePath> |
getSourcePathOutputs() |
String |
getType() |
boolean |
hasBuildSteps()
Whether this
BuildRule may have any steps to build. |
int |
hashCode() |
protected static void |
injectFields(AbstractBuildRule rule,
ProjectFilesystem filesystem,
BuildTarget target)
Allows setting the fields after creation.
|
boolean |
isCacheable()
Whether this
BuildRule can be cached. |
String |
toString() |
void |
updateBuildRuleResolver(BuildRuleResolver ruleResolver)
Updates the BuildRuleResolver and associated objects for this build rule.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compareTo, getBuildDeps, getBuildSteps, getFullyQualifiedName, getSourcePathToOutput, outputFileCanBeCopied, shouldRespectInputSizeLimitForRemoteExecution
protected AbstractBuildRule(BuildTarget buildTarget, ProjectFilesystem projectFilesystem)
protected static void injectFields(AbstractBuildRule rule, ProjectFilesystem filesystem, BuildTarget target)
public final BuildTarget getBuildTarget()
getBuildTarget
in interface BuildEngineAction
getBuildTarget
in interface BuildRule
BuildTarget
of the rule corresponding to this actionpublic final ProjectFilesystem getProjectFilesystem()
getProjectFilesystem
in interface BuildRule
public String getType()
getType
in interface HasNameAndType
public boolean isCacheable()
BuildRule
BuildRule
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 BuildEngineAction
isCacheable
in interface BuildRule
public boolean hasBuildSteps()
BuildRule
BuildRule
may have any steps to build.hasBuildSteps
in interface BuildRule
public void updateBuildRuleResolver(BuildRuleResolver ruleResolver)
BuildRule
Build rules sometimes hold field references to build rule resolvers. If this build rule is to be cached, it must update its BuildRuleResolver when a new action graph is constructed to avoid leaking the entire action graph it was originally associated with.
updateBuildRuleResolver
in interface BuildRule
public final String toString()
toString
in interface BuildRule
toString
in class Object
BuildRule.getFullyQualifiedName()
public com.google.common.collect.ImmutableSet<BuildTarget> getDependencies()
getDependencies
in interface BuildEngineAction
BuildEngineAction
to build, as
identified by the BuildTarget
.public com.google.common.collect.ImmutableSet<SourcePath> getSourcePathOutputs()
getSourcePathOutputs
in interface BuildEngineAction
BuildEngineAction
builds. This is here for legacy as
BuildRules deal with SourcePath