From b01da94a9cdd60295d49e76628fa0cc5976b3fa2 Mon Sep 17 00:00:00 2001 From: Thomas Wirth Date: Wed, 13 Feb 2019 11:49:09 +0100 Subject: [PATCH 1/5] Update sample app dependencies and remove tools namespace from xml --- build.gradle | 2 +- sample/build.gradle | 2 +- sample/src/main/res/layout/activity_main.xml | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 3713f27..f55540b 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.3.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3' diff --git a/sample/build.gradle b/sample/build.gradle index 4157ca2..f3719ae 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -30,7 +30,7 @@ dependencies { } buildscript { - ext.kotlin_version = '1.3.11' + ext.kotlin_version = '1.3.21' repositories { mavenCentral() } diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index 8951a8d..5a14780 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -1,12 +1,9 @@ Date: Wed, 13 Feb 2019 11:53:31 +0100 Subject: [PATCH 2/5] Simplify the preReleaseVersion logic --- .../com/g00fy2/versioncompare/VersionComparator.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/versioncompare/src/main/java/com/g00fy2/versioncompare/VersionComparator.java b/versioncompare/src/main/java/com/g00fy2/versioncompare/VersionComparator.java index 6be8465..4079c3e 100644 --- a/versioncompare/src/main/java/com/g00fy2/versioncompare/VersionComparator.java +++ b/versioncompare/src/main/java/com/g00fy2/versioncompare/VersionComparator.java @@ -48,7 +48,7 @@ static int compareSuffix(@Nonnull final String suffixA, @Nonnull final String su return 1; } else if (qualifierA < qualifierB) { return -1; - } else if (qualifierA != UNKNOWN && qualifierB != UNKNOWN) { + } else if (qualifierA != UNKNOWN) { final int suffixVersionA = preReleaseVersion(suffixA, qualifierA); final int suffixVersionB = preReleaseVersion(suffixB, qualifierB); @@ -84,10 +84,12 @@ private static int preReleaseVersion(@Nonnull final String suffix, final int qua final int maxStartIndex = Math.min(startIndex + 2, suffix.length()); if (containsNumeric(suffix.substring(startIndex, maxStartIndex))) { StringBuilder versionNumber = new StringBuilder(); - for (int i = startIndex, numIndex = -1; i < suffix.length() && (numIndex == -1 || numIndex + 1 == i); i++) { - if (Character.isDigit(suffix.charAt(i))) { - numIndex = i; - versionNumber.append(suffix.charAt(i)); + for (int i = startIndex; i < suffix.length(); i++) { + char c = suffix.charAt(i); + if (Character.isDigit(c)) { + versionNumber.append(c); + } else if (i != startIndex) { + break; } } return safeParseInt(versionNumber.toString()); From 93898ebed83ec438da83e76f7500f6858f626b9e Mon Sep 17 00:00:00 2001 From: Thomas Wirth Date: Wed, 13 Feb 2019 11:55:27 +0100 Subject: [PATCH 3/5] Improve version release qualifier detection --- .../main/java/com/g00fy2/versioncompare/VersionComparator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncompare/src/main/java/com/g00fy2/versioncompare/VersionComparator.java b/versioncompare/src/main/java/com/g00fy2/versioncompare/VersionComparator.java index 4079c3e..a6f44fd 100644 --- a/versioncompare/src/main/java/com/g00fy2/versioncompare/VersionComparator.java +++ b/versioncompare/src/main/java/com/g00fy2/versioncompare/VersionComparator.java @@ -68,7 +68,7 @@ private static int qualifierToNumber(@Nonnull String suffix) { if (suffix.contains(RC_STRING)) return RC; if (suffix.contains(BETA_STRING)) return BETA; if (suffix.contains(ALPHA_STRING)) { - if (suffix.contains(PRE_STRING)) { + if (suffix.substring(0, suffix.indexOf(ALPHA_STRING)).contains(PRE_STRING)) { return PRE_ALPHA; } else { return ALPHA; From 2f184581b2ff46eef0498b7da09e4b812477b6ff Mon Sep 17 00:00:00 2001 From: Thomas Wirth Date: Sun, 10 Mar 2019 15:18:14 +0100 Subject: [PATCH 4/5] Update gradle plugins --- build.gradle | 4 ++-- versioncompare/build.gradle | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index f55540b..d260497 100644 --- a/build.gradle +++ b/build.gradle @@ -4,10 +4,10 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.1' + classpath 'com.android.tools.build:gradle:3.3.2' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' - classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3' + classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4' } } diff --git a/versioncompare/build.gradle b/versioncompare/build.gradle index 17eec6b..9ac3fd4 100644 --- a/versioncompare/build.gradle +++ b/versioncompare/build.gradle @@ -16,7 +16,7 @@ dependencies { } jacoco { - toolVersion = "0.8.2" + toolVersion = "0.8.3" } jacocoAndroidUnitTestReport { From 5845fbaa77b9722748a7872892425ae1fa765e14 Mon Sep 17 00:00:00 2001 From: Thomas Wirth Date: Sun, 10 Mar 2019 15:27:20 +0100 Subject: [PATCH 5/5] Bump version to 1.3.1 --- versioncompare/deploy.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncompare/deploy.gradle b/versioncompare/deploy.gradle index 09b1261..dff31b8 100644 --- a/versioncompare/deploy.gradle +++ b/versioncompare/deploy.gradle @@ -12,7 +12,7 @@ ext { issueUrl = 'https://github.com/G00fY2/version-compare/issues' gitUrl = 'https://github.com/G00fY2/version-compare.git' - libraryVersion = '1.3.0' + libraryVersion = '1.3.1' developerId = 'g00fy2' developerName = 'Thomas Wirth'