aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2017-09-25 05:54:50 -0400
committerGravatar John Cater <jcater@google.com>2017-09-25 09:40:07 -0400
commit878ea50b2b1aa61fbf4d21631c4dbf78a05c5397 (patch)
tree7cd6a31effd68df5d68692cc1d8f1f8cfb430e00 /src/main/java/com
parent563c4e12dfc13d4aac1be3429cde147dd7e4505a (diff)
Fix cc_fake_binaries with linkstamping
In https://github.com/bazelbuild/bazel/commit/b7a9ecd08c958e9513ea234b470a0f86e89e1acd I introduced a bug when linkstamping outputs would no longer be stored in $TEST_TMPDIR. This cl fixes that. RELNOTES: None. PiperOrigin-RevId: 169882831
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
index 186c4f742a..f351742f2a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
@@ -539,8 +539,17 @@ public final class LinkCommandLine extends CommandLine {
linkstampCompileCommandLine.add("-c");
linkstampCompileCommandLine.add(sourceFile.getExecPathString());
linkstampCompileCommandLine.add("-o");
- linkstampCompileCommandLine.add(outputFile.getExecPathString());
- commands.add(ShellEscaper.escapeJoinAll(linkstampCompileCommandLine.build()));
+ // outputPrefix is there only for cc_fake_binary, and it can contain env var expansions
+ // (such as $TEST_TMPDIR) and cannot be escaped. When we move linkstamping to a separate
+ // action, there will no longer be bash around the invocation and therefore no need to do
+ // shell escaping.
+ String escapedCommandWithoutOutput =
+ ShellEscaper.escapeJoinAll(linkstampCompileCommandLine.build());
+ commands.add(
+ escapedCommandWithoutOutput
+ + " "
+ + outputPrefix
+ + ShellEscaper.escapeString(outputFile.getExecPathString()));
}
return commands;