You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2015/09/23 21:58:33 UTC
[22/45] android commit: CB-9404 Fixed an exception when path
contained -debug or -release
CB-9404 Fixed an exception when path contained -debug or -release
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/fb4cc38e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/fb4cc38e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/fb4cc38e
Branch: refs/heads/5.0.x
Commit: fb4cc38e9d27d83f9c346045c6bf22aab12f2961
Parents: 17440a4
Author: alsorokin <al...@akvelon.com>
Authored: Thu Jul 23 18:55:11 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:40 2015 -0700
----------------------------------------------------------------------
bin/templates/cordova/lib/build.js | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/fb4cc38e/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index aa9f3d0..bbcf171 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -69,12 +69,13 @@ function isAutoGenerated(file) {
function findOutputApksHelper(dir, build_type, arch) {
var ret = findApks(dir).filter(function(candidate) {
+ var apkName = path.basename(candidate);
// Need to choose between release and debug .apk.
if (build_type === 'debug') {
- return /-debug/.exec(candidate) && !/-unaligned|-unsigned/.exec(candidate);
+ return /-debug/.exec(apkName) && !/-unaligned|-unsigned/.exec(apkName);
}
if (build_type === 'release') {
- return /-release/.exec(candidate) && !/-unaligned/.exec(candidate);
+ return /-release/.exec(apkName) && !/-unaligned/.exec(apkName);
}
return true;
});
@@ -83,16 +84,16 @@ function findOutputApksHelper(dir, build_type, arch) {
return ret;
}
// Assume arch-specific build if newest apk has -x86 or -arm.
- var archSpecific = !!/-x86|-arm/.exec(ret[0]);
+ var archSpecific = !!/-x86|-arm/.exec(path.basename(ret[0]));
// And show only arch-specific ones (or non-arch-specific)
ret = ret.filter(function(p) {
/*jshint -W018 */
- return !!/-x86|-arm/.exec(p) == archSpecific;
+ return !!/-x86|-arm/.exec(path.basename(p)) == archSpecific;
/*jshint +W018 */
});
if (archSpecific && ret.length > 1) {
ret = ret.filter(function(p) {
- return p.indexOf('-' + arch) != -1;
+ return path.basename(p).indexOf('-' + arch) != -1;
});
}
@@ -632,16 +633,18 @@ module.exports.detectArchitecture = function(target) {
module.exports.findBestApkForArchitecture = function(buildResults, arch) {
var paths = buildResults.apkPaths.filter(function(p) {
+ var apkName = path.basename(p);
if (buildResults.buildType == 'debug') {
- return /-debug/.exec(p);
+ return /-debug/.exec(apkName);
}
- return !/-debug/.exec(p);
+ return !/-debug/.exec(apkName);
});
var archPattern = new RegExp('-' + arch);
var hasArchPattern = /-x86|-arm/;
for (var i = 0; i < paths.length; ++i) {
- if (hasArchPattern.exec(paths[i])) {
- if (archPattern.exec(paths[i])) {
+ var apkName = path.basename(paths[i]);
+ if (hasArchPattern.exec(apkName)) {
+ if (archPattern.exec(apkName)) {
return paths[i];
}
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org