From e1347e434e7bda8e0f0ff98fe22e603237102c1b Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Tue, 20 Nov 2012 14:39:33 -0800 Subject: [PATCH 1/9] refactoring android commands --- bin/create | 7 ++-- .../ApplicationInfo/ApplicationInfo.class | Bin 0 -> 2045 bytes bin/templates/cordova/appinfo.jar | Bin 0 -> 1574 bytes bin/templates/cordova/{debug => build} | 2 +- bin/templates/cordova/{BOOM.bat => build.bat} | 2 +- bin/templates/cordova/cordova | 35 +++++++++++++----- bin/templates/cordova/debug.bat | 18 --------- bin/templates/cordova/emulate | 24 ------------ bin/templates/cordova/emulate.bat | 1 - bin/templates/cordova/{BOOM => run} | 2 +- bin/templates/cordova/run.bat | 1 + 11 files changed, 32 insertions(+), 60 deletions(-) create mode 100644 bin/templates/cordova/ApplicationInfo/ApplicationInfo.class create mode 100644 bin/templates/cordova/appinfo.jar rename bin/templates/cordova/{debug => build} (96%) rename bin/templates/cordova/{BOOM.bat => build.bat} (97%) delete mode 100644 bin/templates/cordova/debug.bat delete mode 100755 bin/templates/cordova/emulate delete mode 100644 bin/templates/cordova/emulate.bat rename bin/templates/cordova/{BOOM => run} (96%) create mode 100644 bin/templates/cordova/run.bat 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 0000000000000000000000000000000000000000..2ef42a46862f75fffa8b780ff7cc579396224638 GIT binary patch literal 2045 zcma)7TUQ%Z6#h7 z@?0NM&}Em;{w9~Y&m_ni|L_(?$mcNBbpyJEPf;6qHu zF@v0p**N0(NXC7!e-OvVn3FIsW1$O+Sdy_U;h~IAWUMIo6rYJ9uV57g32O>^u`c0r z1t~Fqp%Y0kF7f{pEJvjWt3NS)7asz$IzS3@9F!xR@KdlR`eXhtmK59D@9K) zJzLf7KwZKU30s7eKoUN3Q_~HTp)dWUv$|5We5b^hjllJsZC8zw?irT3V(wU3;ZeoA z7$Ku7zQMODzQa=qbhwR@gt7{b9R|rJ40?sDs9={t)=QqTZ+J&44D3mGrlN`(!!^sP zXa~1TTG^^;OI2RuCNWd>2Gc3JW&HYsA&EBQ8VtYu;S3lH> zbC1uz6Y9XfVQDLCEvKp1s2aC1?;F)JcZj`D&a!2LfE{92#Sy+|NNL%ucHvU9VnxQuR& zAxX*?3^R;e#s(=5|1U^}XmC3WnNEqFZ_Si57-YDo(>Z~yaPLg&Jg-s&wpG0Ofvl(` zKIc&lZTlWY=2k}p7w=biC%vW>cm8NYuM{X_FT6LcS zLV~nfYM^-J2BKlh7j2#4dG;_F(ABL$;)|t-lH)V9A1YaDwozI%3_eICjtHmLiw>e!i9-U9g)@XQ$!hNA_I|R>=aT6 zGtu#+e2T6R!lzI|_yh5z+V~Rt1y_=9M1MzOGdvJ2Zbk-T$?oLUI+Dc`T&tt!82yEb zI{J>$E$04X$YQ?!f^bK$MeVsam@D)`iM>THR49PFjH?80h)!>yi})spWr}#-Bnq=c zVhfX`oxxL#p-k%v#<7bD>fDoLB?}uGJbGI*WMvSMe@HkaVN4=1CSl^Cge?8F2pONm z`;C~8u@L=$(afu#p=82S`C|+`!w1D6Q|( ccn>P332iPwD*SgLr2d5zxhFqUfy(WF0XzW=od5s; literal 0 HcmV?d00001 diff --git a/bin/templates/cordova/appinfo.jar b/bin/templates/cordova/appinfo.jar new file mode 100644 index 0000000000000000000000000000000000000000..31d01d75aa31c5d82b443b37f9eb43de3f694c9d GIT binary patch literal 1574 zcmWIWW@Zs#-~d9+oMJ}?B*4kQ!r%MB z$s^LUwKFWlM4l|ss(7aQI`dP}PqnmXFRh-dh>1sQHmDd)7WQsnt9Z8b>F1)4MT}r~ z#oHQLgaK`h1Y+Fo5(UaS78K-UCMT9;=I43lrRD1-=Oh*v_lCX>mv$BT?;E!}XIopF z`+^AF&@2v>?k(G#HcUW+<-8O4f$?3}!+A~ohJwdcJ{c{0)bUtZ z^83+0jxzGeQHOeZZt|T;j62rU(r#ooF)-kRrk${J;6WuXp=lyt5+V;h=L&MFTeu+p z#HJ?3I}}io`Y}tE*Pm8+%?Y%9EOX=c`23rK7pE?$=-KioASkUh<5sdp;B|ee-ha z^6p)-GrTL55_=~Ic^q<2l-iYO^kv!nE#~2;ro9jO(InV1Z`<2lffsEL8*x8dHdR)ufT%g~R!`$9j;UQ?Y=#4O4gDk?LZXOgeP7pd^T!(z>A!fld|fA|(Eabwzt5La2= zHoem;Gk0&-j=Gwa@wxQg12x0ouVU9dgYyL#gIif=e=>cNwNr8W!q283miFexDGEhZg8zp!jOws-Q))w{fw zp5J8|r=YKuJO7);mA3bSP0_i6F#&-ko2*STZ&D?uyjUmB`<}ufiEbDmgyU4&* z<(h%pHOV!}ETO;FC5l9!2zoB3tZ#Ya!h?&qXDRA4cl>dl?JVS`a_g8%ioDl}i}BqP zJ{#_-pR=!&OHRphPUTPIDLxf@DjFK^8*KQ+l&`j4{?S^sdw%y8EbKh^=!9Zkm&o=H z-;}%_$4b3-Jj$~0EW3y6AHJ3=`zI{=Ad+rlu=B4zs7Rb^rzda0!ocvC9aQu%GKnyt zmZ-4e5>%q10(cP#DqqpHB9~~O@)QAVflRnoq|z1L1Z0PSN 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 From 3f3a0b9140be5b07264fb33bf0a4a76348178679 Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Tue, 20 Nov 2012 14:49:49 -0800 Subject: [PATCH 2/9] adding install function --- bin/templates/cordova/cordova | 76 ++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/bin/templates/cordova/cordova b/bin/templates/cordova/cordova index 561663b5..759f5905 100755 --- a/bin/templates/cordova/cordova +++ b/bin/templates/cordova/cordova @@ -17,11 +17,11 @@ #!/bin/bash -set -e 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" @@ -37,7 +37,6 @@ 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" return fi @@ -62,8 +61,9 @@ function emulate { do echo "$i) ${avd_list[$i]}" done - echo -n "> " - read avd_id + 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 @@ -79,17 +79,41 @@ function log { } function run { - if [ $(check_devices) == 0 ] ; then - clean && emulate && install && launch - else - build - echo "##################################################################" - echo "# Plug in your device or launch an emulator with cordova/run #" - echo "##################################################################" - fi + 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 } @@ -98,14 +122,28 @@ function build { } 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 + 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 { From d9107bcac6e328f4e28298db2f64968416ee4560 Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Tue, 20 Nov 2012 18:49:16 -0800 Subject: [PATCH 3/9] refactoring windows scripts --- bin/create.js | 5 ++-- bin/templates/cordova/cordova.js | 46 +++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/bin/create.js b/bin/create.js index 2d6b8d61..258c32cd 100644 --- a/bin/create.js +++ b/bin/create.js @@ -198,10 +198,9 @@ exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\appinfo.jar ' + PRO 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\\clean.bat ' + PROJECT_PATH + '\\cordova\\clean.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\debug.bat ' + PROJECT_PATH + '\\cordova\\debug.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\\emulate.bat ' + PROJECT_PATH + '\\cordova\\emulate.bat /Y'); -exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\BOOM.bat ' + PROJECT_PATH + '\\cordova\\BOOM.bat /Y'); +exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\run.bat ' + PROJECT_PATH + '\\cordova\\run.bat /Y'); // interpolate the activity name and package WScript.Echo("Updating AndroidManifest.xml and Main Activity..."); diff --git a/bin/templates/cordova/cordova.js b/bin/templates/cordova/cordova.js index ff91430b..51533cb9 100644 --- a/bin/templates/cordova/cordova.js +++ b/bin/templates/cordova/cordova.js @@ -34,17 +34,19 @@ function exec(command) { return output; } -function emulator_running() { +function device_running() { var local_devices = shell.Exec("%comspec% /c adb devices").StdOut.ReadAll(); - if(local_devices.match(/emulator/)) { + 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(emulator_running()) { - WScript.Echo("Device or Emulator already running!"); + if(device_running()) { + //WScript.Echo("Device or Emulator already running!"); return; } var oExec = shell.Exec("%comspec% /c android.bat list avd"); @@ -84,18 +86,18 @@ function emulate() { } function clean() { + WScript.Echo("Cleaning project..."); exec("%comspec% /c ant.bat clean -f "+ROOT+"\\build.xml 2>&1"); } -function debug() { - if(emulator_running()) { - exec("%comspec% /c ant.bat debug install -f "+ROOT+"\\build.xml 2>&1"); - } else { - exec("%comspec% /c ant.bat debug -f "+ROOT+"\\build.xml 2>&1"); - WScript.Echo("##################################################################"); - WScript.Echo("# Plug in your device or launch an emulator with cordova/emulate #"); - WScript.Echo("##################################################################"); - } +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() { @@ -103,14 +105,28 @@ function log() { } 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 BOOM() { +function run() { + var i=0; clean(); - debug(); + 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; From 538e90f23aaeebe4cc08ad87d17d0ab2dde6185d Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Wed, 21 Nov 2012 11:27:25 -0500 Subject: [PATCH 4/9] CB-1888: Can't add a Photo from a HTTPS address to Contact --- framework/src/org/apache/cordova/ContactAccessorSdk5.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/ContactAccessorSdk5.java b/framework/src/org/apache/cordova/ContactAccessorSdk5.java index 8497135e..73d05bc0 100644 --- a/framework/src/org/apache/cordova/ContactAccessorSdk5.java +++ b/framework/src/org/apache/cordova/ContactAccessorSdk5.java @@ -1579,7 +1579,7 @@ public class ContactAccessorSdk5 extends ContactAccessor { Uri uri = Uri.parse(path); return mApp.getActivity().getContentResolver().openInputStream(uri); } - if (path.startsWith("http:") || path.startsWith("file:")) { + if (path.startsWith("http:") || path.startsWith("https:") || path.startsWith("file:")) { URL url = new URL(path); return url.openStream(); } From 54979f2fc4192be020554f32e810919070362d5f Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Wed, 21 Nov 2012 13:33:09 -0800 Subject: [PATCH 5/9] removing appinfo.jar --- bin/templates/cordova/appinfo.jar | Bin 1574 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 bin/templates/cordova/appinfo.jar diff --git a/bin/templates/cordova/appinfo.jar b/bin/templates/cordova/appinfo.jar deleted file mode 100644 index 31d01d75aa31c5d82b443b37f9eb43de3f694c9d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1574 zcmWIWW@Zs#-~d9+oMJ}?B*4kQ!r%MB z$s^LUwKFWlM4l|ss(7aQI`dP}PqnmXFRh-dh>1sQHmDd)7WQsnt9Z8b>F1)4MT}r~ z#oHQLgaK`h1Y+Fo5(UaS78K-UCMT9;=I43lrRD1-=Oh*v_lCX>mv$BT?;E!}XIopF z`+^AF&@2v>?k(G#HcUW+<-8O4f$?3}!+A~ohJwdcJ{c{0)bUtZ z^83+0jxzGeQHOeZZt|T;j62rU(r#ooF)-kRrk${J;6WuXp=lyt5+V;h=L&MFTeu+p z#HJ?3I}}io`Y}tE*Pm8+%?Y%9EOX=c`23rK7pE?$=-KioASkUh<5sdp;B|ee-ha z^6p)-GrTL55_=~Ic^q<2l-iYO^kv!nE#~2;ro9jO(InV1Z`<2lffsEL8*x8dHdR)ufT%g~R!`$9j;UQ?Y=#4O4gDk?LZXOgeP7pd^T!(z>A!fld|fA|(Eabwzt5La2= zHoem;Gk0&-j=Gwa@wxQg12x0ouVU9dgYyL#gIif=e=>cNwNr8W!q283miFexDGEhZg8zp!jOws-Q))w{fw zp5J8|r=YKuJO7);mA3bSP0_i6F#&-ko2*STZ&D?uyjUmB`<}ufiEbDmgyU4&* z<(h%pHOV!}ETO;FC5l9!2zoB3tZ#Ya!h?&qXDRA4cl>dl?JVS`a_g8%ioDl}i}BqP zJ{#_-pR=!&OHRphPUTPIDLxf@DjFK^8*KQ+l&`j4{?S^sdw%y8EbKh^=!9Zkm&o=H z-;}%_$4b3-Jj$~0EW3y6AHJ3=`zI{=Ad+rlu=B4zs7Rb^rzda0!ocvC9aQu%GKnyt zmZ-4e5>%q10(cP#DqqpHB9~~O@)QAVflRnoq|z1L1Z0PSN Date: Wed, 21 Nov 2012 13:37:19 -0800 Subject: [PATCH 6/9] removing ApplicationInfo.class --- .../ApplicationInfo/ApplicationInfo.class | Bin 2045 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 bin/templates/cordova/ApplicationInfo/ApplicationInfo.class diff --git a/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class b/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class deleted file mode 100644 index 2ef42a46862f75fffa8b780ff7cc579396224638..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2045 zcma)7TUQ%Z6#h7 z@?0NM&}Em;{w9~Y&m_ni|L_(?$mcNBbpyJEPf;6qHu zF@v0p**N0(NXC7!e-OvVn3FIsW1$O+Sdy_U;h~IAWUMIo6rYJ9uV57g32O>^u`c0r z1t~Fqp%Y0kF7f{pEJvjWt3NS)7asz$IzS3@9F!xR@KdlR`eXhtmK59D@9K) zJzLf7KwZKU30s7eKoUN3Q_~HTp)dWUv$|5We5b^hjllJsZC8zw?irT3V(wU3;ZeoA z7$Ku7zQMODzQa=qbhwR@gt7{b9R|rJ40?sDs9={t)=QqTZ+J&44D3mGrlN`(!!^sP zXa~1TTG^^;OI2RuCNWd>2Gc3JW&HYsA&EBQ8VtYu;S3lH> zbC1uz6Y9XfVQDLCEvKp1s2aC1?;F)JcZj`D&a!2LfE{92#Sy+|NNL%ucHvU9VnxQuR& zAxX*?3^R;e#s(=5|1U^}XmC3WnNEqFZ_Si57-YDo(>Z~yaPLg&Jg-s&wpG0Ofvl(` zKIc&lZTlWY=2k}p7w=biC%vW>cm8NYuM{X_FT6LcS zLV~nfYM^-J2BKlh7j2#4dG;_F(ABL$;)|t-lH)V9A1YaDwozI%3_eICjtHmLiw>e!i9-U9g)@XQ$!hNA_I|R>=aT6 zGtu#+e2T6R!lzI|_yh5z+V~Rt1y_=9M1MzOGdvJ2Zbk-T$?oLUI+Dc`T&tt!82yEb zI{J>$E$04X$YQ?!f^bK$MeVsam@D)`iM>THR49PFjH?80h)!>yi})spWr}#-Bnq=c zVhfX`oxxL#p-k%v#<7bD>fDoLB?}uGJbGI*WMvSMe@HkaVN4=1CSl^Cge?8F2pONm z`;C~8u@L=$(afu#p=82S`C|+`!w1D6Q|( ccn>P332iPwD*SgLr2d5zxhFqUfy(WF0XzW=od5s; From 08a190ef5bab924659f948d9be72c2245ebb9b04 Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Wed, 21 Nov 2012 16:35:16 -0800 Subject: [PATCH 7/9] adding release command --- bin/templates/cordova/cordova | 4 ++++ bin/templates/cordova/release | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 bin/templates/cordova/release diff --git a/bin/templates/cordova/cordova b/bin/templates/cordova/cordova index 759f5905..1945a4c4 100755 --- a/bin/templates/cordova/cordova +++ b/bin/templates/cordova/cordova @@ -121,6 +121,10 @@ function build { ant debug } +function release { + ant release +} + function wait_for_device { local i="0" echo -n "Waiting for device..." diff --git a/bin/templates/cordova/release b/bin/templates/cordova/release new file mode 100755 index 00000000..73d873e3 --- /dev/null +++ b/bin/templates/cordova/release @@ -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 release From 92d69e320f29767a07b8bc74a42146a72742bdee Mon Sep 17 00:00:00 2001 From: Anis Kadri Date: Wed, 21 Nov 2012 16:35:27 -0800 Subject: [PATCH 8/9] updating create command --- bin/create | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/create b/bin/create index 903f55ee..e01cef98 100755 --- a/bin/create +++ b/bin/create @@ -153,6 +153,7 @@ 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/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/log "$PROJECT_PATH"/cordova/log cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run From 3566154cd02b10cc1fb5dde39db30a02dc56a953 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 22 Nov 2012 12:39:18 -0500 Subject: [PATCH 9/9] Add @JavascriptInterface annotations to ExposedJsApi. And re-enable the JS bridge on 4.2. https://issues.apache.org/jira/browse/CB-1879 --- framework/src/org/apache/cordova/CordovaWebView.java | 4 ---- framework/src/org/apache/cordova/ExposedJsApi.java | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index efd3cf89..4777f25a 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -302,10 +302,6 @@ public class CordovaWebView extends WebView { Log.i(TAG, "Disabled addJavascriptInterface() bridge callback due to a bug on the 2.3 emulator"); return; } - else if (SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) { - Log.i(TAG, "Disabled addJavascriptInterface() bridge callback for 4.2. Symbols are broken, and we can't compile the annotation needed to expose the exec."); - return; - } this.addJavascriptInterface(exposedJsApi, "_cordovaNative"); } diff --git a/framework/src/org/apache/cordova/ExposedJsApi.java b/framework/src/org/apache/cordova/ExposedJsApi.java index b386a402..a36bb62b 100755 --- a/framework/src/org/apache/cordova/ExposedJsApi.java +++ b/framework/src/org/apache/cordova/ExposedJsApi.java @@ -18,6 +18,7 @@ */ package org.apache.cordova; +import android.webkit.JavascriptInterface; import org.apache.cordova.api.PluginManager; import org.apache.cordova.api.PluginResult; import org.json.JSONException; @@ -37,6 +38,7 @@ import org.json.JSONException; this.jsMessageQueue = jsMessageQueue; } + @JavascriptInterface public String exec(String service, String action, String callbackId, String arguments) throws JSONException { jsMessageQueue.setPaused(true); try { @@ -51,10 +53,12 @@ import org.json.JSONException; } } + @JavascriptInterface public void setNativeToJsBridgeMode(int value) { jsMessageQueue.setBridgeMode(value); } + @JavascriptInterface public String retrieveJsMessages() { return jsMessageQueue.popAndEncode(); }