aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-05-15 18:05:46 +0200
committerGravatar Dmitry Lomov <dslomov@google.com>2017-05-15 19:51:27 +0200
commit48034fdb65b3c8e9f2860ff3038d4189945f02e0 (patch)
treeed97f9f76b2c1fb4ae22069406cb8a41499cab17
parent34cdd98497bc2cceca9a8a2827f0a2499e806d0f (diff)
Remove methods from CommandLine, making it a simple argument list interface.
* isShellCommand is now passed directly to SpawnAction * Getting the associated params file action was a test-only thing. We can pull this out of the action graph instead. PiperOrigin-RevId: 156060366
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/CommandLine.java89
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileHelper.java24
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java40
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTemplate.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AarGeneratorBuilder.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidAaptActionHelper.java67
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/LTOBackendAction.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/extra/ExtraActionSpec.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleAction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java1
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCompileAction.java4
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java13
14 files changed, 103 insertions, 159 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/CommandLine.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/CommandLine.java
index c01afcf211..1d3e0bebb8 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/CommandLine.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/CommandLine.java
@@ -14,7 +14,6 @@
package com.google.devtools.build.lib.analysis.actions;
-import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -22,9 +21,7 @@ import com.google.devtools.build.lib.actions.Artifact.ArtifactExpander;
import com.google.devtools.build.lib.collect.CollectionUtils;
import com.google.devtools.build.lib.util.Preconditions;
-/**
- * A representation of a command line to be executed by a SpawnAction.
- */
+/** A representation of a list of arguments, often a command executed by {@link SpawnAction}. */
public abstract class CommandLine {
/**
* Returns the command line.
@@ -43,64 +40,14 @@ public abstract class CommandLine {
return arguments();
}
- /**
- * Returns whether the command line represents a shell command with the given shell executable.
- * This is used to give better error messages.
- *
- * <p>By default, this method returns false.
- */
- public boolean isShellCommand() {
- return false;
- }
-
- /**
- * Returns the {@link ParameterFileWriteAction} that generates the parameter file used in this
- * command line, or null if no parameter file is used.
- */
- @VisibleForTesting
- public ParameterFileWriteAction parameterFileWriteAction() {
- return null;
- }
-
- /** A default implementation of a command line backed by a copy of the given list of arguments. */
- static CommandLine ofInternal(
- Iterable<String> arguments,
- final boolean isShellCommand,
- final ParameterFileWriteAction paramFileWriteAction) {
+ /** Returns a {@link CommandLine} backed by a copy of the given list of arguments. */
+ public static CommandLine of(Iterable<String> arguments) {
final Iterable<String> immutableArguments = CollectionUtils.makeImmutable(arguments);
return new CommandLine() {
@Override
public Iterable<String> arguments() {
return immutableArguments;
}
-
- @Override
- public boolean isShellCommand() {
- return isShellCommand;
- }
-
- @Override
- public ParameterFileWriteAction parameterFileWriteAction() {
- return paramFileWriteAction;
- }
- };
- }
-
- /**
- * Returns a {@link CommandLine} backed by a copy of the given list of arguments.
- */
- public static CommandLine of(Iterable<String> arguments, final boolean isShellCommand) {
- final Iterable<String> immutableArguments = CollectionUtils.makeImmutable(arguments);
- return new CommandLine() {
- @Override
- public Iterable<String> arguments() {
- return immutableArguments;
- }
-
- @Override
- public boolean isShellCommand() {
- return isShellCommand;
- }
};
}
@@ -108,40 +55,18 @@ public abstract class CommandLine {
* Returns a {@link CommandLine} that is constructed by prepending the {@code executableArgs} to
* {@code commandLine}.
*/
- static CommandLine ofMixed(final ImmutableList<String> executableArgs,
- final CommandLine commandLine, final boolean isShellCommand) {
+ CommandLine prepend(final ImmutableList<String> executableArgs) {
+ final CommandLine self = this;
Preconditions.checkState(!executableArgs.isEmpty());
return new CommandLine() {
@Override
public Iterable<String> arguments() {
- return Iterables.concat(executableArgs, commandLine.arguments());
+ return Iterables.concat(executableArgs, self.arguments());
}
@Override
public Iterable<String> arguments(ArtifactExpander artifactExpander) {
- return Iterables.concat(executableArgs, commandLine.arguments(artifactExpander));
- }
-
- @Override
- public boolean isShellCommand() {
- return isShellCommand;
- }
- };
- }
-
- /**
- * Returns a {@link CommandLine} with {@link CharSequence} arguments. This can be useful to create
- * memory efficient command lines with {@link com.google.devtools.build.lib.util.LazyString}s.
- */
- public static CommandLine ofCharSequences(final ImmutableList<CharSequence> arguments) {
- return new CommandLine() {
- @Override
- public Iterable<String> arguments() {
- ImmutableList.Builder<String> builder = ImmutableList.builder();
- for (CharSequence arg : arguments) {
- builder.add(arg.toString());
- }
- return builder.build();
+ return Iterables.concat(executableArgs, self.arguments(artifactExpander));
}
};
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileHelper.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileHelper.java
index f1c7c16174..e39401ac04 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/ParamFileHelper.java
@@ -84,20 +84,14 @@ public final class ParamFileHelper {
* <p>Call this with the result of {@link #getParamsFileMaybe} if it is not null.
*
* @param executableArgs leading arguments that should never be wrapped in a parameter file
- * @param isShellCommand true if this is a shell command
* @param paramFileInfo parameter file information
* @param parameterFile the output parameter file artifact
- * @param paramFileWriteAction the action that generates the parameter file
*/
public static CommandLine createWithParamsFile(
- List<String> executableArgs,
- boolean isShellCommand,
- ParamFileInfo paramFileInfo,
- Artifact parameterFile,
- ParameterFileWriteAction paramFileWriteAction) {
+ List<String> executableArgs, ParamFileInfo paramFileInfo, Artifact parameterFile) {
String pathWithFlag = paramFileInfo.getFlag() + parameterFile.getExecPathString();
Iterable<String> commandArgv = Iterables.concat(executableArgs, ImmutableList.of(pathWithFlag));
- return CommandLine.ofInternal(commandArgv, isShellCommand, paramFileWriteAction);
+ return CommandLine.of(commandArgv);
}
/**
@@ -116,8 +110,7 @@ public final class ParamFileHelper {
ActionOwner owner,
Artifact parameterFile,
ParamFileInfo paramFileInfo) {
- CommandLine paramFileContents =
- (commandLine != null) ? commandLine : CommandLine.ofInternal(arguments, false, null);
+ CommandLine paramFileContents = (commandLine != null) ? commandLine : CommandLine.of(arguments);
return new ParameterFileWriteAction(owner, parameterFile, paramFileContents,
paramFileInfo.getFileType(), paramFileInfo.getCharset());
@@ -131,21 +124,20 @@ public final class ParamFileHelper {
* @param executableArgs leading arguments that should never be wrapped in a parameter file
* @param arguments arguments to the command (in addition to executableArgs), OR
* @param commandLine a {@link CommandLine} that provides the arguments (in addition to
- * executableArgs)
- * @param isShellCommand true if this is a shell command
+ * executableArgs)
*/
- public static CommandLine createWithoutParamsFile(List<String> executableArgs,
- Iterable<String> arguments, CommandLine commandLine, boolean isShellCommand) {
+ public static CommandLine createWithoutParamsFile(
+ List<String> executableArgs, Iterable<String> arguments, CommandLine commandLine) {
if (commandLine == null) {
Iterable<String> commandArgv = Iterables.concat(executableArgs, arguments);
- return CommandLine.ofInternal(commandArgv, isShellCommand, null);
+ return CommandLine.of(commandArgv);
}
if (executableArgs.isEmpty()) {
return commandLine;
}
- return CommandLine.ofMixed(ImmutableList.copyOf(executableArgs), commandLine, isShellCommand);
+ return commandLine.prepend(ImmutableList.copyOf(executableArgs));
}
/**
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 664429ed00..51178a1d68 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
@@ -73,6 +73,7 @@ import javax.annotation.Nullable;
/** An Action representing an arbitrary subprocess to be forked and exec'd. */
public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifier, CommandAction {
+
/** Sets extensions on ExtraActionInfo **/
protected static class ExtraActionInfoSupplier<T> {
private final GeneratedExtension<ExtraActionInfo, T> extension;
@@ -93,6 +94,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
private final CommandLine argv;
private final boolean executeUnconditionally;
+ private final boolean isShellCommand;
private final String progressMessage;
private final String mnemonic;
@@ -120,6 +122,8 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
* @param argv the command line to execute. This is merely a list of options to the executable,
* and is uninterpreted by the build tool for the purposes of dependency checking; typically
* it may include the names of input and output files, but this is not necessary.
+ * @param isShellCommand Whether the command line represents a shell command with the given shell
+ * executable. This is used to give better error messages.
* @param progressMessage the message printed during the progression of the build
* @param mnemonic the mnemonic that is reported in the master log.
*/
@@ -130,6 +134,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
Iterable<Artifact> outputs,
ResourceSet resourceSet,
CommandLine argv,
+ boolean isShellCommand,
Map<String, String> environment,
Set<String> clientEnvironmentVariables,
String progressMessage,
@@ -141,6 +146,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
outputs,
resourceSet,
argv,
+ isShellCommand,
ImmutableMap.copyOf(environment),
ImmutableSet.copyOf(clientEnvironmentVariables),
ImmutableMap.<String, String>of(),
@@ -171,6 +177,8 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
* options to the executable, and is uninterpreted by the build tool for the purposes of
* dependency checking; typically it may include the names of input and output files, but this
* is not necessary.
+ * @param isShellCommand Whether the command line represents a shell command with the given shell
+ * executable. This is used to give better error messages.
* @param progressMessage the message printed during the progression of the build
* @param runfilesSupplier {@link RunfilesSupplier}s describing the runfiles for the action
* @param mnemonic the mnemonic that is reported in the master log.
@@ -182,6 +190,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
Iterable<Artifact> outputs,
ResourceSet resourceSet,
CommandLine argv,
+ boolean isShellCommand,
ImmutableMap<String, String> environment,
ImmutableSet<String> clientEnvironmentVariables,
ImmutableMap<String, String> executionInfo,
@@ -196,6 +205,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
this.environment = environment;
this.clientEnvironmentVariables = clientEnvironmentVariables;
this.argv = argv;
+ this.isShellCommand = isShellCommand;
this.progressMessage = progressMessage;
this.mnemonic = mnemonic;
this.executeUnconditionally = executeUnconditionally;
@@ -213,18 +223,6 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
return SkylarkList.createImmutable(getArguments());
}
- /**
- * Returns the list of options written to the parameter file. Don't use this method outside tests.
- * The list is often huge, resulting in significant garbage collection overhead.
- */
- @VisibleForTesting
- public List<String> getArgumentsFromParamFile() {
- if (argv.parameterFileWriteAction() != null) {
- return ImmutableList.copyOf(argv.parameterFileWriteAction().getContents());
- }
- return ImmutableList.of();
- }
-
/** Returns command argument, argv[0]. */
@VisibleForTesting
public String getCommandFilename() {
@@ -242,7 +240,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
@VisibleForTesting
public boolean isShellCommand() {
- return argv.isShellCommand();
+ return isShellCommand;
}
@Override
@@ -614,8 +612,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
configuration.getLocalShellEnvironment(),
configuration.getVariableShellEnvironment(),
configuration.getShellExecutable(),
- paramsFile,
- paramFileWriteAction));
+ paramsFile));
if (paramFileWriteAction != null) {
actions.add(paramFileWriteAction);
}
@@ -647,19 +644,15 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
@Nullable Map<String, String> defaultShellEnvironment,
@Nullable Set<String> variableShellEnvironment,
@Nullable PathFragment defaultShellExecutable,
- @Nullable Artifact paramsFile,
- @Nullable ParameterFileWriteAction paramFileWriteAction) {
+ @Nullable Artifact paramsFile) {
List<String> argv = buildExecutableArgs(defaultShellExecutable);
Iterable<String> arguments = argumentsBuilder.build();
CommandLine actualCommandLine;
if (paramsFile != null) {
inputsBuilder.add(paramsFile);
- actualCommandLine =
- ParamFileHelper.createWithParamsFile(
- argv, isShellCommand, paramFileInfo, paramsFile, paramFileWriteAction);
+ actualCommandLine = ParamFileHelper.createWithParamsFile(argv, paramFileInfo, paramsFile);
} else {
- actualCommandLine = ParamFileHelper.createWithoutParamsFile(argv, arguments, commandLine,
- isShellCommand);
+ actualCommandLine = ParamFileHelper.createWithoutParamsFile(argv, arguments, commandLine);
}
NestedSet<Artifact> tools = toolsBuilder.build();
@@ -695,6 +688,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
ImmutableList.copyOf(outputs),
resourceSet,
actualCommandLine,
+ isShellCommand,
ImmutableMap.copyOf(env),
ImmutableSet.copyOf(clientEnv),
ImmutableMap.copyOf(executionInfo),
@@ -712,6 +706,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
ImmutableList<Artifact> outputs,
ResourceSet resourceSet,
CommandLine actualCommandLine,
+ boolean isShellCommand,
ImmutableMap<String, String> env,
ImmutableSet<String> clientEnvironmentVariables,
ImmutableMap<String, String> executionInfo,
@@ -725,6 +720,7 @@ public class SpawnAction extends AbstractAction implements ExecutionInfoSpecifie
outputs,
resourceSet,
actualCommandLine,
+ isShellCommand,
env,
clientEnvironmentVariables,
executionInfo,
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTemplate.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTemplate.java
index 6a64709d7b..f240cbb048 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTemplate.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTemplate.java
@@ -131,8 +131,7 @@ public final class SpawnActionTemplate implements ActionTemplate<SpawnAction> {
/*defaultShellEnvironment=*/ null,
/*variableShellEnvironment=*/ null,
/*defaultShellExecutable=*/ null,
- /*paramsFile=*/ null,
- /*paramFileWriteAction=*/ null);
+ /*paramsFile=*/ null);
}
/**
@@ -207,7 +206,7 @@ public final class SpawnActionTemplate implements ActionTemplate<SpawnAction> {
@Override
public Iterable<String> getClientEnvironmentVariables() {
return spawnActionBuilder
- .buildSpawnAction(getOwner(), null, null, null, null, null)
+ .buildSpawnAction(getOwner(), null, null, null, null)
.getClientEnvironmentVariables();
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AarGeneratorBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/AarGeneratorBuilder.java
index 41c5ab751d..b0ffa9e5b5 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AarGeneratorBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AarGeneratorBuilder.java
@@ -119,7 +119,7 @@ public class AarGeneratorBuilder {
this.builder
.addInputs(ImmutableList.<Artifact>copyOf(ins))
.addOutputs(ImmutableList.<Artifact>copyOf(outs))
- .setCommandLine(CommandLine.of(args, false))
+ .setCommandLine(CommandLine.of(args))
.setExecutable(
ruleContext.getExecutablePrerequisite("$android_resources_busybox", Mode.HOST))
.setProgressMessage("Building AAR package for " + ruleContext.getLabel())
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidAaptActionHelper.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidAaptActionHelper.java
index d3e325827a..e9f149c93e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidAaptActionHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidAaptActionHelper.java
@@ -105,16 +105,17 @@ public final class AndroidAaptActionHelper {
args.addAll(createAaptCommand("javasrcs", javaSourcesJar, rTxt, inlineConstants,
"-J", javaResources, "--custom-package", javaPackage, "--rename-manifest-package",
javaPackage));
- final Builder builder = new SpawnAction.Builder()
- .addInputs(getInputs())
- .addTool(AndroidSdkProvider.fromRuleContext(ruleContext).getAapt())
- .setExecutable(
- ruleContext.getExecutablePrerequisite("$android_aapt_java_generator", Mode.HOST))
- .addOutput(javaSourcesJar)
- .setCommandLine(CommandLine.of(args, false))
- .useParameterFile(ParameterFileType.UNQUOTED)
- .setProgressMessage("Generating Java resources")
- .setMnemonic("AndroidAapt");
+ final Builder builder =
+ new SpawnAction.Builder()
+ .addInputs(getInputs())
+ .addTool(AndroidSdkProvider.fromRuleContext(ruleContext).getAapt())
+ .setExecutable(
+ ruleContext.getExecutablePrerequisite("$android_aapt_java_generator", Mode.HOST))
+ .addOutput(javaSourcesJar)
+ .setCommandLine(CommandLine.of(args))
+ .useParameterFile(ParameterFileType.UNQUOTED)
+ .setProgressMessage("Generating Java resources")
+ .setMnemonic("AndroidAapt");
if (rTxt != null) {
builder.addOutput(rTxt);
}
@@ -145,17 +146,18 @@ public final class AndroidAaptActionHelper {
args.addAll(aaptOpts);
- ruleContext.registerAction(new SpawnAction.Builder()
- .addInputs(getInputs())
- .addTool(AndroidSdkProvider.fromRuleContext(ruleContext).getAapt())
- .addOutput(apk)
- .setExecutable(
- ruleContext.getExecutablePrerequisite("$android_aapt_apk_generator", Mode.HOST))
- .setCommandLine(CommandLine.of(args, false))
- .useParameterFile(ParameterFileType.UNQUOTED)
- .setProgressMessage("Generating apk resources")
- .setMnemonic("AndroidAapt")
- .build(ruleContext));
+ ruleContext.registerAction(
+ new SpawnAction.Builder()
+ .addInputs(getInputs())
+ .addTool(AndroidSdkProvider.fromRuleContext(ruleContext).getAapt())
+ .addOutput(apk)
+ .setExecutable(
+ ruleContext.getExecutablePrerequisite("$android_aapt_apk_generator", Mode.HOST))
+ .setCommandLine(CommandLine.of(args))
+ .useParameterFile(ParameterFileType.UNQUOTED)
+ .setProgressMessage("Generating apk resources")
+ .setMnemonic("AndroidAapt")
+ .build(ruleContext));
}
private List<String> createAaptCommand(String actionKind, Artifact output,
@@ -272,16 +274,17 @@ public final class AndroidAaptActionHelper {
List<String> aaptCommand =
createAaptCommand("proguard", outputSpec, null, true, aaptArgs.build());
- ruleContext.registerAction(new SpawnAction.Builder()
- .addInputs(getInputs())
- .addTool(AndroidSdkProvider.fromRuleContext(ruleContext).getAapt())
- .addOutputs(outputs.build())
- .setExecutable(
- ruleContext.getExecutablePrerequisite("$android_aapt_apk_generator", Mode.HOST))
- .setCommandLine(CommandLine.of(aaptCommand, false))
- .useParameterFile(ParameterFileType.UNQUOTED)
- .setProgressMessage("Generating Proguard configuration for resources")
- .setMnemonic("AndroidAapt")
- .build(ruleContext));
+ ruleContext.registerAction(
+ new SpawnAction.Builder()
+ .addInputs(getInputs())
+ .addTool(AndroidSdkProvider.fromRuleContext(ruleContext).getAapt())
+ .addOutputs(outputs.build())
+ .setExecutable(
+ ruleContext.getExecutablePrerequisite("$android_aapt_apk_generator", Mode.HOST))
+ .setCommandLine(CommandLine.of(aaptCommand))
+ .useParameterFile(ParameterFileType.UNQUOTED)
+ .setProgressMessage("Generating Proguard configuration for resources")
+ .setMnemonic("AndroidAapt")
+ .build(ruleContext));
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LTOBackendAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LTOBackendAction.java
index 4fa0a82a10..d31a7167d1 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LTOBackendAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LTOBackendAction.java
@@ -66,6 +66,7 @@ public final class LTOBackendAction extends SpawnAction {
Collection<Artifact> outputs,
ActionOwner owner,
CommandLine argv,
+ boolean isShellCommand,
Map<String, String> environment,
Set<String> clientEnvironmentVariables,
Map<String, String> executionInfo,
@@ -79,6 +80,7 @@ public final class LTOBackendAction extends SpawnAction {
outputs,
AbstractAction.DEFAULT_RESOURCE_SET,
argv,
+ isShellCommand,
ImmutableMap.copyOf(environment),
ImmutableSet.copyOf(clientEnvironmentVariables),
ImmutableMap.copyOf(executionInfo),
@@ -208,6 +210,7 @@ public final class LTOBackendAction extends SpawnAction {
ImmutableList<Artifact> outputs,
ResourceSet resourceSet,
CommandLine actualCommandLine,
+ boolean isShellCommand,
ImmutableMap<String, String> env,
ImmutableSet<String> clientEnvironmentVariables,
ImmutableMap<String, String> executionInfo,
@@ -221,6 +224,7 @@ public final class LTOBackendAction extends SpawnAction {
outputs,
owner,
actualCommandLine,
+ isShellCommand,
env,
clientEnvironmentVariables,
executionInfo,
diff --git a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java
index 930cc932c7..a947232147 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java
@@ -81,11 +81,14 @@ public final class ExtraAction extends SpawnAction {
shadowedAction.getOwner(),
ImmutableList.<Artifact>of(),
createInputs(
- shadowedAction.getInputs(), ImmutableList.<Artifact>of(), extraActionInputs,
+ shadowedAction.getInputs(),
+ ImmutableList.<Artifact>of(),
+ extraActionInputs,
runfilesSupplier),
outputs,
AbstractAction.DEFAULT_RESOURCE_SET,
argv,
+ false,
ImmutableMap.copyOf(environment),
ImmutableSet.copyOf(clientEnvironmentVariables),
ImmutableMap.copyOf(executionInfo),
diff --git a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraActionSpec.java b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraActionSpec.java
index 90de182573..65a81d91ee 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraActionSpec.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraActionSpec.java
@@ -144,7 +144,7 @@ public final class ExtraActionSpec implements TransitiveInfoProvider {
extraActionOutputs,
actionToShadow,
createDummyOutput,
- CommandLine.of(argv, false),
+ CommandLine.of(argv),
env,
clientEnvVars,
executionInfo,
diff --git a/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleAction.java b/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleAction.java
index 55b4e60192..3fbaeb5fd3 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/genrule/GenRuleAction.java
@@ -54,7 +54,8 @@ public class GenRuleAction extends SpawnAction {
inputs,
outputs,
GENRULE_RESOURCES,
- CommandLine.of(argv, false),
+ CommandLine.of(argv),
+ false,
environment,
clientEnvironmentVariables,
executionInfo,
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
index d11345aa80..f29ceef188 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
@@ -199,6 +199,7 @@ public final class JavaCompileAction extends SpawnAction {
outputs,
LOCAL_RESOURCES,
commandLine,
+ false,
ImmutableMap.copyOf(UTF8_ENVIRONMENT),
ImmutableSet.copyOf(ImmutableSet.<String>of()),
ImmutableMap.copyOf(executionInfo),
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java
index a92d5bbddf..02c072002e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaHeaderCompileAction.java
@@ -108,6 +108,7 @@ public class JavaHeaderCompileAction extends SpawnAction {
outputs,
LOCAL_RESOURCES,
transitiveCommandLine,
+ false,
JavaCompileAction.UTF8_ENVIRONMENT,
/*executionInfo=*/ ImmutableSet.<String>of(),
progressMessage,
@@ -376,6 +377,7 @@ public class JavaHeaderCompileAction extends SpawnAction {
outputs,
LOCAL_RESOURCES,
directCommandLine,
+ false,
JavaCompileAction.UTF8_ENVIRONMENT,
/*executionInfo=*/ ImmutableSet.<String>of(),
getProgressMessage(),
@@ -418,6 +420,7 @@ public class JavaHeaderCompileAction extends SpawnAction {
outputs,
LOCAL_RESOURCES,
transitiveCommandLine,
+ false,
JavaCompileAction.UTF8_ENVIRONMENT,
/*executionInfo=*/ ImmutableSet.<String>of(),
getProgressMessage(),
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCompileAction.java
index 5b6280dec3..e5b280b688 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCompileAction.java
@@ -113,6 +113,7 @@ public class ObjcCompileAction extends SpawnAction {
Iterable<Artifact> outputs,
ResourceSet resourceSet,
CommandLine argv,
+ boolean isShellCommand,
ImmutableMap<String, String> environment,
ImmutableMap<String, String> executionInfo,
String progressMessage,
@@ -133,6 +134,7 @@ public class ObjcCompileAction extends SpawnAction {
outputs,
resourceSet,
argv,
+ isShellCommand,
environment,
ImmutableSet.<String>of(),
executionInfo,
@@ -431,6 +433,7 @@ public class ObjcCompileAction extends SpawnAction {
ImmutableList<Artifact> outputs,
ResourceSet resourceSet,
CommandLine actualCommandLine,
+ boolean isShellCommand,
ImmutableMap<String, String> env,
ImmutableSet<String> clientEnvironmentVariables,
ImmutableMap<String, String> executionInfo,
@@ -444,6 +447,7 @@ public class ObjcCompileAction extends SpawnAction {
outputs,
resourceSet,
actualCommandLine,
+ isShellCommand,
env,
executionInfo,
progressMessage,
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
index 4c698ee8bb..0a455ae0c2 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
@@ -72,6 +72,7 @@ import com.google.devtools.build.lib.analysis.SourceManifestAction;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
import com.google.devtools.build.lib.analysis.WorkspaceStatusAction;
+import com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction;
import com.google.devtools.build.lib.analysis.actions.SpawnAction;
import com.google.devtools.build.lib.analysis.actions.SymlinkTreeAction;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey;
@@ -159,6 +160,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
+import javax.annotation.Nullable;
import org.junit.Before;
/**
@@ -647,6 +649,17 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
}
}
+ @Nullable
+ protected final ParameterFileWriteAction findParamsFileAction(SpawnAction spawnAction) {
+ for (Artifact input : spawnAction.getInputs()) {
+ Action generatingAction = getGeneratingAction(input);
+ if (generatingAction instanceof ParameterFileWriteAction) {
+ return (ParameterFileWriteAction) generatingAction;
+ }
+ }
+ return null;
+ }
+
protected Action getGeneratingAction(ConfiguredTarget target, String outputName) {
NestedSet<Artifact> filesToBuild = getFilesToBuild(target);
return getGeneratingAction(outputName, filesToBuild, "filesToBuild");