You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2018/11/24 19:52:54 UTC

[cordova-paramedic] branch johanlantz-prefer_physical created (now 8d7d094)

This is an automated email from the ASF dual-hosted git repository.

janpio pushed a change to branch johanlantz-prefer_physical
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git.


      at 8d7d094  device is real device, not emulator with device tag

This branch includes the following new commits:

     new f673635  Prefer physical dev (#2)
     new 6247ec1  add missing physical device function
     new 8d7d094  device is real device, not emulator with device tag

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[cordova-paramedic] 01/03: Prefer physical dev (#2)

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch johanlantz-prefer_physical
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git

commit f6736352fc3c9e825d92a0a29e051e98e326d9cd
Author: johanlantz <il...@gmail.com>
AuthorDate: Wed Jun 13 17:17:37 2018 +0200

    Prefer physical dev (#2)
---
 lib/ParamedicTargetChooser.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/ParamedicTargetChooser.js b/lib/ParamedicTargetChooser.js
index 6b162ad..edc913f 100644
--- a/lib/ParamedicTargetChooser.js
+++ b/lib/ParamedicTargetChooser.js
@@ -59,7 +59,15 @@ ParamedicTargetChooser.prototype.chooseTargetForAndroid = function (emulator, ta
         var obj = {};
         obj.target = target;
         return obj;
-    } 
+    }
+
+    var connectedPhysicalDevice = util.getAndroidPhysicalDevice();
+    if (connectedPhysicalDevice) {
+        logger.info('cordova-paramedic: Physical device connected, use: ' + connectedPhysicalDevice);
+        var obj = {};
+        obj.target = connectedPhysicalDevice;
+        return obj;
+    }
     
     return this.startAnAndroidEmulator(target).then(function(emulatorId) {
         var obj = {};


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[cordova-paramedic] 03/03: device is real device, not emulator with device tag

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch johanlantz-prefer_physical
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git

commit 8d7d09498c930ce2f601454a615ad8a0fba1c5b1
Author: Johan Lantz <jo...@telefonica.com>
AuthorDate: Fri Jun 22 12:29:48 2018 +0200

    device is real device, not emulator with device tag
---
 lib/utils/utilities.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils/utilities.js b/lib/utils/utilities.js
index 5970c33..4e99af6 100644
--- a/lib/utils/utilities.js
+++ b/lib/utils/utilities.js
@@ -29,7 +29,7 @@ var kill    = require('tree-kill');
 
 var HEADING_LINE_PATTERN = /List of devices/m;
 var DEVICE_ROW_PATTERN   = /(emulator|device|host)/m;
-var DEVICE_ONLY_ROW_PATTERN   = /(device)/m;
+var DEVICE_ONLY_ROW_PATTERN   = /(^(?!.*(emulator)).*device.*$)/m;
 
 var KILL_SIGNAL = 'SIGINT';
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[cordova-paramedic] 02/03: add missing physical device function

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch johanlantz-prefer_physical
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git

commit 6247ec185c9fbfcc8c63b1440669429a3e8e00a5
Author: Johan Lantz <jo...@telefonica.com>
AuthorDate: Wed Jun 20 16:46:15 2018 +0200

    add missing physical device function
---
 lib/utils/utilities.js | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lib/utils/utilities.js b/lib/utils/utilities.js
index a2c7fbb..5970c33 100644
--- a/lib/utils/utilities.js
+++ b/lib/utils/utilities.js
@@ -29,6 +29,7 @@ var kill    = require('tree-kill');
 
 var HEADING_LINE_PATTERN = /List of devices/m;
 var DEVICE_ROW_PATTERN   = /(emulator|device|host)/m;
+var DEVICE_ONLY_ROW_PATTERN   = /(device)/m;
 
 var KILL_SIGNAL = 'SIGINT';
 
@@ -52,6 +53,24 @@ function countAndroidDevices() {
     return numDevices;
 }
 
+function getAndroidPhysicalDevice() {
+    var listCommand = 'adb devices';
+
+    logger.info('running:');
+    logger.info('    ' + listCommand);
+
+    var numDevices = 0;
+    var result = shelljs.exec(listCommand, {silent: false, async: false});
+    var deviceId = null;
+    result.output.split('\n').forEach(function (line) {
+        if (!HEADING_LINE_PATTERN.test(line) && DEVICE_ONLY_ROW_PATTERN.test(line)) {
+            deviceId = line.split('\t')[0];
+            logger.info("Identified deviceId as: " + deviceId);
+        }
+    });
+    return deviceId;
+}
+
 function secToMin(seconds) {
     return Math.ceil(seconds / 60);
 }
@@ -218,6 +237,7 @@ module.exports = {
     secToMin: secToMin,
     isWindows:  isWindows,
     countAndroidDevices: countAndroidDevices,
+    getAndroidPhysicalDevice: getAndroidPhysicalDevice,
     getSimulatorsFolder: getSimulatorsFolder,
     doesFileExist: doesFileExist,
     getSqlite3InsertionCommand: getSqlite3InsertionCommand,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org