From 3118086ff37c054a63ef1e87f04f1da91053dc91 Mon Sep 17 00:00:00 2001
From: Hannes Janetzek <hannes.janetzek@gmail.com>
Date: Sat, 1 Mar 2014 16:01:16 +0100
Subject: [PATCH] gradle: add android-example run task

---
 vtm-android-example/build.gradle | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/vtm-android-example/build.gradle b/vtm-android-example/build.gradle
index a637d7c1..8441e321 100644
--- a/vtm-android-example/build.gradle
+++ b/vtm-android-example/build.gradle
@@ -64,5 +64,17 @@ eclipse.project {
   buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder'
   buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder'
   buildCommand 'com.android.ide.eclipse.adt.ApkBuilder'
-
 }
+
+
+task run (dependsOn: 'installDebug'){
+  doFirst {
+    println(">> adb run...")
+    String adb = System.getenv()['ANDROID_HOME'] + '/platform-tools/adb'
+    String cmd = "${adb} shell am start -n org.oscim.android.test/.Samples"
+    def proc = cmd.execute()
+    proc.in.eachLine {line -> println line}
+    proc.err.eachLine {line -> System.err.println( 'ERROR: ' + line)}
+    proc.waitFor()
+  }
+}
\ No newline at end of file