2 # Copyright 2005-2007, The Android Open Source Project
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Set up prog to be the path of this script, including following symlinks,
17 # and set up progdir to be the fully-qualified pathname of its directory.
19 while [ -h "${prog}" ]; do
20 newProg=`/bin/ls -ld "${prog}"`
21 newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
22 if expr "x${newProg}" : 'x/' >/dev/null; then
25 progdir=`dirname "${prog}"`
26 prog="${progdir}/${newProg}"
30 progdir=`dirname "${prog}"`
33 prog="${progdir}"/`basename "${prog}"`
37 frameworkdir="$progdir"
38 if [ ! -r "$frameworkdir/$jarfile" ]
40 frameworkdir=`dirname "$progdir"`/tools/lib
42 if [ ! -r "$frameworkdir/$jarfile" ]
44 frameworkdir=`dirname "$progdir"`/framework
46 if [ ! -r "$frameworkdir/$jarfile" ]
48 echo `basename "$prog"`": can't find $jarfile"
54 if [ debug = "$1" ]; then
55 # add this in for debugging
56 java_debug=-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y
62 if [ "$OSTYPE" = "cygwin" ] ; then
63 jarpath=`cygpath -w "$frameworkdir/$jarfile"`
65 jarpath="$frameworkdir/$jarfile"
68 # might need more memory, e.g. -Xmx128M
69 exec java -Xmx128M $java_debug -classpath "$jarpath" com.android.sdklib.build.ApkBuilderMain "$@"