diff options
author | 2017-09-26 06:35:22 -0400 | |
---|---|---|
committer | 2017-09-26 09:30:21 -0400 | |
commit | e69bcce4f81b0a2380fcc30ae355a1eb02f6cea1 (patch) | |
tree | 5b9a69e1c824f3b1498b15f73d28618303187e68 /src/main | |
parent | aa8540d6ee2189f991a13b4c4bea375b56cb4526 (diff) |
Fix java_stub_template.txt when parsing runfiles with spaces in path.
Print the rest of the line instead of only the second column separated by spaces.
Fix https://github.com/bazelbuild/bazel/issues/3807
RELNOTES: None
PiperOrigin-RevId: 170030984
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt index 856615e4c3..dbe84b4fae 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt @@ -199,7 +199,7 @@ else for line in "${my_array[@]}" do line_split=($line) - runfiles_array[${line_split[0]}]=${line_split[1]} + runfiles_array[${line_split[0]}]=${line_split[@]:1} done fi @@ -208,7 +208,10 @@ else echo $1 else if is_macos; then - echo $(grep "^$1 " $RUNFILES_MANIFEST_FILE | awk '{ print $2 }') + # Print the rest of line after the first space + # First, set the first column to empty and print rest of the line + # Second, use a trick of awk to remove leading and trailing spaces. + echo $(grep "^$1 " $RUNFILES_MANIFEST_FILE | awk '{ $1=""; print }' | awk '{ $1=$1; print }') else echo ${runfiles_array[$1]} fi |