diff --git a/bin/create b/bin/create index 1bce739e..903f55ee 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 diff --git a/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class new file mode 100644 index 00000000..2ef42a46 Binary files /dev/null and b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class differ diff --git a/bin/templates/cordova/appinfo.jar b/bin/templates/cordova/appinfo.jar new file mode 100644 index 00000000..31d01d75 Binary files /dev/null and b/bin/templates/cordova/appinfo.jar differ diff --git a/bin/templates/cordova/debug b/bin/templates/cordova/build similarity index 96% rename from bin/templates/cordova/debug rename to bin/templates/cordova/build index aaa59780..e586e4d6 100755 --- a/bin/templates/cordova/debug +++ b/bin/templates/cordova/build @@ -21,4 +21,4 @@ set -e CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) -bash "$CORDOVA_PATH"/cordova debug +bash "$CORDOVA_PATH"/cordova build diff --git a/bin/templates/cordova/BOOM.bat b/bin/templates/cordova/build.bat similarity index 97% rename from bin/templates/cordova/BOOM.bat rename to bin/templates/cordova/build.bat index 7b83f2ac..8e6ca9ad 100644 --- a/bin/templates/cordova/BOOM.bat +++ b/bin/templates/cordova/build.bat @@ -15,4 +15,4 @@ :: specific language governing permissions and limitations :: under the License. -%~dp0\cordova.bat BOOM +%~dp0\cordova.bat build diff --git a/bin/templates/cordova/cordova b/bin/templates/cordova/cordova index 1a1a4870..561663b5 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) diff --git a/bin/templates/cordova/debug.bat b/bin/templates/cordova/debug.bat deleted file mode 100644 index f980eb72..00000000 --- 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 diff --git a/bin/templates/cordova/emulate b/bin/templates/cordova/emulate deleted file mode 100755 index fe27b2f3..00000000 --- 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 diff --git a/bin/templates/cordova/emulate.bat b/bin/templates/cordova/emulate.bat deleted file mode 100644 index 87ef969f..00000000 --- a/bin/templates/cordova/emulate.bat +++ /dev/null @@ -1 +0,0 @@ -%~dp0\cordova.bat emulate diff --git a/bin/templates/cordova/BOOM b/bin/templates/cordova/run similarity index 96% rename from bin/templates/cordova/BOOM rename to bin/templates/cordova/run index 443502d8..840a8d5a 100755 --- a/bin/templates/cordova/BOOM +++ b/bin/templates/cordova/run @@ -21,4 +21,4 @@ set -e CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) -bash $CORDOVA_PATH/cordova BOOM +bash "$CORDOVA_PATH"/cordova run diff --git a/bin/templates/cordova/run.bat b/bin/templates/cordova/run.bat new file mode 100644 index 00000000..7c470ed8 --- /dev/null +++ b/bin/templates/cordova/run.bat @@ -0,0 +1 @@ +%~dp0\cordova.bat run