summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Firth <locallycompact@gmail.com>2012-09-22 20:27:17 +0100
committerDan Firth <locallycompact@gmail.com>2012-09-22 20:27:17 +0100
commit89972b4939283af4a401bb7bd6f093ed4a83cfc0 (patch)
treeae2436402022c22b80e6be87ee08b4954639ee57
parent63c390a3b81640fe0d2baaeccf8646eab033018f (diff)
downloadsanity-bag-89972b4939283af4a401bb7bd6f093ed4a83cfc0.tar.bz2
Added script to make a standard android application with a test applicationHEADmaster
-rwxr-xr-xscripts/android-standard-repo49
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/android-standard-repo b/scripts/android-standard-repo
new file mode 100755
index 0000000..7468e15
--- /dev/null
+++ b/scripts/android-standard-repo
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+ERROR_MESSAGE="Error: The parameters --target, --path, --package, --activity, --name must be defined for an android-standard-repo\n"
+HELP_MESSAGE="Usage: android-standard-repo [action options]\n
+\n
+ Options:\n
+\t--name : Project name. [required] \n
+\t--target : Target ID of the new project. [required]\n
+\t--path : The new project's directory. [required]\n
+\t--package : Android package name for the application. [required]\n
+\t--activity: Name of the default Activity that is created. [required]"
+
+OPTS=`getopt -s bash -o aknpt -l activity: -l name: -l package: -l path: -l target: -- "$@"`
+if [ $? != 0 ]
+then
+ exit 1
+fi
+
+eval set -- "$OPTS"
+
+while [ "x$1" != "x" ] ; do
+ case "$1" in
+ --activity) ACTIVITY=$2; shift 2;;
+ --name) NAME=$2; shift 2;;
+ --package) PACKAGE=$2; shift 2;;
+ --path) PROJECT_PATH=$2; shift 2;;
+ --target) TARGET=$2; shift 2;;
+ --) shift; break;;
+ esac
+done
+
+if [ -z "$ACTIVITY" -o -z "$NAME" -o -z "$PACKAGE" -o -z "$PROJECT_PATH" -o -z "$TARGET" ]; then
+ echo -e $ERROR_MESSAGE;
+ echo -e $HELP_MESSAGE;
+ exit
+fi;
+
+git init $PROJECT_PATH
+cd $PROJECT_PATH
+android create project --name $NAME --target $TARGET --path application --package $PACKAGE --activity $ACTIVITY
+android create test-project --name Test$NAME --path tests --main ../application
+echo "bin" >> .gitignore
+echo "obj" >> .gitignore
+echo "gen" >> .gitignore
+echo "local.properties" >> .gitignore
+echo "proguard-project.txt" >> .gitignore
+git add *
+git add .gitignore
+git commit -a -m "Initial project structure"