aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar philwo <philwo@google.com>2017-08-16 17:18:54 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-08-17 09:53:39 +0200
commit1f5a0ec3b12241e98587813e33052654b250460e (patch)
treed3aa5124add5fd6b6a87263d08bc067ba730f7cb /src/main/java/com/google/devtools/build/lib
parent3076055edfb671c5449d9c437daafb494efe7b58 (diff)
workers: Don't skip empty lines when expanding flagfiles.
Fixes #3329. PiperOrigin-RevId: 165443367
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java
index 46a9eea950..9bcc6e3d0a 100644
--- a/src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java
+++ b/src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java
@@ -202,7 +202,7 @@ final class WorkerSpawnRunner implements SpawnRunner {
throws IOException {
WorkRequest.Builder requestBuilder = WorkRequest.newBuilder();
for (String flagfile : flagfiles) {
- expandArgument(requestBuilder, flagfile);
+ expandArgument(execRoot, flagfile, requestBuilder);
}
List<ActionInput> inputs =
@@ -231,17 +231,18 @@ final class WorkerSpawnRunner implements SpawnRunner {
* files. The @ itself can be escaped with @@. This deliberately does not expand --flagfile= style
* arguments, because we want to get rid of the expansion entirely at some point in time.
*
- * @param requestBuilder the WorkRequest.Builder that the arguments should be added to.
+ * @param execRoot the current execroot of the build (relative paths will be assumed to be
+ * relative to this directory).
* @param arg the argument to expand.
+ * @param requestBuilder the WorkRequest to whose arguments the expanded arguments will be added.
* @throws java.io.IOException if one of the files containing options cannot be read.
*/
- private void expandArgument(WorkRequest.Builder requestBuilder, String arg) throws IOException {
+ static void expandArgument(Path execRoot, String arg, WorkRequest.Builder requestBuilder)
+ throws IOException {
if (arg.startsWith("@") && !arg.startsWith("@@")) {
for (String line : Files.readAllLines(
Paths.get(execRoot.getRelative(arg.substring(1)).getPathString()), UTF_8)) {
- if (line.length() > 0) {
- expandArgument(requestBuilder, line);
- }
+ expandArgument(execRoot, line, requestBuilder);
}
} else {
requestBuilder.addArguments(arg);