mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
CB-6543 Fix cordova/run failure when no custom_rules.xml available
Github: Close #99
This commit is contained in:
parent
11fc6be328
commit
e6adbb0e42
11
bin/templates/cordova/lib/build.js
vendored
11
bin/templates/cordova/lib/build.js
vendored
@ -74,7 +74,12 @@ module.exports.run = function(build_type) {
|
|||||||
* the script will error out. (should we error or just return undefined?)
|
* the script will error out. (should we error or just return undefined?)
|
||||||
*/
|
*/
|
||||||
module.exports.get_apk = function() {
|
module.exports.get_apk = function() {
|
||||||
var binDir = path.join(ROOT, 'ant-build');
|
var binDir = '';
|
||||||
|
if(!hasCustomRules()) {
|
||||||
|
binDir = path.join(ROOT, 'bin');
|
||||||
|
} else {
|
||||||
|
binDir = path.join(ROOT, 'ant-build');
|
||||||
|
}
|
||||||
if (fs.existsSync(binDir)) {
|
if (fs.existsSync(binDir)) {
|
||||||
var candidates = fs.readdirSync(binDir).filter(function(p) {
|
var candidates = fs.readdirSync(binDir).filter(function(p) {
|
||||||
// Need to choose between release and debug .apk.
|
// Need to choose between release and debug .apk.
|
||||||
@ -87,13 +92,13 @@ module.exports.get_apk = function() {
|
|||||||
a.t < b.t ? 1 : 0;
|
a.t < b.t ? 1 : 0;
|
||||||
});
|
});
|
||||||
if (candidates.length === 0) {
|
if (candidates.length === 0) {
|
||||||
console.error('ERROR : No .apk found in \'ant-build\' directory');
|
console.error('ERROR : No .apk found in ' + binDir + ' directory');
|
||||||
process.exit(2);
|
process.exit(2);
|
||||||
}
|
}
|
||||||
console.log('Using apk: ' + candidates[0].p);
|
console.log('Using apk: ' + candidates[0].p);
|
||||||
return candidates[0].p;
|
return candidates[0].p;
|
||||||
} else {
|
} else {
|
||||||
console.error('ERROR : unable to find project ant-build directory, could not locate .apk');
|
console.error('ERROR : unable to find project ' + binDir + ' directory, could not locate .apk');
|
||||||
process.exit(2);
|
process.exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user