Home | History | Annotate | Download | only in etc
      1 #!/bin/bash
      2 #
      3 # Copyright (C) 2005, The Android Open Source Project
      4 #
      5 # Licensed under the Apache License, Version 2.0 (the "License");
      6 # you may not use this file except in compliance with the License.
      7 # You may obtain a copy of the License at
      8 #
      9 #     http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 # Unless required by applicable law or agreed to in writing, software
     12 # distributed under the License is distributed on an "AS IS" BASIS,
     13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 # See the License for the specific language governing permissions and
     15 # limitations under the License.
     16 
     17 # Set up prog to be the path of this script, including following symlinks,
     18 # and set up progdir to be the fully-qualified pathname of its directory.
     19 #
     20 # The classpath and other java options used in apicheck are specified in
     21 # build/core/tasks/apicheck.mk.
     22 
     23 prog="$0"
     24 while [ -h "${prog}" ]; do
     25     newProg=`/bin/ls -ld "${prog}"`
     26     newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
     27     if expr "x${newProg}" : 'x/' >/dev/null; then
     28         prog="${newProg}"
     29     else
     30         progdir=`dirname "${prog}"`
     31         prog="${progdir}/${newProg}"
     32     fi
     33 done
     34 oldwd=`pwd`
     35 progdir=`dirname "${prog}"`
     36 cd "${progdir}"
     37 progdir=`pwd`
     38 prog="${progdir}"/`basename "${prog}"`
     39 cd "${oldwd}"
     40 
     41 javaOpts=""
     42 while expr "x$1" : 'x-J' >/dev/null; do
     43     opt=`expr "x$1" : 'x-J\(.*\)'`
     44     javaOpts="${javaOpts} -${opt}"
     45     shift
     46 done
     47 
     48 exec java $javaOpts com.google.doclava.apicheck.ApiCheck "$@"
     49