You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/09/16 21:01:13 UTC

[1/3] android commit: CB-7512 Use aligned apk rather than unaligned apk when sorting

Repository: cordova-android
Updated Branches:
  refs/heads/4.0.x 6eb4409a7 -> 6fb164d20
  refs/heads/master 533677df8 -> a5d300c6f


CB-7512 Use aligned apk rather than unaligned apk when sorting


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/a5d300c6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/a5d300c6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/a5d300c6

Branch: refs/heads/4.0.x
Commit: a5d300c6ff7bbcec4bbb982ac7a4195333260941
Parents: 533677d
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 16 14:59:43 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Sep 16 14:59:43 2014 -0400

----------------------------------------------------------------------
 bin/templates/cordova/lib/build.js | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/a5d300c6/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index e63e342..3224758 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -38,8 +38,11 @@ function find_files(directory, predicate) {
             p = path.join(directory, p);
             return { p: p, t: fs.statSync(p).mtime };
         }).sort(function(a,b) {
-            return a.t > b.t ? -1 :
-                   a.t < b.t ? 1 : 0;
+            var timeDiff = b.t - a.t;
+            if (timeDiff === 0) {
+                return a.p.length - b.p.length;
+            }
+            return timeDiff;
         }).map(function(p) { return p.p; });
         return candidates;
     } else {
@@ -151,8 +154,9 @@ var builders = {
                 console.error('ERROR : No .apk found in ' + binDir + ' directory');
                 process.exit(2);
             }
-            console.log('Using apk: ' + candidates[0]);
-            return [candidates[0]];
+            var ret = candidates[0];
+            console.log('Using apk: ' + ret);
+            return [ret];
         }
     },
     gradle: {
@@ -245,14 +249,16 @@ var builders = {
             var candidates = find_files(binDir, function(candidate) {
                 // Need to choose between release and debug .apk.
                 if (build_type === 'debug') {
-                    return (path.extname(candidate) == '.apk' && candidate.indexOf('-debug-') >= 0);
+                    return (path.extname(candidate) == '.apk' && candidate.indexOf('-debug') >= 0);
                 }
                 if (build_type === 'release') {
-                    return (path.extname(candidate) == '.apk' && candidate.indexOf('-release-') >= 0);
+                    return (path.extname(candidate) == '.apk' && candidate.indexOf('-release') >= 0);
                 }
                 return path.extname(candidate) == '.apk';
             });
-            return candidates;
+            var ret = candidates[0];
+            console.log('Using apk: ' + ret);
+            return [ret];
         }
     },
 


[2/3] android commit: CB-7512 Use aligned apk rather than unaligned apk when sorting

Posted by ag...@apache.org.
CB-7512 Use aligned apk rather than unaligned apk when sorting


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/a5d300c6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/a5d300c6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/a5d300c6

Branch: refs/heads/master
Commit: a5d300c6ff7bbcec4bbb982ac7a4195333260941
Parents: 533677d
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 16 14:59:43 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Sep 16 14:59:43 2014 -0400

----------------------------------------------------------------------
 bin/templates/cordova/lib/build.js | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/a5d300c6/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index e63e342..3224758 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -38,8 +38,11 @@ function find_files(directory, predicate) {
             p = path.join(directory, p);
             return { p: p, t: fs.statSync(p).mtime };
         }).sort(function(a,b) {
-            return a.t > b.t ? -1 :
-                   a.t < b.t ? 1 : 0;
+            var timeDiff = b.t - a.t;
+            if (timeDiff === 0) {
+                return a.p.length - b.p.length;
+            }
+            return timeDiff;
         }).map(function(p) { return p.p; });
         return candidates;
     } else {
@@ -151,8 +154,9 @@ var builders = {
                 console.error('ERROR : No .apk found in ' + binDir + ' directory');
                 process.exit(2);
             }
-            console.log('Using apk: ' + candidates[0]);
-            return [candidates[0]];
+            var ret = candidates[0];
+            console.log('Using apk: ' + ret);
+            return [ret];
         }
     },
     gradle: {
@@ -245,14 +249,16 @@ var builders = {
             var candidates = find_files(binDir, function(candidate) {
                 // Need to choose between release and debug .apk.
                 if (build_type === 'debug') {
-                    return (path.extname(candidate) == '.apk' && candidate.indexOf('-debug-') >= 0);
+                    return (path.extname(candidate) == '.apk' && candidate.indexOf('-debug') >= 0);
                 }
                 if (build_type === 'release') {
-                    return (path.extname(candidate) == '.apk' && candidate.indexOf('-release-') >= 0);
+                    return (path.extname(candidate) == '.apk' && candidate.indexOf('-release') >= 0);
                 }
                 return path.extname(candidate) == '.apk';
             });
-            return candidates;
+            var ret = candidates[0];
+            console.log('Using apk: ' + ret);
+            return [ret];
         }
     },
 


[3/3] android commit: Merge branch 'master' into 4.0.x (unaligned apk fix)

Posted by ag...@apache.org.
Merge branch 'master' into 4.0.x (unaligned apk fix)


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/6fb164d2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/6fb164d2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/6fb164d2

Branch: refs/heads/4.0.x
Commit: 6fb164d200d94f7c8ef9df15e86d4a4f779df31c
Parents: 6eb4409 a5d300c
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 16 15:00:54 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Sep 16 15:00:54 2014 -0400

----------------------------------------------------------------------
 bin/templates/cordova/lib/build.js | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------