aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/ParameterFileWriteAction.java1
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/actions/ParamFileWriteActionTest.java33
2 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/ParameterFileWriteAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/ParameterFileWriteAction.java
index 0dc67da467..cf74bf0cfc 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/ParameterFileWriteAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/ParameterFileWriteAction.java
@@ -169,6 +169,7 @@ public final class ParameterFileWriteAction extends AbstractFileWriteAction {
f.addString(GUID);
f.addString(String.valueOf(makeExecutable));
f.addString(type.toString());
+ f.addString(charset.toString());
f.addStrings(commandLine.arguments());
return f.hexDigestAndReset();
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/actions/ParamFileWriteActionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/actions/ParamFileWriteActionTest.java
index 2e84fe7cd4..dce0ce30d0 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/actions/ParamFileWriteActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/actions/ParamFileWriteActionTest.java
@@ -31,11 +31,13 @@ import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.actions.ParameterFile.ParameterFileType;
import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
+import com.google.devtools.build.lib.analysis.util.ActionTester;
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
import com.google.devtools.build.lib.exec.util.TestExecutorBuilder;
import com.google.devtools.build.lib.util.io.FileOutErr;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.PathFragment;
+import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import org.junit.Before;
@@ -164,4 +166,35 @@ public class ParamFileWriteActionTest extends BuildViewTestCase {
return new ActionExecutionContext(executor, null, ActionInputPrefetcher.NONE, null,
new FileOutErr(), ImmutableMap.<String, String>of(), artifactExpander);
}
+
+ private enum KeyAttributes {
+ COMMANDLINE,
+ FILE_TYPE,
+ CHARSET,
+ }
+
+ @Test
+ public void testComputeKey() throws Exception {
+ final Artifact outputArtifact = getSourceArtifact("output");
+ ActionTester.runTest(
+ KeyAttributes.class,
+ attributesToFlip -> {
+ String arg = attributesToFlip.contains(KeyAttributes.COMMANDLINE) ? "foo" : "bar";
+ CommandLine commandLine = CommandLine.of(ImmutableList.of(arg));
+ ParameterFileType parameterFileType =
+ attributesToFlip.contains(KeyAttributes.FILE_TYPE)
+ ? ParameterFileType.SHELL_QUOTED
+ : ParameterFileType.UNQUOTED;
+ Charset charset =
+ attributesToFlip.contains(KeyAttributes.CHARSET)
+ ? StandardCharsets.UTF_8
+ : StandardCharsets.US_ASCII;
+ return new ParameterFileWriteAction(
+ ActionsTestUtil.NULL_ACTION_OWNER,
+ outputArtifact,
+ commandLine,
+ parameterFileType,
+ charset);
+ });
+ }
}