mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-31 17:32:51 +08:00
CB-3445: Allow build and run scripts to select APK by architecture
This commit is contained in:
parent
34dde53506
commit
4bc2051f44
4
bin/templates/cordova/lib/build.js
vendored
4
bin/templates/cordova/lib/build.js
vendored
@ -342,9 +342,9 @@ module.exports.run = function(options) {
|
|||||||
* the script will error out. (should we error or just return undefined?)
|
* 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
|
* 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 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) {
|
if (candidates.length === 0) {
|
||||||
console.error('ERROR : No .apk found in ' + outputDir + ' directory');
|
console.error('ERROR : No .apk found in ' + outputDir + ' directory');
|
||||||
process.exit(2);
|
process.exit(2);
|
||||||
|
7
bin/templates/cordova/lib/device.js
vendored
7
bin/templates/cordova/lib/device.js
vendored
@ -61,7 +61,12 @@ module.exports.install = function(target) {
|
|||||||
if (device_list.indexOf(target) < 0)
|
if (device_list.indexOf(target) < 0)
|
||||||
return Q.reject('ERROR: Unable to find target \'' + target + '\'.');
|
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();
|
launchName = appinfo.getActivityName();
|
||||||
console.log('Installing app on device...');
|
console.log('Installing app on device...');
|
||||||
var cmd = 'adb -s ' + target + ' install -r "' + apk_path + '"';
|
var cmd = 'adb -s ' + target + ' install -r "' + apk_path + '"';
|
||||||
|
Loading…
Reference in New Issue
Block a user