cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/2] android commit: refactoring android commands
Date Tue, 20 Nov 2012 23:09:49 GMT
refactoring android commands


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/e1347e43
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/e1347e43
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/e1347e43

Branch: refs/heads/master
Commit: e1347e434e7bda8e0f0ff98fe22e603237102c1b
Parents: 7657faa
Author: Anis Kadri <anis.kadri@gmail.com>
Authored: Tue Nov 20 14:39:33 2012 -0800
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Tue Nov 20 14:39:37 2012 -0800

----------------------------------------------------------------------
 bin/create                                         |    7 +--
 .../cordova/ApplicationInfo/ApplicationInfo.class  |  Bin 0 -> 2045 bytes
 bin/templates/cordova/BOOM                         |   24 ----------
 bin/templates/cordova/BOOM.bat                     |   18 --------
 bin/templates/cordova/appinfo.jar                  |  Bin 0 -> 1574 bytes
 bin/templates/cordova/build                        |   24 ++++++++++
 bin/templates/cordova/build.bat                    |   18 ++++++++
 bin/templates/cordova/cordova                      |   35 ++++++++++----
 bin/templates/cordova/debug                        |   24 ----------
 bin/templates/cordova/debug.bat                    |   18 --------
 bin/templates/cordova/emulate                      |   24 ----------
 bin/templates/cordova/emulate.bat                  |    1 -
 bin/templates/cordova/run                          |   24 ++++++++++
 bin/templates/cordova/run.bat                      |    1 +
 14 files changed, 95 insertions(+), 123 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index 1bce739..903f55e 100755
--- a/bin/create
+++ b/bin/create
@@ -147,13 +147,12 @@ replace "s/__ACTIVITY__/${ACTIVITY}/g" "$MANIFEST_PATH"
 replace "s/__PACKAGE__/${PACKAGE}/g" "$MANIFEST_PATH"
 replace "s/__APILEVEL__/${API_LEVEL}/g" "$MANIFEST_PATH"
 
-# creating cordova folder and copying emulate/debug/log/launch scripts
+# creating cordova folder and copying run/build/log/launch scripts
 mkdir "$PROJECT_PATH"/cordova
 createAppInfoJar
 cp "$BUILD_PATH"/bin/templates/cordova/appinfo.jar "$PROJECT_PATH"/cordova/appinfo.jar
 cp "$BUILD_PATH"/bin/templates/cordova/cordova "$PROJECT_PATH"/cordova/cordova
-cp "$BUILD_PATH"/bin/templates/cordova/debug "$PROJECT_PATH"/cordova/debug
+cp "$BUILD_PATH"/bin/templates/cordova/build "$PROJECT_PATH"/cordova/build
 cp "$BUILD_PATH"/bin/templates/cordova/clean "$PROJECT_PATH"/cordova/clean
 cp "$BUILD_PATH"/bin/templates/cordova/log "$PROJECT_PATH"/cordova/log
-cp "$BUILD_PATH"/bin/templates/cordova/emulate "$PROJECT_PATH"/cordova/emulate
-cp "$BUILD_PATH"/bin/templates/cordova/BOOM "$PROJECT_PATH"/cordova/BOOM
+cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class
new file mode 100644
index 0000000..2ef42a4
Binary files /dev/null and b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/BOOM
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/BOOM b/bin/templates/cordova/BOOM
deleted file mode 100755
index 443502d..0000000
--- a/bin/templates/cordova/BOOM
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#!/bin/bash
-
-set -e
-
-CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
-
-bash $CORDOVA_PATH/cordova BOOM

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/BOOM.bat
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/BOOM.bat b/bin/templates/cordova/BOOM.bat
deleted file mode 100644
index 7b83f2a..0000000
--- a/bin/templates/cordova/BOOM.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-:: Licensed to the Apache Software Foundation (ASF) under one
-:: or more contributor license agreements.  See the NOTICE file
-:: distributed with this work for additional information
-:: regarding copyright ownership.  The ASF licenses this file
-:: to you under the Apache License, Version 2.0 (the
-:: "License"); you may not use this file except in compliance
-:: with the License.  You may obtain a copy of the License at
-:: 
-:: http://www.apache.org/licenses/LICENSE-2.0
-:: 
-:: Unless required by applicable law or agreed to in writing,
-:: software distributed under the License is distributed on an
-:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-:: KIND, either express or implied.  See the License for the
-:: specific language governing permissions and limitations
-:: under the License.
-
-%~dp0\cordova.bat BOOM

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/appinfo.jar
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/appinfo.jar b/bin/templates/cordova/appinfo.jar
new file mode 100644
index 0000000..31d01d7
Binary files /dev/null and b/bin/templates/cordova/appinfo.jar differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/build
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/build b/bin/templates/cordova/build
new file mode 100755
index 0000000..e586e4d
--- /dev/null
+++ b/bin/templates/cordova/build
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#!/bin/bash
+
+set -e
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
+
+bash "$CORDOVA_PATH"/cordova build

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/build.bat
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/build.bat b/bin/templates/cordova/build.bat
new file mode 100644
index 0000000..8e6ca9a
--- /dev/null
+++ b/bin/templates/cordova/build.bat
@@ -0,0 +1,18 @@
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements.  See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership.  The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License.  You may obtain a copy of the License at
+:: 
+:: http://www.apache.org/licenses/LICENSE-2.0
+:: 
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied.  See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+%~dp0\cordova.bat build

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/cordova
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/cordova b/bin/templates/cordova/cordova
index 1a1a487..561663b 100755
--- a/bin/templates/cordova/cordova
+++ b/bin/templates/cordova/cordova
@@ -22,7 +22,7 @@ set -e
 PROJECT_PATH=$( cd "$( dirname "$0" )/.." && pwd )
 
 function check_devices {
-    local devices=`adb devices | awk '/List of devices attached/ { while(getline > 0)
{ print }}'`
+    local devices=`adb devices | awk '/List of devices attached/ { while(getline > 0)
{ print }}' | grep device`
     if [ -z "$devices"  ] ; then
         echo "1"
     else
@@ -37,7 +37,7 @@ function emulate {
 
     # Do not launch an emulator if there is already one running or if a device is attached
     if [ $(check_devices) == 0 ] ; then
-        echo "Device attached or emulator already running"
+        # echo "Device attached or emulator already running"
         return
     fi
 
@@ -78,25 +78,40 @@ function log {
     adb logcat
 }
 
-function debug {
+function run {
     if [ $(check_devices) == 0 ] ; then
-        ant debug install
+        clean && emulate && install && launch 
     else
-        ant debug
+        build
         echo "##################################################################"
-        echo "# Plug in your device or launch an emulator with cordova/emulate #"
+        echo "# Plug in your device or launch an emulator with cordova/run #"
         echo "##################################################################"
     fi
 }
 
+function install {
+    ant debug install
+}
+
+function build {
+    ant debug
+}
+
+function wait_for_device {
+    local i=0
+    echo "Waiting for emulator..."
+    while [ check_devices -eq 0 || timeout -lt 300 ]
+    do
+        sleep 1
+        i=$[i+1]
+    end
+
+}
+
 function launch {
     local launch_str=$(java -jar "$PROJECT_PATH"/cordova/appinfo.jar "$PROJECT_PATH"/AndroidManifest.xml)
     adb shell am start -n $launch_str 
 }
 
-function BOOM {
-    clean && debug && launch 
-}
-
 # TODO parse arguments
 (cd "$PROJECT_PATH" && $1)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/debug
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/debug b/bin/templates/cordova/debug
deleted file mode 100755
index aaa5978..0000000
--- a/bin/templates/cordova/debug
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#!/bin/bash
-
-set -e
-
-CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
-
-bash "$CORDOVA_PATH"/cordova debug

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/debug.bat
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/debug.bat b/bin/templates/cordova/debug.bat
deleted file mode 100644
index f980eb7..0000000
--- a/bin/templates/cordova/debug.bat
+++ /dev/null
@@ -1,18 +0,0 @@
-:: Licensed to the Apache Software Foundation (ASF) under one
-:: or more contributor license agreements.  See the NOTICE file
-:: distributed with this work for additional information
-:: regarding copyright ownership.  The ASF licenses this file
-:: to you under the Apache License, Version 2.0 (the
-:: "License"); you may not use this file except in compliance
-:: with the License.  You may obtain a copy of the License at
-:: 
-:: http://www.apache.org/licenses/LICENSE-2.0
-:: 
-:: Unless required by applicable law or agreed to in writing,
-:: software distributed under the License is distributed on an
-:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-:: KIND, either express or implied.  See the License for the
-:: specific language governing permissions and limitations
-:: under the License.
-
-%~dp0\cordova.bat debug

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/emulate
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/emulate b/bin/templates/cordova/emulate
deleted file mode 100755
index fe27b2f..0000000
--- a/bin/templates/cordova/emulate
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#!/bin/bash
-
-set -e
-
-CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
-
-bash "$CORDOVA_PATH"/cordova emulate

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/emulate.bat
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/emulate.bat b/bin/templates/cordova/emulate.bat
deleted file mode 100644
index 87ef969..0000000
--- a/bin/templates/cordova/emulate.bat
+++ /dev/null
@@ -1 +0,0 @@
-%~dp0\cordova.bat emulate

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/run
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/run b/bin/templates/cordova/run
new file mode 100755
index 0000000..840a8d5
--- /dev/null
+++ b/bin/templates/cordova/run
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#!/bin/bash
+
+set -e
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
+
+bash "$CORDOVA_PATH"/cordova run

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/e1347e43/bin/templates/cordova/run.bat
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/run.bat b/bin/templates/cordova/run.bat
new file mode 100644
index 0000000..7c470ed
--- /dev/null
+++ b/bin/templates/cordova/run.bat
@@ -0,0 +1 @@
+%~dp0\cordova.bat run


Mime
View raw message