From 0b6b0680975b569bc12b3dc79bf26359a7478f73 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Fri, 29 Aug 2014 16:00:13 -0400 Subject: [PATCH] CB-3445: Allow build and run scripts to select APK by architecture --- bin/templates/cordova/lib/build.js | 4 ++-- bin/templates/cordova/lib/device.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js index 77fe2597..30056f46 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); diff --git a/bin/templates/cordova/lib/device.js b/bin/templates/cordova/lib/device.js index d37f80c9..df212876 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 + '"';