Re: Building classpath with ecj

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Mon, Apr 7, 2008 at 5:50 AM, Andrew John Hughes <gnu_andrew@xxxxxxxxxxxxxx> wrote:
On 07/04/2008, Christian Thalinger <twisti@xxxxxxxxxxxxxxxxxxxxx> wrote:
> On Sun, 2008-04-06 at 15:47 -0700, mvfranz wrote:
>  > I would like to fix this in the ecj script for OS X, however I spent the
>  > afternoon trying to script something together that would strip -J parameters
>  > and pass them to the JVM that runs ecj.  I get this to work for some
>  > parameters but not others.  Sometimes quoting works sometimes it doesn't.
>  >
>  > Is there an installation of ecj that handles the -J parameters correctly?
>  > Anyone have bash scripts to handle this?
>
>
> I did this a while ago to bootstrap OpenJDK:
>
>  ARGS=""
>
>  for ARG in "$@"; do
>     OUT=`echo "$ARG" | grep "^-J"`
>     if [ "$OUT" = "" ]; then
>         ARGS="$ARGS $ARG"
>     fi
>  done
>
>  Maybe that helps.
>
>  - twisti
>
>
>

That's ok if you just want to drop them.  Supporting them is a little
trickier, and involves chopping the -J and moving the rest of the
option prior to the classname.
--
Andrew :-)

I am not interested in dropping them  - that is easy.  I want to split them up and pass them to correct process.

JVM_ARGS=
ARGS=

while [ $# -gt 0 ] ; do
    case "$1" in
        -J*) jopt=${1#\-J} ; JVM_ARGS="$JVM_ARGS $jopt";;
        *) ARGS="$ARGS $1" ;;
    esac
    shift
done

This works most of the time, unless the parameters are empty '' or have special values that need to have single quotes around them.
Blindly single quoting also has bad side effects on some arguments.




[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux