Skip to content

Commit 4d349c4

Browse files
Speed up wrapping of MANIFEST.MF lines in java_stub_template
1 parent 348ae53 commit 4d349c4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,14 @@ function create_and_run_classpath_jar() {
314314
CLASSPATH_LINE="Class-Path:$MANIFEST_CLASSPATH"
315315
# No line in the MANIFEST.MF file may be longer than 72 bytes.
316316
# A space prefix indicates the line is still the content of the last attribute.
317-
for ((i = 0; i < "${#CLASSPATH_LINE}"; i += 71)); do
317+
IFS=$'\n'
318+
WRAPPED_LINES=($(echo "$CLASSPATH_LINE" | fold -w 71))
319+
for ((i = 0; i < "${#WRAPPED_LINES[*]}"; i += 1)); do
318320
PREFIX=" "
319321
if ((i == 0)); then
320322
PREFIX=""
321323
fi
322-
echo "$PREFIX${CLASSPATH_LINE:$i:71}"
324+
echo "$PREFIX${WRAPPED_LINES[$i]}"
323325
done
324326
echo "Created-By: Bazel"
325327
) >$MANIFEST_FILE

0 commit comments

Comments
 (0)