Home | History | Annotate | Download | only in bin
      1 #!/bin/bash
      2 
      3 vogar_jar=`dirname $0`/../build/vogar.jar
      4 if [ ! -f "${vogar_jar}" ]; then
      5     echo "vogar: info: couldn't find prebuilt ${vogar_jar}; building ..."
      6     
      7     if [ -n "${ANDROID_BUILD_TOP}" ]; then
      8         # We're in an Android build tree, so pull the latest sdk from there.
      9         # <= ICS uses 'prebuilt', >= JB uses 'prebuilts'.
     10         android_sdks_dir=`echo ${ANDROID_BUILD_TOP}/prebuilt*/sdk/`
     11         latest_android_sdk=`ls -1 ${android_sdks_dir} | sort -n | tail -1`
     12         android_platform_dir=${android_sdks_dir}${latest_android_sdk}
     13     else
     14         # See if there's an Android SDK on the path.
     15         adb_path=`which adb`
     16         if [ -n "${adb_path}" ]; then
     17             android_tools_dir=`dirname ${adb_path}`
     18             android_platforms_dir=${android_tools_dir}/../platforms
     19             latest_android_platform=`ls -1 ${android_platforms_dir} | sort -n | tail -1`
     20             android_platform_dir=${android_platforms_dir}/${latest_android_platform}
     21         fi
     22     fi
     23     
     24     if [ ! -d "${android_platform_dir}" ]; then
     25         echo "vogar: error: couldn't find an SDK on the path, and don't appear to be in an Android build tree"
     26         exit 1
     27     fi
     28     
     29     ( cd `dirname $0`/.. ; ant -Dandroid.platform.dir=${android_platform_dir} jar ) || exit 1
     30 fi
     31 
     32 exec java -jar ${vogar_jar} "$@"
     33