#! /bin/sh

echo "updating FreeWRLVersion.java"
VERSION_VALUE=`cat ../freex3d/versions/FREEWRL`
VERSION_DATE=`date "+%Y-%m-%d:%H:%M:%S"`
echo $VERSION_VALUE
echo $VERSION_DATE
sed 's/static String version.*;/static String version = "'"$VERSION_VALUE"'";/' < src/org/freewrl/FreeWRLVersion.java > /tmp/step1
sed 's/static String compileDate.*;/static String compileDate = "'"$VERSION_DATE"'";/' < /tmp/step1 > src/org/freewrl/FreeWRLVersion.java
rm /tmp/step1

ant clean

#lint the whole project
#/Users/johns/Desktop/Android-tests-current/android_tools/android-sdk-macosx/tools/lint .

cd jni
/Users/johns/Desktop/Android-tests-current/android_tools/android-ndk-r7/ndk-build
cd ..
ant debug

#lint the whole project
#note -this will give lots of errors for ActionBarSherlock, so is commented out for now.
#/Users/johns/Desktop/Android-tests-current/android_tools/android-sdk-macosx/tools/lint .

echo
#echo "installing on Iconia A500"
#adb -s 388924841bf5497 install -r ./bin/FreeWRL-debug-unaligned.apk
#echo "installing on Nexus S"
#adb -s 313000C1ED5500EC install -r ./bin/FreeWRL-debug-unaligned.apk
#adb -s 1000c8cd1669 install -r ./bin/FreeWRL-debug-unaligned.apk

#echo "trying emulator"
#adb install -r ./bin/FreeWRL-debug-unaligned.apk

