You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/09/15 20:25:03 UTC

[1/3] android commit: CB-7554 Use x86 apk when deploying to an intel device / emulator

Repository: cordova-android
Updated Branches:
  refs/heads/4.0.x 4c1efe7ad -> a10106c61
  refs/heads/master 4be92f285 -> 5cb01f2ae


CB-7554 Use x86 apk when deploying to an intel device / emulator


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

Branch: refs/heads/4.0.x
Commit: 5cb01f2ae9c733e2f3ca29302b3274965bf3c7a1
Parents: 4be92f2
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Sep 15 14:23:26 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Sep 15 14:23:26 2014 -0400

----------------------------------------------------------------------
 bin/templates/cordova/lib/build.js    | 15 +++++++++++++++
 bin/templates/cordova/lib/device.js   | 21 ++++++++++-----------
 bin/templates/cordova/lib/emulator.js |  9 ++++++---
 3 files changed, 31 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/5cb01f2a/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index 30056f4..df2448c 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -26,6 +26,7 @@ var shell   = require('shelljs'),
     fs      = require('fs'),
     ROOT    = path.join(__dirname, '..', '..');
 var check_reqs = require('./check_reqs');
+var exec  = require('./exec');
 
 var LOCAL_PROPERTIES_TEMPLATE =
     '# This file is automatically generated.\n' +
@@ -338,6 +339,20 @@ module.exports.run = function(options) {
 };
 
 /*
+ * Detects the architecture of a device/emulator
+ * Returns "arm" or "x86".
+ */
+module.exports.detectArchitecture = function(target) {
+    return exec('adb -s ' + target + ' shell cat /proc/cpuinfo')
+    .then(function(output) {
+        if (/intel/i.exec(output)) {
+            return 'x86';
+        }
+        return 'arm';
+    });
+};
+
+/*
  * Gets the path to the apk file, if not such file exists then
  * the script will error out. (should we error or just return undefined?)
  * This is called by the run script to install the apk to the device

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/5cb01f2a/bin/templates/cordova/lib/device.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/device.js b/bin/templates/cordova/lib/device.js
index df21287..671f93d 100644
--- a/bin/templates/cordova/lib/device.js
+++ b/bin/templates/cordova/lib/device.js
@@ -58,19 +58,18 @@ module.exports.install = function(target) {
         // default device
         target = typeof target !== 'undefined' ? target : device_list[0];
 
-        if (device_list.indexOf(target) < 0)
+        if (device_list.indexOf(target) < 0) {
             return Q.reject('ERROR: Unable to find target \'' + target + '\'.');
-
-        var apk_path;
-        if (typeof process.env.DEPLOY_APK_ARCH == 'undefined') {
-            apk_path = build.get_apk();
-        } else {
-            apk_path = build.get_apk(null, process.env.DEPLOY_APK_ARCH);
         }
-        launchName = appinfo.getActivityName();
-        console.log('Installing app on device...');
-        var cmd = 'adb -s ' + target + ' install -r "' + apk_path + '"';
-        return exec(cmd);
+
+        return build.detectArchitecture(target)
+        .then(function(arch) {
+            var apk_path = build.get_apk(null, arch);
+            launchName = appinfo.getActivityName();
+            console.log('Installing app on device...');
+            var cmd = 'adb -s ' + target + ' install -r "' + apk_path + '"';
+            return exec(cmd);
+        });
     }).then(function(output) {
         if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);
 

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/5cb01f2a/bin/templates/cordova/lib/emulator.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/emulator.js b/bin/templates/cordova/lib/emulator.js
index 0b9747d..88b35f7 100644
--- a/bin/templates/cordova/lib/emulator.js
+++ b/bin/templates/cordova/lib/emulator.js
@@ -293,9 +293,12 @@ module.exports.install = function(target) {
             return Q.reject('Unable to find target \'' + target + '\'. Failed to deploy to emulator.');
         }
 
-        console.log('Installing app on emulator...');
-        var apk_path = build.get_apk();
-        return exec('adb -s ' + target + ' install -r "' + apk_path + '"');
+        return build.detectArchitecture(target)
+        .then(function(arch) {
+            var apk_path = build.get_apk(null, arch);
+            console.log('Installing app on emulator...');
+            return exec('adb -s ' + target + ' install -r "' + apk_path + '"');
+        });
     }).then(function(output) {
         if (output.match(/Failure/)) {
             return Q.reject('Failed to install apk to emulator: ' + output);


[2/3] android commit: CB-7554 Use x86 apk when deploying to an intel device / emulator

Posted by ag...@apache.org.
CB-7554 Use x86 apk when deploying to an intel device / emulator


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

Branch: refs/heads/master
Commit: 5cb01f2ae9c733e2f3ca29302b3274965bf3c7a1
Parents: 4be92f2
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Sep 15 14:23:26 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Sep 15 14:23:26 2014 -0400

----------------------------------------------------------------------
 bin/templates/cordova/lib/build.js    | 15 +++++++++++++++
 bin/templates/cordova/lib/device.js   | 21 ++++++++++-----------
 bin/templates/cordova/lib/emulator.js |  9 ++++++---
 3 files changed, 31 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/5cb01f2a/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index 30056f4..df2448c 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -26,6 +26,7 @@ var shell   = require('shelljs'),
     fs      = require('fs'),
     ROOT    = path.join(__dirname, '..', '..');
 var check_reqs = require('./check_reqs');
+var exec  = require('./exec');
 
 var LOCAL_PROPERTIES_TEMPLATE =
     '# This file is automatically generated.\n' +
@@ -338,6 +339,20 @@ module.exports.run = function(options) {
 };
 
 /*
+ * Detects the architecture of a device/emulator
+ * Returns "arm" or "x86".
+ */
+module.exports.detectArchitecture = function(target) {
+    return exec('adb -s ' + target + ' shell cat /proc/cpuinfo')
+    .then(function(output) {
+        if (/intel/i.exec(output)) {
+            return 'x86';
+        }
+        return 'arm';
+    });
+};
+
+/*
  * Gets the path to the apk file, if not such file exists then
  * the script will error out. (should we error or just return undefined?)
  * This is called by the run script to install the apk to the device

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/5cb01f2a/bin/templates/cordova/lib/device.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/device.js b/bin/templates/cordova/lib/device.js
index df21287..671f93d 100644
--- a/bin/templates/cordova/lib/device.js
+++ b/bin/templates/cordova/lib/device.js
@@ -58,19 +58,18 @@ module.exports.install = function(target) {
         // default device
         target = typeof target !== 'undefined' ? target : device_list[0];
 
-        if (device_list.indexOf(target) < 0)
+        if (device_list.indexOf(target) < 0) {
             return Q.reject('ERROR: Unable to find target \'' + target + '\'.');
-
-        var apk_path;
-        if (typeof process.env.DEPLOY_APK_ARCH == 'undefined') {
-            apk_path = build.get_apk();
-        } else {
-            apk_path = build.get_apk(null, process.env.DEPLOY_APK_ARCH);
         }
-        launchName = appinfo.getActivityName();
-        console.log('Installing app on device...');
-        var cmd = 'adb -s ' + target + ' install -r "' + apk_path + '"';
-        return exec(cmd);
+
+        return build.detectArchitecture(target)
+        .then(function(arch) {
+            var apk_path = build.get_apk(null, arch);
+            launchName = appinfo.getActivityName();
+            console.log('Installing app on device...');
+            var cmd = 'adb -s ' + target + ' install -r "' + apk_path + '"';
+            return exec(cmd);
+        });
     }).then(function(output) {
         if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);
 

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/5cb01f2a/bin/templates/cordova/lib/emulator.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/emulator.js b/bin/templates/cordova/lib/emulator.js
index 0b9747d..88b35f7 100644
--- a/bin/templates/cordova/lib/emulator.js
+++ b/bin/templates/cordova/lib/emulator.js
@@ -293,9 +293,12 @@ module.exports.install = function(target) {
             return Q.reject('Unable to find target \'' + target + '\'. Failed to deploy to emulator.');
         }
 
-        console.log('Installing app on emulator...');
-        var apk_path = build.get_apk();
-        return exec('adb -s ' + target + ' install -r "' + apk_path + '"');
+        return build.detectArchitecture(target)
+        .then(function(arch) {
+            var apk_path = build.get_apk(null, arch);
+            console.log('Installing app on emulator...');
+            return exec('adb -s ' + target + ' install -r "' + apk_path + '"');
+        });
     }).then(function(output) {
         if (output.match(/Failure/)) {
             return Q.reject('Failed to install apk to emulator: ' + output);


[3/3] android commit: Merge branch 'master' into 4.0.x (x86 deploy)

Posted by ag...@apache.org.
Merge branch 'master' into 4.0.x (x86 deploy)


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

Branch: refs/heads/4.0.x
Commit: a10106c61a3979ac18f12199a3ce4cc4df60275c
Parents: 4c1efe7 5cb01f2
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Sep 15 14:24:45 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Sep 15 14:24:45 2014 -0400

----------------------------------------------------------------------
 bin/templates/cordova/lib/build.js    | 15 +++++++++++++++
 bin/templates/cordova/lib/device.js   | 21 ++++++++++-----------
 bin/templates/cordova/lib/emulator.js |  9 ++++++---
 3 files changed, 31 insertions(+), 14 deletions(-)
----------------------------------------------------------------------