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, waitcompareTo, getBuildDeps, getBuildSteps, getFullyQualifiedName, getSourcePathToOutput, outputFileCanBeCopied, shouldRespectInputSizeLimitForRemoteExecutionprotected AbstractBuildRule(BuildTarget buildTarget, ProjectFilesystem projectFilesystem)
protected static void injectFields(AbstractBuildRule rule, ProjectFilesystem filesystem, BuildTarget target)
public final BuildTarget getBuildTarget()
getBuildTarget in interface BuildEngineActiongetBuildTarget in interface BuildRuleBuildTarget of the rule corresponding to this actionpublic final ProjectFilesystem getProjectFilesystem()
getProjectFilesystem in interface BuildRulepublic String getType()
getType in interface HasNameAndTypepublic 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 BuildRulepublic boolean hasBuildSteps()
BuildRuleBuildRule may have any steps to build.hasBuildSteps in interface BuildRulepublic void updateBuildRuleResolver(BuildRuleResolver ruleResolver)
BuildRuleBuild 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 BuildRulepublic final String toString()
toString in interface BuildRuletoString in class ObjectBuildRule.getFullyQualifiedName()public com.google.common.collect.ImmutableSet<BuildTarget> getDependencies()
getDependencies in interface BuildEngineActionBuildEngineAction to build, as
identified by the BuildTarget.public com.google.common.collect.ImmutableSet<SourcePath> getSourcePathOutputs()
getSourcePathOutputs in interface BuildEngineActionBuildEngineAction builds. This is here for legacy as
BuildRules deal with SourcePath