mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 20:33:07 +08:00
[CB-2914] Cli script migration for unix bash
This commit is contained in:
parent
4599e9897d
commit
4dee30ed84
11
bin/create
11
bin/create
@ -158,11 +158,18 @@ replace "s/__APILEVEL__/${API_LEVEL}/g" "$MANIFEST_PATH"
|
|||||||
|
|
||||||
# creating cordova folder and copying run/build/log/launch scripts
|
# creating cordova folder and copying run/build/log/launch scripts
|
||||||
mkdir "$PROJECT_PATH"/cordova
|
mkdir "$PROJECT_PATH"/cordova
|
||||||
|
mkdir "$PROJECT_PATH"/cordova/lib
|
||||||
createAppInfoJar
|
createAppInfoJar
|
||||||
cp "$BUILD_PATH"/bin/templates/cordova/appinfo.jar "$PROJECT_PATH"/cordova/appinfo.jar
|
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/build "$PROJECT_PATH"/cordova/build
|
cp "$BUILD_PATH"/bin/templates/cordova/build "$PROJECT_PATH"/cordova/build
|
||||||
cp "$BUILD_PATH"/bin/templates/cordova/release "$PROJECT_PATH"/cordova/release
|
|
||||||
cp "$BUILD_PATH"/bin/templates/cordova/clean "$PROJECT_PATH"/cordova/clean
|
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/log "$PROJECT_PATH"/cordova/log
|
||||||
cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run
|
cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/cordova "$PROJECT_PATH"/cordova/lib/cordova
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/install-device "$PROJECT_PATH"/cordova/lib/install-device
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/install-emulator "$PROJECT_PATH"/cordova/lib/install-emulator
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/list-devices "$PROJECT_PATH"/cordova/lib/list-devices
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/list-emulator-images "$PROJECT_PATH"/cordova/lib/list-emulator-images
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/list-started-emulators "$PROJECT_PATH"/cordova/lib/list-started-emulators
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/start-emulator "$PROJECT_PATH"/cordova/lib/start-emulator
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
# or more contributor license agreements. See the NOTICE file
|
# or more contributor license agreements. See the NOTICE file
|
||||||
# distributed with this work for additional information
|
# distributed with this work for additional information
|
||||||
@ -15,10 +16,8 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||||
|
|
||||||
bash "$CORDOVA_PATH"/cordova build
|
bash "$CORDOVA_PATH"/lib/cordova build "$@"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
# or more contributor license agreements. See the NOTICE file
|
# or more contributor license agreements. See the NOTICE file
|
||||||
# distributed with this work for additional information
|
# distributed with this work for additional information
|
||||||
@ -15,10 +16,8 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||||
|
|
||||||
bash "$CORDOVA_PATH"/cordova clean
|
bash "$CORDOVA_PATH"/lib/cordova clean "$@"
|
||||||
|
@ -1,159 +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
|
|
||||||
|
|
||||||
|
|
||||||
PROJECT_PATH=$( cd "$( dirname "$0" )/.." && pwd )
|
|
||||||
|
|
||||||
function check_devices {
|
|
||||||
# FIXME
|
|
||||||
local devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep device`
|
|
||||||
if [ -z "$devices" ] ; then
|
|
||||||
echo "1"
|
|
||||||
else
|
|
||||||
echo "0"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function emulate {
|
|
||||||
declare -a avd_list=($(android list avd | grep "Name:" | cut -f 2 -d ":" | xargs))
|
|
||||||
# we need to start adb-server
|
|
||||||
adb start-server 1>/dev/null
|
|
||||||
|
|
||||||
# Do not launch an emulator if there is already one running or if a device is attached
|
|
||||||
if [ $(check_devices) == 0 ] ; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
local avd_id="1000" #FIXME: hopefully user does not have 1000 AVDs
|
|
||||||
# User has no AVDs
|
|
||||||
if [ ${#avd_list[@]} == 0 ]
|
|
||||||
then
|
|
||||||
echo "You don't have any Android Virtual Devices. Please create at least one AVD."
|
|
||||||
echo "android"
|
|
||||||
fi
|
|
||||||
# User has only one AVD
|
|
||||||
if [ ${#avd_list[@]} == 1 ]
|
|
||||||
then
|
|
||||||
emulator -cpu-delay 0 -no-boot-anim -cache /tmp/cache -avd ${avd_list[0]} 1> /dev/null 2>&1 &
|
|
||||||
# User has more than 1 AVD
|
|
||||||
elif [ ${#avd_list[@]} -gt 1 ]
|
|
||||||
then
|
|
||||||
while [ -z ${avd_list[$avd_id]} ]
|
|
||||||
do
|
|
||||||
echo "Choose from one of the following Android Virtual Devices [0 to $((${#avd_list[@]}-1))]:"
|
|
||||||
for(( i = 0 ; i < ${#avd_list[@]} ; i++ ))
|
|
||||||
do
|
|
||||||
echo "$i) ${avd_list[$i]}"
|
|
||||||
done
|
|
||||||
read -t 5 -p "> " avd_id
|
|
||||||
# default value if input timeout
|
|
||||||
if [ $avd_id -eq 1000 ] ; then avd_id=0 ; fi
|
|
||||||
done
|
|
||||||
emulator -cpu-delay 0 -no-boot-anim -cache /tmp/cache -avd ${avd_list[$avd_id]} 1> /dev/null 2>&1 &
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function clean {
|
|
||||||
ant clean
|
|
||||||
}
|
|
||||||
# has to be used independently and not in conjunction with other commands
|
|
||||||
function log {
|
|
||||||
adb logcat
|
|
||||||
}
|
|
||||||
|
|
||||||
function run {
|
|
||||||
clean && emulate && wait_for_device && install && launch
|
|
||||||
}
|
|
||||||
|
|
||||||
function install {
|
|
||||||
|
|
||||||
declare -a devices=($(adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep device | cut -f 1))
|
|
||||||
local device_id="1000" #FIXME: hopefully user does not have 1000 AVDs
|
|
||||||
|
|
||||||
if [ ${#devices[@]} == 0 ]
|
|
||||||
then
|
|
||||||
# should not reach here. Emulator should launch or device should be attached
|
|
||||||
echo "Emulator not running or device not attached. Could not install debug package"
|
|
||||||
exit 70
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${#devices[@]} == 1 ]
|
|
||||||
then
|
|
||||||
export ANDROID_SERIAL=${devices[0]}
|
|
||||||
# User has more than 1 AVD
|
|
||||||
elif [ ${#devices[@]} -gt 1 ]
|
|
||||||
then
|
|
||||||
while [ -z ${devices[$device_id]} ]
|
|
||||||
do
|
|
||||||
echo "Choose from one of the following devices/emulators [0 to $((${#devices[@]}-1))]:"
|
|
||||||
for(( i = 0 ; i < ${#devices[@]} ; i++ ))
|
|
||||||
do
|
|
||||||
echo "$i) ${devices[$i]}"
|
|
||||||
done
|
|
||||||
read -t 5 -p "> " device_id
|
|
||||||
# default value if input timeout
|
|
||||||
if [ $device_id -eq 1000 ] ; then device_id=0 ; fi
|
|
||||||
done
|
|
||||||
export ANDROID_SERIAL=${devices[$device_id]}
|
|
||||||
fi
|
|
||||||
|
|
||||||
ant debug install
|
|
||||||
}
|
|
||||||
|
|
||||||
function build {
|
|
||||||
ant debug
|
|
||||||
}
|
|
||||||
|
|
||||||
function release {
|
|
||||||
ant release
|
|
||||||
}
|
|
||||||
|
|
||||||
function wait_for_device {
|
|
||||||
local i="0"
|
|
||||||
echo -n "Waiting for device..."
|
|
||||||
|
|
||||||
while [ $i -lt 300 ]
|
|
||||||
do
|
|
||||||
if [ $(check_devices) -eq 0 ]
|
|
||||||
then
|
|
||||||
break
|
|
||||||
else
|
|
||||||
sleep 1
|
|
||||||
i=$[i+1]
|
|
||||||
echo -n "."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
# Device timeout: emulator has not started in time or device not attached
|
|
||||||
if [ $i -eq 300 ]
|
|
||||||
then
|
|
||||||
echo "device timeout!"
|
|
||||||
exit 69
|
|
||||||
else
|
|
||||||
echo "connected!"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function launch {
|
|
||||||
local launch_str=$(java -jar "$PROJECT_PATH"/cordova/appinfo.jar "$PROJECT_PATH"/AndroidManifest.xml)
|
|
||||||
adb shell am start -n $launch_str
|
|
||||||
}
|
|
||||||
|
|
||||||
# TODO parse arguments
|
|
||||||
(cd "$PROJECT_PATH" && $1)
|
|
137
bin/templates/cordova/cordova.js
vendored
137
bin/templates/cordova/cordova.js
vendored
@ -1,137 +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.
|
|
||||||
|
|
||||||
var ROOT = WScript.ScriptFullName.split('\\cordova\\cordova.js').join(''),
|
|
||||||
shell=WScript.CreateObject("WScript.Shell");
|
|
||||||
|
|
||||||
function exec(command) {
|
|
||||||
var oExec=shell.Exec(command);
|
|
||||||
var output = new String();
|
|
||||||
while(oExec.Status == 0) {
|
|
||||||
if(!oExec.StdOut.AtEndOfStream) {
|
|
||||||
var line = oExec.StdOut.ReadLine();
|
|
||||||
// XXX: Change to verbose mode
|
|
||||||
// WScript.StdOut.WriteLine(line);
|
|
||||||
output += line;
|
|
||||||
}
|
|
||||||
WScript.sleep(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
function device_running() {
|
|
||||||
var local_devices = shell.Exec("%comspec% /c adb devices").StdOut.ReadAll();
|
|
||||||
if(local_devices.match(/\w+\tdevice/)) {
|
|
||||||
WScript.Echo("Yes");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
WScript.Echo("No");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function emulate() {
|
|
||||||
// don't run emulator if a device is plugged in or if emulator is already running
|
|
||||||
if(device_running()) {
|
|
||||||
//WScript.Echo("Device or Emulator already running!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var oExec = shell.Exec("%comspec% /c android.bat list avd");
|
|
||||||
var avd_list = [];
|
|
||||||
var avd_id = -10;
|
|
||||||
while(!oExec.StdOut.AtEndOfStream) {
|
|
||||||
var output = oExec.StdOut.ReadLine();
|
|
||||||
if(output.match(/Name: (.)*/)) {
|
|
||||||
avd_list.push(output.replace(/ *Name:\s/, ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// user has no AVDs
|
|
||||||
if(avd_list.length == 0) {
|
|
||||||
WScript.Echo("You don't have any Android Virtual Devices. Please create at least one AVD.");
|
|
||||||
WScript.Echo("android");
|
|
||||||
WScript.Quit(1);
|
|
||||||
}
|
|
||||||
// user has only one AVD so we launch that one
|
|
||||||
if(avd_list.length == 1) {
|
|
||||||
|
|
||||||
shell.Run("emulator -cpu-delay 0 -no-boot-anim -cache %Temp%\cache -avd "+avd_list[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// user has more than one avd so we ask them to choose
|
|
||||||
if(avd_list.length > 1) {
|
|
||||||
while(!avd_list[avd_id]) {
|
|
||||||
WScript.Echo("Choose from one of the following Android Virtual Devices [0 to "+(avd_list.length - 1)+"]:")
|
|
||||||
for(i = 0, j = avd_list.length ; i < j ; i++) {
|
|
||||||
WScript.Echo((i)+") "+avd_list[i]);
|
|
||||||
}
|
|
||||||
WScript.StdOut.Write("> ");
|
|
||||||
avd_id = new Number(WScript.StdIn.ReadLine());
|
|
||||||
}
|
|
||||||
|
|
||||||
shell.Run("emulator -cpu-delay 0 -no-boot-anim -cache %Temp%\\cache -avd "+avd_list[avd_id], 0, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function clean() {
|
|
||||||
WScript.Echo("Cleaning project...");
|
|
||||||
exec("%comspec% /c ant.bat clean -f "+ROOT+"\\build.xml 2>&1");
|
|
||||||
}
|
|
||||||
|
|
||||||
function build() {
|
|
||||||
WScript.Echo("Building project...");
|
|
||||||
exec("%comspec% /c ant.bat debug -f "+ROOT+"\\build.xml 2>&1");
|
|
||||||
}
|
|
||||||
|
|
||||||
function install() {
|
|
||||||
WScript.Echo("Building/Installing project...");
|
|
||||||
exec("%comspec% /c ant.bat debug install -f "+ROOT+"\\build.xml 2>&1");
|
|
||||||
}
|
|
||||||
|
|
||||||
function log() {
|
|
||||||
shell.Run("%comspec% /c adb logcat");
|
|
||||||
}
|
|
||||||
|
|
||||||
function launch() {
|
|
||||||
WScript.Echo("Launching app...");
|
|
||||||
var launch_str=exec("%comspec% /c java -jar "+ROOT+"\\cordova\\appinfo.jar "+ROOT+"\\AndroidManifest.xml");
|
|
||||||
//WScript.Echo(launch_str);
|
|
||||||
exec("%comspec% /c adb shell am start -n "+launch_str+" 2>&1");
|
|
||||||
}
|
|
||||||
|
|
||||||
function run() {
|
|
||||||
var i=0;
|
|
||||||
clean();
|
|
||||||
emulate();
|
|
||||||
WScript.Stdout.Write('Waiting for device...');
|
|
||||||
while(!device_running() && i < 300) {
|
|
||||||
WScript.Stdout.Write('.');
|
|
||||||
WScript.sleep(1000);
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
if(i == 300) {
|
|
||||||
WScript.Stderr.WriteLine("device/emulator timeout!");
|
|
||||||
} else {
|
|
||||||
WScript.Stdout.WriteLine("connected!");
|
|
||||||
}
|
|
||||||
install();
|
|
||||||
launch();
|
|
||||||
}
|
|
||||||
var args = WScript.Arguments;
|
|
||||||
if(args.count() != 1) {
|
|
||||||
WScript.StdErr.Write("An error has occured!\n");
|
|
||||||
WScript.Quit(1);
|
|
||||||
}
|
|
||||||
eval(args(0)+"()");
|
|
386
bin/templates/cordova/lib/cordova
Executable file
386
bin/templates/cordova/lib/cordova
Executable file
@ -0,0 +1,386 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
PROJECT_PATH=$( cd "$( dirname "$0" )/../.." && pwd )
|
||||||
|
|
||||||
|
function list_devices {
|
||||||
|
IFS=$'\n'
|
||||||
|
devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep -v 'emulator'`
|
||||||
|
device_list=($devices)
|
||||||
|
if [[ ${#device_list[@]} > 0 ]] ; then
|
||||||
|
for i in ${devices[@]}
|
||||||
|
do
|
||||||
|
# remove space and 'device'
|
||||||
|
echo ${i/[^a-zA-Z0-9._]device/}
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "No devices found."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function list_started_emulators {
|
||||||
|
IFS=$'\n'
|
||||||
|
devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'`
|
||||||
|
emulator_list=($devices)
|
||||||
|
if [[ ${#emulator_list[@]} > 0 ]] ; then
|
||||||
|
for i in ${emulator_list[@]}
|
||||||
|
do
|
||||||
|
# remove space and 'device'
|
||||||
|
echo ${i/[^a-zA-Z0-9._]device/}
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "No started emulators found, you can start an emulator by using the command"
|
||||||
|
echo " 'cordova/lib/start-emulator'"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function list_emulator_images {
|
||||||
|
emulator_images=`android list avds | grep "Name:" | cut -f 2 -d ":"`
|
||||||
|
emulator_list=($emulator_images)
|
||||||
|
if [[ ${#emulator_list[@]} > 0 ]] ; then
|
||||||
|
for i in ${emulator_list[@]}
|
||||||
|
do
|
||||||
|
echo ${i/[^a-zA-Z0-9._]/}
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "No emulators found, if you would like to create an emulator follow the instructions"
|
||||||
|
echo " provided here : http://developer.android.com/tools/devices/index.html"
|
||||||
|
echo " Or run 'android create avd --name <name> --target <targetID>' in on the command line."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function start_emulator {
|
||||||
|
emulator_images=`android list avds | grep "Name:" | cut -f 2 -d ":"`
|
||||||
|
# if target emulator is provided
|
||||||
|
if [[ "$#" -eq 1 ]] ; then
|
||||||
|
# check that it exists
|
||||||
|
if [[ $emulator_images =~ $1 ]] ; then
|
||||||
|
#xterm -e emulator -avd $1 &
|
||||||
|
emulator -avd $1 1> /dev/null 2>&1 &
|
||||||
|
else
|
||||||
|
echo "Could not find the provided emulator, make sure the emulator exists"
|
||||||
|
echo " by checking 'cordova/lib/list-emulator-images'"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# start first emulator
|
||||||
|
emulator_list=($emulator_images)
|
||||||
|
if [[ ${#emulator_list[@]} > 0 ]] ; then
|
||||||
|
#xterm -e emulator -avd ${emulator_list[0]} &
|
||||||
|
emulator -avd ${emulator_list[0]/[^a-zA-Z0-9._]/} 1> /dev/null 2>&1 &
|
||||||
|
else
|
||||||
|
echo "No emulators found, if you would like to create an emulator follow the instructions"
|
||||||
|
echo " provided here : http://developer.android.com/tools/devices/index.html"
|
||||||
|
echo " Or run 'android create avd --name <name> --target <targetID>' in on the command line."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_device {
|
||||||
|
IFS=$'\n'
|
||||||
|
devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep -v 'emulator'`
|
||||||
|
device_list=($devices)
|
||||||
|
if [[ ${#device_list[@]} > 0 ]] ; then
|
||||||
|
apks=`find $PROJECT_PATH/bin -type f -maxdepth 1 | egrep '\.apk$'`
|
||||||
|
apk_list=($apks)
|
||||||
|
if [[ ${#apk_list[@]} > 0 ]] ; then
|
||||||
|
local target
|
||||||
|
# handle target emulator
|
||||||
|
if [[ "$#" -eq 1 ]] ; then
|
||||||
|
# deploy to given target
|
||||||
|
target=${1/--target=/}
|
||||||
|
else
|
||||||
|
# delete trailing space and 'device' after device ID
|
||||||
|
target=${device_list[0]/[^a-zA-Z0-9._]device/}
|
||||||
|
fi
|
||||||
|
echo "Installing ${apk_list[0]} onto device $target..."
|
||||||
|
adb -s $target install -r ${apk_list[0]};
|
||||||
|
echo "Launching application..."
|
||||||
|
local launch_str=$(java -jar "$PROJECT_PATH"/cordova/appinfo.jar "$PROJECT_PATH"/AndroidManifest.xml)
|
||||||
|
adb -s $target shell am start -W -a android.intent.action.MAIN -n $launch_str
|
||||||
|
else
|
||||||
|
echo "Application package not found, could not install to device"
|
||||||
|
echo " make sure your application is built before deploying."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No devices found to deploy to. Please make sure your device is connected"
|
||||||
|
echo " and you can view it using the 'cordova/lib/list-devices' command."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_emulator {
|
||||||
|
IFS=$'\n'
|
||||||
|
# check that there is an emulator to deploy to
|
||||||
|
emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'emulator'`
|
||||||
|
emulator_list=($emulator_string)
|
||||||
|
if [[ ${#emulator_list[@]} > 0 ]] ; then
|
||||||
|
apks=`find $PROJECT_PATH/bin -type f -maxdepth 1 | egrep '\.apk$'`
|
||||||
|
apk_list=($apks)
|
||||||
|
if [[ ${#apk_list[@]} > 0 ]] ; then
|
||||||
|
local target
|
||||||
|
# handle target emulator
|
||||||
|
if [[ "$#" -eq 1 ]] ; then
|
||||||
|
# deploy to given target
|
||||||
|
target=${1/--target=/}
|
||||||
|
else
|
||||||
|
# delete trailing space and 'device' after emulator ID
|
||||||
|
target=${emulator_list[0]/[^a-zA-Z0-9._]device/}
|
||||||
|
fi
|
||||||
|
echo "Installing ${apk_list[0]} onto $target..."
|
||||||
|
adb -s $target install -r ${apk_list[0]};
|
||||||
|
echo "Launching application..."
|
||||||
|
local launch_str=$(java -jar "$PROJECT_PATH"/cordova/appinfo.jar "$PROJECT_PATH"/AndroidManifest.xml)
|
||||||
|
adb -s $target shell am start -W -a android.intent.action.MAIN -n $launch_str
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "Application package not found, could not install to device"
|
||||||
|
echo " make sure your application is built before deploying."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No emulators found to deploy to. Please make sure your emulator is started"
|
||||||
|
echo " and you can view it using the 'cordova/lib/list-started-emulators' command."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# cleans the project
|
||||||
|
function clean {
|
||||||
|
echo "Cleaning project..."
|
||||||
|
ant clean
|
||||||
|
}
|
||||||
|
|
||||||
|
# has to be used independently and not in conjunction with other commands
|
||||||
|
function log {
|
||||||
|
# filter out nativeGetEnabledTags spam from latest sdk bug.
|
||||||
|
adb logcat | grep -v nativeGetEnabledTags
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function build {
|
||||||
|
if [[ "$#" -eq 1 ]] ; then
|
||||||
|
if [[ $1 == "--debug" ]] ; then
|
||||||
|
clean
|
||||||
|
ant debug -f "$PROJECT_PATH"/build.xml
|
||||||
|
elif [[ $1 == "--release" ]] ; then
|
||||||
|
clean
|
||||||
|
ant release -f "$PROJECT_PATH"/build.xml
|
||||||
|
elif [[ $1 == "--nobuild" ]] ; then
|
||||||
|
echo "Skipping build..."
|
||||||
|
else
|
||||||
|
echo "Error : Build command '$1' not recognized."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Warning : [ --debug | --release | --nobuild ] not specified, defaulting to --debug"
|
||||||
|
clean
|
||||||
|
ant debug -f "$PROJECT_PATH"/build.xml
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function wait_for_emulator {
|
||||||
|
emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'`
|
||||||
|
old_started=($emulator_string)
|
||||||
|
local new_started
|
||||||
|
local new_emulator_name
|
||||||
|
local i="0"
|
||||||
|
echo -n "Waiting for emulator..."
|
||||||
|
while [ $i -lt 300 ]
|
||||||
|
do
|
||||||
|
emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'`
|
||||||
|
new_started=($emulator_string)
|
||||||
|
if [[ ${#new_started[@]} > ${#old_started[@]} && -z "$new_emulator_name" ]] ; then
|
||||||
|
# get the name of the started emulator
|
||||||
|
local count="0"
|
||||||
|
if [[ ${#old_started[@]} == 0 ]] ; then
|
||||||
|
new_emulator_name=${new_started[$count]/[^a-zA-Z0-9._]device/}
|
||||||
|
else
|
||||||
|
for count in {0...${#old_started[@]}}
|
||||||
|
do
|
||||||
|
if [[ ! ${new_started[$count]} == ${old_started[$count]} ]] ; then
|
||||||
|
new_emulator_name=${new_started[$count]/[^a-zA-Z0-9._]device/}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ -z "$new_emulator_name" ]] ; then
|
||||||
|
count=$[count+1]
|
||||||
|
new_emulator_name=${new_started[$count]/[^a-zA-Z0-9._]device/}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [[ "$new_emulator_name" ]] ; then
|
||||||
|
boot_anim=`adb -s $new_emulator_name shell getprop init.svc.bootanim`
|
||||||
|
if [[ $boot_anim =~ "stopped" ]] ; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
|
i=$[i+1]
|
||||||
|
echo -n "."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
|
i=$[i+1]
|
||||||
|
echo -n "."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# Device timeout: emulator has not started in time
|
||||||
|
if [ $i -eq 300 ]
|
||||||
|
then
|
||||||
|
echo "emulator timeout!"
|
||||||
|
exit 69
|
||||||
|
else
|
||||||
|
echo "connected!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function run {
|
||||||
|
IFS=$'\n'
|
||||||
|
if [[ "$#" -eq 2 ]] ; then
|
||||||
|
build $2
|
||||||
|
if [[ $1 == "--device" ]] ; then
|
||||||
|
install_device
|
||||||
|
elif [[ $1 == "--emulator" ]] ; then
|
||||||
|
install_emulator
|
||||||
|
elif [[ $1 =~ "--target=" ]]; then
|
||||||
|
install_device $1
|
||||||
|
else
|
||||||
|
echo "Error : '$1' is not recognized as an install option"
|
||||||
|
fi
|
||||||
|
elif [[ "$#" -eq 1 ]] ; then
|
||||||
|
if [[ $1 == "--debug" || $1 == "--release" || $1 == "--nobuild" ]] ; then
|
||||||
|
build $1
|
||||||
|
elif [[ $1 == "--device" ]] ; then
|
||||||
|
install_device
|
||||||
|
elif [[ $1 == "--emulator" ]] ; then
|
||||||
|
install_emulator
|
||||||
|
elif [[ $1 =~ "--target=" ]]; then
|
||||||
|
install_device $1
|
||||||
|
else
|
||||||
|
echo "Error : '$1' is not recognized as an install option"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Warning : [ --device | --emulate | --target=<targetID> ] not specified, using defaults."
|
||||||
|
build
|
||||||
|
devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep -v 'emulator'`
|
||||||
|
device_list=($devices)
|
||||||
|
emulator_string=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep 'device' | grep 'emulator'`
|
||||||
|
emulator_list=($emulator_string)
|
||||||
|
if [[ ${#device_list[@]} > 0 ]] ; then
|
||||||
|
install_device
|
||||||
|
elif [[ ${#emulator_list[@]} > 0 ]] ; then
|
||||||
|
install_emulator
|
||||||
|
else
|
||||||
|
emulator_images=`android list avds | grep "Name:" | cut -f 2 -d ":"`
|
||||||
|
echo $emulator_images
|
||||||
|
emulator_image_list=($emulator_images)
|
||||||
|
if [[ ${#emulator_image_list[@]} > 0 ]] ; then
|
||||||
|
echo "Starting emulator : ${emulator_image_list[0]}"
|
||||||
|
emulator -avd ${emulator_image_list[0]/[^.\w]/} 1> /dev/null 2>&1 &
|
||||||
|
wait_for_emulator
|
||||||
|
install_emulator
|
||||||
|
else
|
||||||
|
# TODO : look for emulator images and start one if it's availible
|
||||||
|
echo "Error : there are no availible devices or emulators to deploy to."
|
||||||
|
echo " create an emulator or connect your device to run this command."
|
||||||
|
echo "If you would like to create an emulator follow the instructions"
|
||||||
|
echo " provided here : http://developer.android.com/tools/devices/index.html"
|
||||||
|
echo " Or run 'android create avd --name <name> --target <targetID>' in on the command line."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# parse command line arguments
|
||||||
|
|
||||||
|
if [[ $# > 3 ]] ; then
|
||||||
|
echo "Error : too many arguments."
|
||||||
|
exit 2
|
||||||
|
elif [[ $# == 3 ]] ; then
|
||||||
|
if [[ $1 == "run" ]] ; then
|
||||||
|
run $2 $3
|
||||||
|
else
|
||||||
|
echo "Error : too many arguments for '$1'"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
elif [[ $# == 2 ]] ; then
|
||||||
|
if [[ $1 == "run" ]] ; then
|
||||||
|
if [[ $2 == "--emulator" || $2 == "--device" || $2 =~ "--target=" ]] ; then
|
||||||
|
run $2 ''
|
||||||
|
elif [[ $2 == "--debug" || $2 == "--release" || $2 == "--nobuild" ]] ; then
|
||||||
|
run '' $2
|
||||||
|
else
|
||||||
|
echo "Error : '$2' is not recognized as a run option."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
elif [[ $1 == "build" ]] ; then
|
||||||
|
build $2
|
||||||
|
elif [[ $1 == "start-emulator" ]] ; then
|
||||||
|
start_emulator $2
|
||||||
|
elif [[ $1 == "install-device" ]] ; then
|
||||||
|
if [[ $2 =~ "--target=" ]] ; then
|
||||||
|
install_device $2
|
||||||
|
else
|
||||||
|
echo "Error : '$2' is not recognized as an install option"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
elif [[ $1 == "install-emulator" ]] ; then
|
||||||
|
if [[ $2 =~ "--target=" ]] ; then
|
||||||
|
install_emulator $2
|
||||||
|
else
|
||||||
|
echo "Error : '$2' is not recognized as an install option"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error : '$1' is not recognized as an option that takes arguments"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
elif [[ $# == 1 ]] ; then
|
||||||
|
if [[ $1 == "run" ]] ; then
|
||||||
|
run
|
||||||
|
elif [[ $1 == "build" ]]; then
|
||||||
|
build
|
||||||
|
elif [[ $1 == "clean" ]]; then
|
||||||
|
clean
|
||||||
|
elif [[ $1 == "log" ]]; then
|
||||||
|
log
|
||||||
|
elif [[ $1 == "list-devices" ]]; then
|
||||||
|
list_devices
|
||||||
|
elif [[ $1 == "list-emulator-images" ]]; then
|
||||||
|
list_emulator_images
|
||||||
|
elif [[ $1 == "list-started-emulators" ]]; then
|
||||||
|
list_started_emulators
|
||||||
|
elif [[ $1 == "install-device" ]]; then
|
||||||
|
install_device
|
||||||
|
elif [[ $1 == "install-emulator" ]]; then
|
||||||
|
install_emulator
|
||||||
|
elif [[ $1 == "start-emulator" ]]; then
|
||||||
|
start_emulator
|
||||||
|
else
|
||||||
|
echo "Error : '$1' is not recognized as a tooling command."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error : No command recieved, exiting..."
|
||||||
|
exit 2
|
||||||
|
fi
|
1
bin/templates/cordova/lib/cordova.js
vendored
1
bin/templates/cordova/lib/cordova.js
vendored
@ -119,7 +119,6 @@ function list_devices() {
|
|||||||
function get_emulator_images() {
|
function get_emulator_images() {
|
||||||
// discription contains all data recieved squashed onto one line
|
// discription contains all data recieved squashed onto one line
|
||||||
var add_description = true;
|
var add_description = true;
|
||||||
var oExec = shell.Exec("%comspec% /c android.bat list avd");
|
|
||||||
var avd_list = [];
|
var avd_list = [];
|
||||||
var local_emulators = shell.Exec("%comspec% /c android list avds").StdOut.ReadAll();
|
var local_emulators = shell.Exec("%comspec% /c android list avds").StdOut.ReadAll();
|
||||||
if (local_emulators.match(/Name\:/)) {
|
if (local_emulators.match(/Name\:/)) {
|
||||||
|
23
bin/templates/cordova/lib/install-device
Executable file
23
bin/templates/cordova/lib/install-device
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||||
|
|
||||||
|
bash "$CORDOVA_LIB_PATH"/cordova install-device "$@"
|
23
bin/templates/cordova/lib/install-emulator
Executable file
23
bin/templates/cordova/lib/install-emulator
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||||
|
|
||||||
|
bash "$CORDOVA_LIB_PATH"/cordova install-emulator "$@"
|
@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
# or more contributor license agreements. See the NOTICE file
|
# or more contributor license agreements. See the NOTICE file
|
||||||
# distributed with this work for additional information
|
# distributed with this work for additional information
|
||||||
@ -15,10 +16,8 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||||
|
|
||||||
bash "$CORDOVA_PATH"/cordova release
|
bash "$CORDOVA_LIB_PATH"/cordova list-devices
|
23
bin/templates/cordova/lib/list-emulator-images
Executable file
23
bin/templates/cordova/lib/list-emulator-images
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||||
|
|
||||||
|
bash "$CORDOVA_LIB_PATH"/cordova list-emulator-images
|
23
bin/templates/cordova/lib/list-started-emulators
Executable file
23
bin/templates/cordova/lib/list-started-emulators
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||||
|
|
||||||
|
bash "$CORDOVA_LIB_PATH"/cordova list-started-emulators
|
23
bin/templates/cordova/lib/start-emulator
Executable file
23
bin/templates/cordova/lib/start-emulator
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CORDOVA_LIB_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||||
|
|
||||||
|
bash "$CORDOVA_LIB_PATH"/cordova start-emulator "$@"
|
@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
# or more contributor license agreements. See the NOTICE file
|
# or more contributor license agreements. See the NOTICE file
|
||||||
# distributed with this work for additional information
|
# distributed with this work for additional information
|
||||||
@ -15,10 +16,8 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
CORDOVA_PATH=$( cd "$( dirname "$0" )/.." && pwd )
|
CORDOVA_PATH=$( cd "$( dirname "$0" )/.." && pwd )
|
||||||
|
|
||||||
bash "$CORDOVA_PATH"/cordova/cordova log
|
bash "$CORDOVA_PATH"/cordova/lib/cordova log "$@"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
# or more contributor license agreements. See the NOTICE file
|
# or more contributor license agreements. See the NOTICE file
|
||||||
# distributed with this work for additional information
|
# distributed with this work for additional information
|
||||||
@ -15,10 +16,8 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||||
|
|
||||||
bash "$CORDOVA_PATH"/cordova run
|
bash "$CORDOVA_PATH"/lib/cordova run "$@"
|
||||||
|
11
bin/update
11
bin/update
@ -130,10 +130,17 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# creating cordova folder and copying run/build/log/launch scripts
|
# creating cordova folder and copying run/build/log/launch scripts
|
||||||
|
mkdir "$PROJECT_PATH"/cordova
|
||||||
|
mkdir "$PROJECT_PATH"/cordova/lib
|
||||||
cp "$BUILD_PATH"/bin/templates/cordova/appinfo.jar "$PROJECT_PATH"/cordova/appinfo.jar
|
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/build "$PROJECT_PATH"/cordova/build
|
cp "$BUILD_PATH"/bin/templates/cordova/build "$PROJECT_PATH"/cordova/build
|
||||||
cp "$BUILD_PATH"/bin/templates/cordova/release "$PROJECT_PATH"/cordova/release
|
|
||||||
cp "$BUILD_PATH"/bin/templates/cordova/clean "$PROJECT_PATH"/cordova/clean
|
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/log "$PROJECT_PATH"/cordova/log
|
||||||
cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run
|
cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/cordova "$PROJECT_PATH"/cordova/lib/cordova
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/install-device "$PROJECT_PATH"/cordova/lib/install-device
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/install-emulator "$PROJECT_PATH"/cordova/lib/install-emulator
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/list-devices "$PROJECT_PATH"/cordova/lib/list-devices
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/list-emulator-images "$PROJECT_PATH"/cordova/lib/list-emulator-images
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/list-started-emulators "$PROJECT_PATH"/cordova/lib/list-started-emulators
|
||||||
|
cp "$BUILD_PATH"/bin/templates/cordova/lib/start-emulator "$PROJECT_PATH"/cordova/lib/start-emulator
|
||||||
|
@ -183,11 +183,17 @@ if(fso.FolderExists(ROOT + '\\framework')) {
|
|||||||
createAppInfoJar();
|
createAppInfoJar();
|
||||||
WScript.Echo("Copying cordova command tools...");
|
WScript.Echo("Copying cordova command tools...");
|
||||||
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\appinfo.jar ' + PROJECT_PATH + '\\cordova\\appinfo.jar /Y');
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\appinfo.jar ' + PROJECT_PATH + '\\cordova\\appinfo.jar /Y');
|
||||||
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\cordova.js ' + PROJECT_PATH + '\\cordova\\cordova.js /Y');
|
|
||||||
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\cordova.bat ' + PROJECT_PATH + '\\cordova\\cordova.bat /Y');
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\cordova.bat ' + PROJECT_PATH + '\\cordova\\cordova.bat /Y');
|
||||||
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\clean.bat ' + PROJECT_PATH + '\\cordova\\clean.bat /Y');
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\clean.bat ' + PROJECT_PATH + '\\cordova\\clean.bat /Y');
|
||||||
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\build.bat ' + PROJECT_PATH + '\\cordova\\build.bat /Y');
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\build.bat ' + PROJECT_PATH + '\\cordova\\build.bat /Y');
|
||||||
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\log.bat ' + PROJECT_PATH + '\\cordova\\log.bat /Y');
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\log.bat ' + PROJECT_PATH + '\\cordova\\log.bat /Y');
|
||||||
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\run.bat ' + PROJECT_PATH + '\\cordova\\run.bat /Y');
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\run.bat ' + PROJECT_PATH + '\\cordova\\run.bat /Y');
|
||||||
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\cordova.js ' + PROJECT_PATH + '\\cordova\\lib\\cordova.js /Y');
|
||||||
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\install-device.bat ' + PROJECT_PATH + '\\cordova\\lib\\install-device.bat /Y');
|
||||||
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\install-emulator.bat ' + PROJECT_PATH + '\\cordova\\lib\\install-emulator.bat /Y');
|
||||||
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\list-emulator-images.bat ' + PROJECT_PATH + '\\cordova\\lib\\list-emulator-images.bat /Y');
|
||||||
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\list-devices.bat ' + PROJECT_PATH + '\\cordova\\lib\\list-devices.bat /Y');
|
||||||
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\list-started-emulators.bat ' + PROJECT_PATH + '\\cordova\\lib\\list-started-emulators.bat /Y');
|
||||||
|
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\lib\\start-emulator.bat ' + PROJECT_PATH + '\\cordova\\lib\\start-emulator.bat /Y');
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
|
Loading…
Reference in New Issue
Block a user