build-scripts/androidbuild.sh
author Ryan C. Gordon <icculus@icculus.org>
Sun, 28 Aug 2016 13:36:13 -0400
changeset 10286 3b884985835c
parent 10200 c678dcec4f44
permissions -rwxr-xr-x
Merge audio capture work back into the mainline.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7793
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     1
#!/bin/bash
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     2
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     3
SOURCES=()
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     4
MKSOURCES=""
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     5
CURDIR=`pwd -P`
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     6
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     7
# Fetch sources
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     8
if [[ $# -ge 2 ]]; then
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     9
    for src in ${@:2}
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    10
    do
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    11
        SOURCES+=($src)
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    12
        MKSOURCES="$MKSOURCES $(basename $src)"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    13
    done
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    14
else
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    15
    if [ -n "$1" ]; then
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    16
        while read src
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    17
        do
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    18
            SOURCES+=($src)
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    19
            MKSOURCES="$MKSOURCES $(basename $src)"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    20
        done
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    21
    fi
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    22
fi
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    23
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    24
if [ -z "$1" ] || [ -z "$SOURCES" ]; then
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    25
    echo "Usage: androidbuild.sh com.yourcompany.yourapp < sources.list"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    26
    echo "Usage: androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c"
7907
24b4e98c6010 Adds Joystick support for Android
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7793
diff changeset
    27
    echo "To copy SDL source instead of symlinking: COPYSOURCE=1 androidbuild.sh ... "
7974
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    28
    echo "You can pass additional arguments to ndk-build with the NDKARGS variable: NDKARGS=\"-s\" androidbuild.sh ..."
7793
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    29
    exit 1
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    30
fi
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    31
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    32
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    33
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    34
SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    35
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    36
NDKBUILD=`which ndk-build`
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    37
if [ -z "$NDKBUILD" ];then
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    38
    echo "Could not find the ndk-build utility, install Android's NDK and add it to the path"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    39
    exit 1
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    40
fi
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    41
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    42
ANDROID=`which android`
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    43
if [ -z "$ANDROID" ];then
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    44
    echo "Could not find the android utility, install Android's SDK and add it to the path"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    45
    exit 1
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    46
fi
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    47
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    48
ANT=`which ant`
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    49
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    50
if [ -z "$ANT" ];then
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    51
    echo "Could not find the ant utility, install Android's SDK and add it to the path"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    52
    exit 1
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    53
fi
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    54
7974
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    55
NCPUS="1"
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    56
case "$OSTYPE" in
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    57
    darwin*)
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    58
        NCPU=`sysctl -n hw.ncpu`
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    59
        ;; 
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    60
    linux*)
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    61
        if [ -n `which nproc` ]; then
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    62
            NCPUS=`nproc`
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    63
        fi  
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    64
        ;;
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    65
  *);;
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    66
esac
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
    67
7793
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    68
APP="$1"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    69
APPARR=(${APP//./ })
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    70
BUILDPATH="$SDLPATH/build/$APP"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    71
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    72
# Start Building
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    73
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    74
rm -rf $BUILDPATH
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    75
mkdir -p $BUILDPATH
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    76
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    77
cp -r $SDLPATH/android-project/* $BUILDPATH
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    78
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    79
# Copy SDL sources
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    80
mkdir -p $BUILDPATH/jni/SDL
7907
24b4e98c6010 Adds Joystick support for Android
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7793
diff changeset
    81
if [ -z "$COPYSOURCE" ]; then
24b4e98c6010 Adds Joystick support for Android
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7793
diff changeset
    82
    ln -s $SDLPATH/src $BUILDPATH/jni/SDL
24b4e98c6010 Adds Joystick support for Android
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7793
diff changeset
    83
    ln -s $SDLPATH/include $BUILDPATH/jni/SDL
24b4e98c6010 Adds Joystick support for Android
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7793
diff changeset
    84
else
24b4e98c6010 Adds Joystick support for Android
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7793
diff changeset
    85
    cp -r $SDLPATH/src $BUILDPATH/jni/SDL
24b4e98c6010 Adds Joystick support for Android
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7793
diff changeset
    86
    cp -r $SDLPATH/include $BUILDPATH/jni/SDL
24b4e98c6010 Adds Joystick support for Android
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7793
diff changeset
    87
fi
24b4e98c6010 Adds Joystick support for Android
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7793
diff changeset
    88
24b4e98c6010 Adds Joystick support for Android
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7793
diff changeset
    89
cp -r $SDLPATH/Android.mk $BUILDPATH/jni/SDL
10200
c678dcec4f44 Android: Fixed androidbuild.sh not working on OS X (thanks, Steffen!).
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9823
diff changeset
    90
sed -i -e "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/jni/src/Android.mk
c678dcec4f44 Android: Fixed androidbuild.sh not working on OS X (thanks, Steffen!).
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9823
diff changeset
    91
sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/AndroidManifest.xml
7793
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    92
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    93
# Copy user sources
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    94
for src in "${SOURCES[@]}"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    95
do
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    96
    cp $src $BUILDPATH/jni/src
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    97
done
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    98
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    99
# Create an inherited Activity
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   100
cd $BUILDPATH/src
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   101
for folder in "${APPARR[@]}"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   102
do
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   103
    mkdir -p $folder
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   104
    cd $folder
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   105
done
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   106
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   107
ACTIVITY="${folder}Activity"
10200
c678dcec4f44 Android: Fixed androidbuild.sh not working on OS X (thanks, Steffen!).
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9823
diff changeset
   108
sed -i -e "s|SDLActivity|$ACTIVITY|g" $BUILDPATH/AndroidManifest.xml
c678dcec4f44 Android: Fixed androidbuild.sh not working on OS X (thanks, Steffen!).
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9823
diff changeset
   109
sed -i -e "s|SDLActivity|$APP|g" $BUILDPATH/build.xml
7793
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   110
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   111
# Fill in a default Activity
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   112
echo "package $APP;" >  "$ACTIVITY.java"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   113
echo "import org.libsdl.app.SDLActivity;" >> "$ACTIVITY.java"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   114
echo "public class $ACTIVITY extends SDLActivity {}" >> "$ACTIVITY.java"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   115
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   116
# Update project and build
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   117
cd $BUILDPATH
9823
9fb8a612dd7c Android: Changed androidbuild.sh to use path from variable.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7974
diff changeset
   118
$ANDROID update project --path $BUILDPATH
7974
8af2b2344e9e Updated androidbuild.sh to enable parallel builds and ndk-build parameters
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7907
diff changeset
   119
$NDKBUILD -j $NCPUS $NDKARGS
7793
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   120
$ANT debug
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   121
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   122
cd $CURDIR
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   123
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   124
APK="$BUILDPATH/bin/$APP-debug.apk"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   125
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   126
if [ -f "$APK" ]; then
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   127
    echo "Your APK is ready at $APK"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   128
    echo "To install to your device: "
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   129
    echo "cd  $BUILDPATH"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   130
    echo "ant debug install"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   131
    exit 0
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   132
fi
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   133
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   134
echo "There was an error building the APK"
6463a850229d Adds test framework to Android.mk and a simple utility to build Android projects
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   135
exit 1