You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/09/11 17:28:55 UTC

[13/31] android commit: CB-3445: Allow build and run scripts to select APK by architecture

CB-3445: Allow build and run scripts to select APK by architecture


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

Branch: refs/heads/4.0.x
Commit: 4bc2051f442473c2c3c854e18487d1058c53b58b
Parents: 34dde53
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Aug 29 16:00:13 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Fri Aug 29 16:00:13 2014 -0400

----------------------------------------------------------------------
 bin/templates/cordova/lib/build.js  | 4 ++--
 bin/templates/cordova/lib/device.js | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4bc2051f/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index 77fe259..30056f4 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -342,9 +342,9 @@ module.exports.run = function(options) {
  * 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
  */
-module.exports.get_apk = function(build_type) {
+module.exports.get_apk = function(build_type, architecture) {
     var outputDir = path.join(ROOT, 'out');
-    var candidates = find_files(outputDir, function() { return true; });
+    var candidates = find_files(outputDir, function(filename) { return (!architecture) || filename.indexOf(architecture) >= 0; });
     if (candidates.length === 0) {
         console.error('ERROR : No .apk found in ' + outputDir + ' directory');
         process.exit(2);

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4bc2051f/bin/templates/cordova/lib/device.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/device.js b/bin/templates/cordova/lib/device.js
index d37f80c..df21287 100644
--- a/bin/templates/cordova/lib/device.js
+++ b/bin/templates/cordova/lib/device.js
@@ -61,7 +61,12 @@ module.exports.install = function(target) {
         if (device_list.indexOf(target) < 0)
             return Q.reject('ERROR: Unable to find target \'' + target + '\'.');
 
-        var apk_path = build.get_apk();
+        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 + '"';