You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/07/18 08:46:53 UTC
[GitHub] [cordova-android] janpio commented on a change in pull request
#788: Simplify apkSorter using compare-func package
janpio commented on a change in pull request #788: Simplify apkSorter using compare-func package
URL: https://github.com/apache/cordova-android/pull/788#discussion_r304803019
##########
File path: bin/templates/cordova/lib/builders/ProjectBuilder.js
##########
@@ -300,27 +301,19 @@ class ProjectBuilder {
module.exports = ProjectBuilder;
-function apkSorter (fileA, fileB) {
- const archSpecificRE = /-x86|-arm/;
+const apkSorter = compareFunc([
+ // Sort arch specific builds after generic ones
+ apkPath => /-x86|-arm/.test(apkPath),
- const unsignedRE = /-unsigned/;
+ // Sort unsigned builds after signed ones
+ apkPath => /-unsigned/.test(apkPath),
- // De-prioritize arch-specific builds & unsigned builds
- const lower = (fileName) => {
- return archSpecificRE.exec(fileName)
- ? -2
- : unsignedRE.exec(fileName)
- ? -1
- : 0;
- };
+ // Sort by file modification time, latest first
+ apkPath => -fs.statSync(apkPath).mtime.getTime(),
Review comment:
if it's not, would be "funny" that the tests pass anyway...
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org