diff options
author | Luca Stefani <luca.stefani.ge1@gmail.com> | 2019-03-01 11:21:40 +0100 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2019-03-01 11:21:40 +0100 |
commit | 118ffd42c0299dcf23e6049693cb36f6f09eb3d5 (patch) | |
tree | e42416b1887c7488777c59d1425c262cf9cfdf09 | |
parent | 45e52b5ab37a26149ce031caa44bb167da217667 (diff) | |
download | android_external_proguard-118ffd42c0299dcf23e6049693cb36f6f09eb3d5.tar.gz android_external_proguard-118ffd42c0299dcf23e6049693cb36f6f09eb3d5.tar.bz2 android_external_proguard-118ffd42c0299dcf23e6049693cb36f6f09eb3d5.zip |
Allow passing extra java arguments to proguard
Change-Id: I035786b209555700bd133fb4398859c1cd0ae892
-rwxr-xr-x | bin/proguard.sh | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/bin/proguard.sh b/bin/proguard.sh index dfc8b23..69c6dbe 100755 --- a/bin/proguard.sh +++ b/bin/proguard.sh @@ -21,6 +21,30 @@ fi PROGUARD_HOME=`dirname "$PROGUARD"`/.. -# BEGIN android-changed Added -Xmx2G for Mac builds -java -Xmx2G -jar "$PROGUARD_HOME/lib/proguard.jar" "$@" -# END android-changed +# By default, give dx a max heap size of 2 gig. This can be overridden +# by using a "-J" option (see below). +defaultMx="-Xmx2G" + +# The following will extract any initial parameters of the form +# "-J<stuff>" from the command line and pass them to the Java +# invocation (instead of to dx). This makes it possible for you to add +# a command-line parameter such as "-JXmx256M" in your scripts, for +# example. "java" (with no args) and "java -X" give a summary of +# available options. + +javaOpts="" + +while expr "x$1" : 'x-J' >/dev/null; do + opt=`expr "x$1" : 'x-J\(.*\)'` + javaOpts="${javaOpts} -${opt}" + if expr "x${opt}" : "xXmx[0-9]" >/dev/null; then + defaultMx="no" + fi + shift +done + +if [ "${defaultMx}" != "no" ]; then + javaOpts="${javaOpts} ${defaultMx}" +fi + +exec java $javaOpts -jar "$PROGUARD_HOME/lib/proguard.jar" "$@" |