public abstract class AbstractCommand extends CommandWithPluginManager
| Modifier and Type | Field and Description |
|---|---|
protected String |
commandArgsFile |
| Constructor and Description |
|---|
AbstractCommand() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCommandSpecificConfigOverrides(CellConfig.Builder builder)
Injection point for commands to add config overrides.
|
protected com.google.common.collect.ImmutableSet<BuildTarget> |
convertArgumentsToBuildTargets(CommandRunnerParams params,
List<String> arguments)
Converts target arguments to fully qualified form (including resolving aliases, resolving the
implicit package target, etc).
|
ParsingContext |
createParsingContext(Cell cell,
com.google.common.util.concurrent.ListeningExecutorService executor)
Creates a basic
ParsingContext with some options populated from command's arguments. |
String |
getCommandArgsFile() |
protected com.facebook.buck.cli.CommandLineBuildTargetNormalizer |
getCommandLineBuildTargetNormalizer(Cell rootCell,
Path clientWorkingDirectory,
BuckConfig buckConfig) |
ConcurrencyLimit |
getConcurrencyLimit(BuckConfig buckConfig) |
CellConfig |
getConfigOverrides(com.google.common.collect.ImmutableMap<CellName,AbsPath> cellMapping) |
boolean |
getEnableParserProfiling() |
Iterable<BuckEventListener> |
getEventListeners(Map<ExecutorPool,com.google.common.util.concurrent.ListeningExecutorService> executorPool,
ScheduledExecutorService scheduledExecutorService)
If any of these listeners also extends Closeable, it will be closed by Main.
|
Optional<Path> |
getEventsOutputPath() |
boolean |
getExcludeIncompatibleTargets() |
protected ExecutionContext |
getExecutionContext() |
protected ExecutionContext.Builder |
getExecutionContextBuilder(CommandRunnerParams params) |
Optional<String> |
getHostPlatform() |
LogConfigSetup |
getLogConfig() |
com.google.common.collect.ImmutableList<String> |
getTargetPlatforms() |
void |
handleException(org.kohsuke.args4j.CmdLineException e)
Handle CmdLineException when calling parseArguments()
|
protected void |
handleException(org.kohsuke.args4j.CmdLineException e,
String printedErrorMessage)
Print error message when there are unknown options
|
boolean |
isNoCache() |
boolean |
isReuseCurrentConfig() |
boolean |
isSourceControlStatsGatheringEnabled() |
protected com.google.common.collect.ImmutableSet<BuildTargetWithOutputs> |
matchBuildTargetsWithLabelsFromSpecs(com.google.common.collect.ImmutableList<TargetNodeSpec> specs,
Set<BuildTarget> buildTargets)
Returns a set of
BuildTargetWithOutputs instances by matching the given BuildTarget instances with the given TargetNodeSpec instances, and applying any OutputLabel instances to the matching BuildTarget instances. |
boolean |
performsBuild() |
protected Closeable |
prepareExecutionContext(CommandRunnerParams params) |
void |
printUsage(PrintStream stream) |
protected void |
printWarning(CommandRunnerParams params,
String s)
Helper for printing warnings to the console.
|
protected void |
printWarning(CommandRunnerParams params,
String format,
Object... args)
Helper for printing warnings to the console.
|
ExitCode |
run(CommandRunnerParams params) |
Optional<ExitCode> |
runHelp(PrintStream stream)
If the current command is a help command, run the action to print out the appropriate help
message.
|
abstract ExitCode |
runWithoutHelp(CommandRunnerParams params) |
getPluginManager, setPluginManagerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetShortDescription, isReadOnlypublic LogConfigSetup getLogConfig()
public boolean isNoCache()
[cache] in .buckconfig should be ignored.public boolean isReuseCurrentConfig()
public void handleException(org.kohsuke.args4j.CmdLineException e)
throws org.kohsuke.args4j.CmdLineException
org.kohsuke.args4j.CmdLineExceptionprotected void handleException(org.kohsuke.args4j.CmdLineException e,
String printedErrorMessage)
throws org.kohsuke.args4j.CmdLineException
org.kohsuke.args4j.CmdLineExceptionpublic void printUsage(PrintStream stream)
public Optional<ExitCode> runHelp(PrintStream stream)
CommandThis is an optimization to avoid initializing everything in CommandRunnerParams, in order to return help strings quickly.
stream - stream to output the help text.public final ExitCode run(CommandRunnerParams params) throws Exception
Exceptionprotected Closeable prepareExecutionContext(CommandRunnerParams params)
protected void printWarning(CommandRunnerParams params, String format, Object... args)
protected void printWarning(CommandRunnerParams params, String s)
public abstract ExitCode runWithoutHelp(CommandRunnerParams params) throws Exception
Exceptionprotected com.facebook.buck.cli.CommandLineBuildTargetNormalizer getCommandLineBuildTargetNormalizer(Cell rootCell, Path clientWorkingDirectory, BuckConfig buckConfig)
public boolean getEnableParserProfiling()
protected com.google.common.collect.ImmutableSet<BuildTargetWithOutputs> matchBuildTargetsWithLabelsFromSpecs(com.google.common.collect.ImmutableList<TargetNodeSpec> specs, Set<BuildTarget> buildTargets)
BuildTargetWithOutputs instances by matching the given BuildTarget instances with the given TargetNodeSpec instances, and applying any OutputLabel instances to the matching BuildTarget instances. Applies the default label
if a given build target cannot find a matching spec.protected ExecutionContext getExecutionContext()
protected ExecutionContext.Builder getExecutionContextBuilder(CommandRunnerParams params)
public ConcurrencyLimit getConcurrencyLimit(BuckConfig buckConfig)
public boolean isSourceControlStatsGatheringEnabled()
public Iterable<BuckEventListener> getEventListeners(Map<ExecutorPool,com.google.common.util.concurrent.ListeningExecutorService> executorPool, ScheduledExecutorService scheduledExecutorService)
Commandpublic boolean performsBuild()
public com.google.common.collect.ImmutableList<String> getTargetPlatforms()
public boolean getExcludeIncompatibleTargets()
protected com.google.common.collect.ImmutableSet<BuildTarget> convertArgumentsToBuildTargets(CommandRunnerParams params, List<String> arguments)
public CellConfig getConfigOverrides(com.google.common.collect.ImmutableMap<CellName,AbsPath> cellMapping)
protected void addCommandSpecificConfigOverrides(CellConfig.Builder builder)
public ParsingContext createParsingContext(Cell cell, com.google.common.util.concurrent.ListeningExecutorService executor)
CommandParsingContext with some options populated from command's arguments.