public interface BuildRule extends Comparable<BuildRule>, AllowsNonAnnotatedFields, BuildEngineAction, HasNameAndType
Modifier and Type | Method and Description |
---|---|
default int |
compareTo(BuildRule that) |
SortedSet<BuildRule> |
getBuildDeps() |
com.google.common.collect.ImmutableList<? extends Step> |
getBuildSteps(BuildContext context,
BuildableContext buildableContext) |
BuildTarget |
getBuildTarget() |
default String |
getFullyQualifiedName() |
ProjectFilesystem |
getProjectFilesystem() |
SourcePath |
getSourcePathToOutput() |
boolean |
hasBuildSteps()
Whether this
BuildRule may have any steps to build. |
boolean |
isCacheable()
Whether this
BuildRule can be cached. |
default boolean |
outputFileCanBeCopied() |
default boolean |
shouldRespectInputSizeLimitForRemoteExecution() |
String |
toString() |
void |
updateBuildRuleResolver(BuildRuleResolver ruleResolver)
Updates the BuildRuleResolver and associated objects for this build rule.
|
getDependencies, getSourcePathOutputs
getType
BuildTarget getBuildTarget()
getBuildTarget
in interface BuildEngineAction
BuildTarget
of the rule corresponding to this actiondefault String getFullyQualifiedName()
getFullyQualifiedName
in interface HasNameAndType
SortedSet<BuildRule> getBuildDeps()
deps
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.
String toString()
toString
in class Object
getFullyQualifiedName()
com.google.common.collect.ImmutableList<? extends Step> getBuildSteps(BuildContext context, BuildableContext buildableContext)
@Nullable SourcePath getSourcePathToOutput()
default boolean outputFileCanBeCopied()
buck build --out
. To
be compatible, that means (1) getSourcePathToOutput()
cannot return null
,
and (2) the output file works as intended when copied to an arbitrary path (i.e., does not
have any dependencies on relative symlinks).ProjectFilesystem getProjectFilesystem()
boolean isCacheable()
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
boolean hasBuildSteps()
BuildRule
may have any steps to build.default int compareTo(BuildRule that)
compareTo
in interface Comparable<BuildRule>
void updateBuildRuleResolver(BuildRuleResolver ruleResolver)
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.
default boolean shouldRespectInputSizeLimitForRemoteExecution()
shouldRespectInputSizeLimitForRemoteExecution
in interface BuildEngineAction