Fix d8 and r8-compat-proguard scripts to handle quoted options.
Bug: 132766811
Test: treehugger
Change-Id: I298a17e9a80be79b1a884dc42c8d542bd1c47325
diff --git a/d8 b/d8
index e8fbac5..3a1fe80 100755
--- a/d8
+++ b/d8
@@ -64,11 +64,11 @@
# example. "java" (with no args) and "java -X" give a summary of
# available options.
-javaOpts=""
+declare -a javaOpts=()
while expr "x$1" : 'x-J' >/dev/null; do
opt=`expr "x$1" : 'x-J\(.*\)'`
- javaOpts="${javaOpts} -${opt}"
+ javaOpts+=("-${opt}")
if expr "x${opt}" : "xXmx[0-9]" >/dev/null; then
defaultMx="no"
fi
@@ -76,7 +76,7 @@
done
if [ "${defaultMx}" != "no" ]; then
- javaOpts="${javaOpts} ${defaultMx}"
+ javaOpts+=("${defaultMx}")
fi
if [ "$OSTYPE" = "cygwin" ]; then
@@ -86,4 +86,4 @@
jarpath="$libdir/$jarfile"
fi
-exec java $javaOpts -cp "$jarpath" com.android.tools.r8.D8 "$@"
+exec java "${javaOpts[@]}" -cp "$jarpath" com.android.tools.r8.D8 "$@"