public abstract class AbstractGenruleDescription<T extends AbstractGenruleDescription.CommonArg> extends Object implements DescriptionWithTargetGraph<T>, ImplicitDepsInferringDescription<T>
Modifier and Type | Class and Description |
---|---|
static interface |
AbstractGenruleDescription.CommonArg |
Modifier and Type | Field and Description |
---|---|
protected BuckConfig |
buckConfig |
protected boolean |
enableSandbox |
protected SandboxExecutionStrategy |
sandboxExecutionStrategy |
protected ToolchainProvider |
toolchainProvider |
Modifier | Constructor and Description |
---|---|
protected |
AbstractGenruleDescription(ToolchainProvider toolchainProvider,
BuckConfig buckConfig,
SandboxExecutionStrategy sandboxExecutionStrategy,
boolean enableSandbox) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canExecuteRemotely(T args) |
BuildRule |
createBuildRule(BuildRuleCreationContextWithTargetGraph context,
BuildTarget buildTarget,
BuildRuleParams params,
T args)
Create a
BuildRule for the given BuildRuleParams . |
protected abstract BuildRule |
createBuildRule(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
BuildRuleParams params,
ActionGraphBuilder graphBuilder,
T args,
Optional<Arg> cmd,
Optional<Arg> bash,
Optional<Arg> cmdExe) |
protected BuildRule |
createBuildRule(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
BuildRuleResolver resolver,
T args,
Optional<Arg> cmd,
Optional<Arg> bash,
Optional<Arg> cmdExe,
Optional<String> outputFileName,
Optional<com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableSet<String>>> outputFileNames) |
void |
findDepsForTargetFromConstructorArgs(BuildTarget buildTarget,
CellNameResolver cellRoots,
T constructorArg,
com.google.common.collect.ImmutableCollection.Builder<BuildTarget> extraDepsBuilder,
com.google.common.collect.ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder) |
protected Optional<AndroidTools> |
getAndroidToolsOptional(T args,
TargetConfiguration toolchainTargetConfiguration)
Returns android tools if
args has need_android_tools option set or empty optional
otherwise. |
protected String |
getGenruleType() |
protected Optional<com.google.common.collect.ImmutableList<MacroExpander<? extends Macro,?>>> |
getMacroHandler(BuildTarget buildTarget,
ProjectFilesystem filesystem,
BuildRuleResolver resolver,
TargetGraph targetGraph,
T args) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
producesCacheableSubgraph
getConfigurationDeps, getConstructorArgType
protected final ToolchainProvider toolchainProvider
protected final BuckConfig buckConfig
protected final SandboxExecutionStrategy sandboxExecutionStrategy
protected final boolean enableSandbox
protected AbstractGenruleDescription(ToolchainProvider toolchainProvider, BuckConfig buckConfig, SandboxExecutionStrategy sandboxExecutionStrategy, boolean enableSandbox)
protected abstract BuildRule createBuildRule(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, BuildRuleParams params, ActionGraphBuilder graphBuilder, T args, Optional<Arg> cmd, Optional<Arg> bash, Optional<Arg> cmdExe)
protected String getGenruleType()
String
representing the type of the genruleprotected boolean canExecuteRemotely(T args)
protected BuildRule createBuildRule(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, BuildRuleResolver resolver, T args, Optional<Arg> cmd, Optional<Arg> bash, Optional<Arg> cmdExe, Optional<String> outputFileName, Optional<com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableSet<String>>> outputFileNames)
protected Optional<AndroidTools> getAndroidToolsOptional(T args, TargetConfiguration toolchainTargetConfiguration)
args
has need_android_tools option set or empty optional
otherwise.protected Optional<com.google.common.collect.ImmutableList<MacroExpander<? extends Macro,?>>> getMacroHandler(BuildTarget buildTarget, ProjectFilesystem filesystem, BuildRuleResolver resolver, TargetGraph targetGraph, T args)
MacroExpander
s which apply to the macros in
this description.public BuildRule createBuildRule(BuildRuleCreationContextWithTargetGraph context, BuildTarget buildTarget, BuildRuleParams params, T args)
DescriptionWithTargetGraph
BuildRule
for the given BuildRuleParams
. Note that the BuildTarget
referred to in the params
contains the Flavor
to create.createBuildRule
in interface DescriptionWithTargetGraph<T extends AbstractGenruleDescription.CommonArg>
args
- A constructor argument, of type as returned by BaseDescription.getConstructorArgType()
.BuildRule
that describes the default flavour of the rule being described.public void findDepsForTargetFromConstructorArgs(BuildTarget buildTarget, CellNameResolver cellRoots, T constructorArg, com.google.common.collect.ImmutableCollection.Builder<BuildTarget> extraDepsBuilder, com.google.common.collect.ImmutableCollection.Builder<BuildTarget> targetGraphOnlyDepsBuilder)
findDepsForTargetFromConstructorArgs
in interface ImplicitDepsInferringDescription<T extends AbstractGenruleDescription.CommonArg>