mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
Merge branch 'master' into 4.0.x (x86 deploy)
This commit is contained in:
commit
a10106c61a
15
bin/templates/cordova/lib/build.js
vendored
15
bin/templates/cordova/lib/build.js
vendored
@ -26,6 +26,7 @@ var shell = require('shelljs'),
|
|||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
ROOT = path.join(__dirname, '..', '..');
|
ROOT = path.join(__dirname, '..', '..');
|
||||||
var check_reqs = require('./check_reqs');
|
var check_reqs = require('./check_reqs');
|
||||||
|
var exec = require('./exec');
|
||||||
|
|
||||||
var LOCAL_PROPERTIES_TEMPLATE =
|
var LOCAL_PROPERTIES_TEMPLATE =
|
||||||
'# This file is automatically generated.\n' +
|
'# This file is automatically generated.\n' +
|
||||||
@ -337,6 +338,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
|
* 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?)
|
* the script will error out. (should we error or just return undefined?)
|
||||||
|
13
bin/templates/cordova/lib/device.js
vendored
13
bin/templates/cordova/lib/device.js
vendored
@ -58,19 +58,18 @@ module.exports.install = function(target) {
|
|||||||
// default device
|
// default device
|
||||||
target = typeof target !== 'undefined' ? target : device_list[0];
|
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 + '\'.');
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return build.detectArchitecture(target)
|
||||||
|
.then(function(arch) {
|
||||||
|
var apk_path = build.get_apk(null, 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 + '"';
|
||||||
return exec(cmd);
|
return exec(cmd);
|
||||||
|
});
|
||||||
}).then(function(output) {
|
}).then(function(output) {
|
||||||
if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);
|
if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);
|
||||||
|
|
||||||
|
5
bin/templates/cordova/lib/emulator.js
vendored
5
bin/templates/cordova/lib/emulator.js
vendored
@ -293,9 +293,12 @@ module.exports.install = function(target) {
|
|||||||
return Q.reject('Unable to find target \'' + target + '\'. Failed to deploy to emulator.');
|
return Q.reject('Unable to find target \'' + target + '\'. Failed to deploy to emulator.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return build.detectArchitecture(target)
|
||||||
|
.then(function(arch) {
|
||||||
|
var apk_path = build.get_apk(null, arch);
|
||||||
console.log('Installing app on emulator...');
|
console.log('Installing app on emulator...');
|
||||||
var apk_path = build.get_apk();
|
|
||||||
return exec('adb -s ' + target + ' install -r "' + apk_path + '"');
|
return exec('adb -s ' + target + ' install -r "' + apk_path + '"');
|
||||||
|
});
|
||||||
}).then(function(output) {
|
}).then(function(output) {
|
||||||
if (output.match(/Failure/)) {
|
if (output.match(/Failure/)) {
|
||||||
return Q.reject('Failed to install apk to emulator: ' + output);
|
return Q.reject('Failed to install apk to emulator: ' + output);
|
||||||
|
Loading…
Reference in New Issue
Block a user