commit 2af93a1abe023fe7886ba09decb3434e4823c73f
parent 4272dad5c2d896befc743e63044b71c1fc59bec3
Author: clamiax <smoppy@gmail.com>
Date: Thu, 29 Oct 2015 13:56:38 +0100
Platform now goes to ~/.android-sdk.
Added some echos in do_setup() to give a bit of feedback about what is happening. The tarballs are now removed after setup. g Also update the README with the current usage.
Diffstat:
2 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
@@ -152,6 +152,22 @@ droid
-----
Sane Android Development.
+```
+$ droid
+Usage: droid <cmd>
+
+Commands:
+ setup : creates the development environment
+ install : install the app into the device
+ upload : upload the app into the device
+ build : build the app (if no task, assumes assembleDebug)
+ upgrade : build and install the app (assembleDebug)
+ deploy : build and install the app (assembleRelease)
+ init : create a new project into the current directory
+ clean : remove all builds
+ help : print this help
+```
+
browse
------
Little dmenu-based file browser which output the selected file (if any).
diff --git a/src/droid b/src/droid
@@ -1,10 +1,7 @@
#!/bin/sh
# Sane Android development.
-# https://spring.io/guides/gs/gradle-android/
-
-BASEDIR="/home/claudio/sources/droid"
-
+BASEDIR=~/.android-sdk
SDKDIR="$BASEDIR/android-sdk-linux"
GRADLE="$BASEDIR/gradle-2.3/bin/gradle"
ADB="$SDKDIR/platform-tools/adb"
@@ -22,24 +19,30 @@ _adb() {
}
do_setup() {
- tmpd=/tmp/.droid
+ tmpd="$BASEDIR/tmp"
if [ ! -d "$tmpd" ]; then
- mkdir "$tmpd"
+ mkdir -p "$tmpd"
fi
cd "$tmpd"
+ echo "Downloading..."
wget -O sdk.tgz -qc "$SDK_URL"
wget -O gradle.zip -qc "$GRADLE_URL"
- [ ! -d "android-sdk-linux" ] && tar zxf sdk.tgz
- [ ! -d "gradle-2.3" ] && unzip gradle.zip
+ echo "Extracting..."
+ [ ! -d "$BASEDIR/android-sdk-linux" ] && tar zxf sdk.tgz -C "$BASEDIR"
+ [ ! -d "$BASEDIR/gradle-2.3" ] && unzip -qq gradle.zip -d "$BASEDIR"
+
+ echo "Cleaning up..."
+ rm -f "$tmpd"
- # XXX remove the tarball
+ cd "$OLDPWD"
# Need to install the SDK tools, build tools and system image
- $SDKDIR/tools/android
+ echo "You need to manually select the features. Opening the SDK manager..."
+ $SDKDIR/tools/android 2>/dev/null
- cd -
+ echo "done."
}
do_install() {
@@ -54,7 +57,7 @@ do_uninstall() {
# XXX real device or emulator
do_upload() {
# _adb push
- echo 'upload'
+ echo 'To be implemented.'
}
do_build() {
@@ -78,7 +81,7 @@ do_deploy() {
}
do_init() {
- echo 'init'
+ echo 'To be implemented.'
}
die() {
@@ -87,7 +90,7 @@ die() {
}
usage() {
- echo "Usage: $0 <cmd>"
+ echo "Usage: $(basename "$0") <cmd>"
echo "
Commands:
@@ -98,7 +101,7 @@ Commands:
upgrade\t: build and install the app (assembleDebug)
deploy\t: build and install the app (assembleRelease)
init\t\t: create a new project into the current directory
- clean\t: remove all builds
+ clean\t: removes the builds from the current directory
help\t\t: print this help
"