From 75217c13f73aefb9e9e90fc6346f9c7e1ceed426 Mon Sep 17 00:00:00 2001 From: Josh Rosen Date: Mon, 29 Apr 2019 22:17:30 -0700 Subject: [PATCH] Port changes from https://github.com/bazelbuild/bazel/pull/8196 --- java_stub_template/WORKSPACE | 0 java_stub_template/file/BUILD.bazel | 5 +++++ java_stub_template/file/file.txt | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 java_stub_template/WORKSPACE create mode 100644 java_stub_template/file/BUILD.bazel diff --git a/java_stub_template/WORKSPACE b/java_stub_template/WORKSPACE new file mode 100644 index 000000000..e69de29bb diff --git a/java_stub_template/file/BUILD.bazel b/java_stub_template/file/BUILD.bazel new file mode 100644 index 000000000..069065102 --- /dev/null +++ b/java_stub_template/file/BUILD.bazel @@ -0,0 +1,5 @@ +filegroup( + name = "file", + srcs = ["file.txt"], + visibility = ["//visibility:public"], +) diff --git a/java_stub_template/file/file.txt b/java_stub_template/file/file.txt index e30a83cf8..0132b16f9 100644 --- a/java_stub_template/file/file.txt +++ b/java_stub_template/file/file.txt @@ -314,12 +314,14 @@ function create_and_run_classpath_jar() { CLASSPATH_LINE="Class-Path:$MANIFEST_CLASSPATH" # No line in the MANIFEST.MF file may be longer than 72 bytes. # A space prefix indicates the line is still the content of the last attribute. - for ((i = 0; i < "${#CLASSPATH_LINE}"; i += 71)); do + IFS=$'\n' + WRAPPED_LINES=($(echo "$CLASSPATH_LINE" | fold -w 71)) + for ((i = 0; i < "${#WRAPPED_LINES[*]}"; i += 1)); do PREFIX=" " if ((i == 0)); then PREFIX="" fi - echo "$PREFIX${CLASSPATH_LINE:$i:71}" + echo "$PREFIX${WRAPPED_LINES[$i]}" done echo "Created-By: Bazel" ) >$MANIFEST_FILE