diff options
author | tomlu <tomlu@google.com> | 2017-09-05 11:28:10 +0200 |
---|---|---|
committer | Yun Peng <pcloudy@google.com> | 2017-09-05 14:58:32 +0200 |
commit | fee827983ef3ec111b87d86e3741d3131cb7327c (patch) | |
tree | 193dea13b1d332a2a8da9309279deb464a476193 /src | |
parent | 998ec92036e046e18e5a5508af6f473e209212eb (diff) |
Remove direct argument adding methods from SpawnAction.Builder.
These are now unused. Users are expected to add command lines directly, using (say) CustomCommandLine.
PiperOrigin-RevId: 167554157
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java | 84 |
1 files changed, 6 insertions, 78 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java index ded0a8e795..8f690a47a4 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java @@ -535,7 +535,6 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie private PathFragment executable; // executableArgs does not include the executable itself. private List<String> executableArgs; - private CustomCommandLine.Builder commandLineBuilder = CustomCommandLine.builder(); @Nullable private CommandLine commandLine; private CharSequence progressMessage; @@ -567,7 +566,6 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie this.executableArgs = (other.executableArgs != null) ? Lists.newArrayList(other.executableArgs) : null; - this.commandLineBuilder = CustomCommandLine.builder(other.commandLineBuilder); this.commandLine = other.commandLine; this.progressMessage = other.progressMessage; this.paramFileInfo = other.paramFileInfo; @@ -600,8 +598,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie @VisibleForTesting @CheckReturnValue public Action[] build(ActionOwner owner, AnalysisEnvironment analysisEnvironment, BuildConfiguration configuration) { - CommandLine commandLine = - this.commandLine != null ? this.commandLine : this.commandLineBuilder.build(); + CommandLine commandLine = this.commandLine != null ? this.commandLine : CommandLine.EMPTY; // Check to see if we need to use param file. Artifact paramsFile = ParamFileHelper.getParamsFileMaybe( buildExecutableArgs(configuration.getShellExecutable()), @@ -1065,83 +1062,14 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie } /** - * Appends the argument to the list of command-line arguments. - */ - public Builder addArgument(String argument) { - Preconditions.checkState(commandLine == null); - commandLineBuilder.addDynamicString(argument); - return this; - } - - /** - * Appends the arguments to the list of command-line arguments. - */ - public Builder addArguments(String... arguments) { - Preconditions.checkState(commandLine == null); - commandLineBuilder.addAll(ImmutableList.copyOf(arguments)); - return this; - } - - /** - * Add multiple arguments in the order they are returned by the collection. - */ - public Builder addArguments(Iterable<String> arguments) { - Preconditions.checkState(commandLine == null); - if (arguments instanceof NestedSet) { - commandLineBuilder.addExecPaths((NestedSet) arguments); - } else { - commandLineBuilder.addAll(ImmutableList.copyOf(arguments)); - } - return this; - } - - /** - * Appends the argument both to the inputs and to the list of command-line - * arguments. - */ - public Builder addInputArgument(Artifact argument) { - Preconditions.checkState(commandLine == null); - addInput(argument); - commandLineBuilder.addExecPath(argument); - return this; - } - - /** - * Appends the arguments both to the inputs and to the list of command-line - * arguments. - */ - public Builder addInputArguments(Iterable<Artifact> arguments) { - addInputs(arguments); - if (arguments instanceof NestedSet) { - commandLineBuilder.addExecPaths((NestedSet) arguments); - } else { - commandLineBuilder.addExecPaths(ImmutableList.copyOf(arguments)); - } - return this; - } - - /** - * Appends the argument both to the outputs and to the list of command-line - * arguments. - */ - public Builder addOutputArgument(Artifact argument) { - Preconditions.checkState(commandLine == null); - outputs.add(argument); - commandLineBuilder.addExecPath(argument); - return this; - } - - /** - * Sets a delegate to compute the command line at a later time. This method - * cannot be used in conjunction with the {@link #addArgument} or {@link - * #addArguments} methods. + * Sets a delegate to compute the command line at a later time. + * + * <p>The main intention of this method is to save memory by allowing client-controlled sharing + * between actions and configured targets. Objects passed to this method MUST be immutable. * - * <p>The main intention of this method is to save memory by allowing - * client-controlled sharing between actions and configured targets. - * Objects passed to this method MUST be immutable. + * <p>See also {@link CustomCommandLine}. */ public Builder setCommandLine(CommandLine commandLine) { - Preconditions.checkState(commandLineBuilder.isEmpty()); this.commandLine = commandLine; return this; } |