acpg-cli.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. # This script is a wrapper for gen_acpg.jar, so you can simply call "gen_acpg",
  3. # instead of java -jar gen_acpg.jar. It is heavily based on the "dx" script
  4. # from the Android SDK
  5. # Set up prog to be the path of this script, including following symlinks,
  6. # and set up progdir to be the fully-qualified pathname of its directory.
  7. prog="$0"
  8. while [ -h "${prog}" ]; do
  9. newProg=`/bin/ls -ld "${prog}"`
  10. echo ${newProg}
  11. newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
  12. if expr "x${newProg}" : 'x/' >/dev/null; then
  13. prog="${newProg}"
  14. else
  15. progdir=`dirname "${prog}"`
  16. prog="${progdir}/${newProg}"
  17. fi
  18. done
  19. oldwd=`pwd`
  20. progdir=`dirname "${prog}"`
  21. cd "${progdir}"
  22. progdir=`pwd`
  23. prog="${progdir}"/`basename "${prog}"`
  24. cd "${oldwd}"
  25. jarfile=acpg-cli-1.12.0.jar
  26. libdir="$progdir"
  27. if [ ! -r "$libdir/$jarfile" ]
  28. then
  29. echo `basename "$prog"`": can't find $jarfile"
  30. exit 1
  31. fi
  32. javaOpts=""
  33. # If you want DX to have more memory when executing, uncomment the following
  34. # line and adjust the value accordingly. Use "java -X" for a list of options
  35. # you can pass here.
  36. #
  37. javaOpts="-Xmx128M"
  38. # Alternatively, this will extract any parameter "-Jxxx" from the command line
  39. # and pass them to Java (instead of to dx). This makes it possible for you to
  40. # add a command-line parameter such as "-JXmx256M" in your ant scripts, for
  41. # example.
  42. while expr "x$1" : 'x-J' >/dev/null; do
  43. opt=`expr "$1" : '-J\(.*\)'`
  44. javaOpts="${javaOpts} -${opt}"
  45. shift
  46. done
  47. if [ "$OSTYPE" = "cygwin" ] ; then
  48. jarpath=`cygpath -w "$libdir/$jarfile"`
  49. else
  50. jarpath="$libdir/$jarfile"
  51. fi
  52. # add current location to path for aapt
  53. PATH=$PATH:`pwd`;
  54. export PATH;
  55. exec java $javaOpts -jar "$jarpath" "$@"