[FIX] Updater исправлен парсинг типа версии и номера сборки.

This commit is contained in:
zaxar163 2019-01-25 12:45:11 +03:00
parent 8475d92362
commit e3ac2b15e6
No known key found for this signature in database
GPG key ID: E3B309DD3852DE06
4 changed files with 10 additions and 6 deletions

View file

@ -65,8 +65,8 @@ public void run() {
LogHelper.error(e);
}
}
private static final Pattern startingVerPattern = Pattern.compile("\\d+\\.\\d+\\.\\d+");
private static final Pattern startingVerPattern = Pattern.compile("\\d+\\.\\d+\\.\\d+\\.?\\d*");
private static final Pattern pointPatternSpltitter = Pattern.compile("\\.");
private static Version parseVer(String relS) {
@ -75,11 +75,11 @@ private static Version parseVer(String relS) {
String[] ver = pointPatternSpltitter.split(relS.substring(verMatcher.start(), verMatcher.end()));
if (ver.length < 3) return VERSION;
return new Version(Integer.parseInt(ver[0]), Integer.parseInt(ver[1]),
Integer.parseInt(ver[2]), ver.length > 3 ? Integer.parseInt(ver[3]) : 0, findRelType(relS.substring(verMatcher.end()+1)));
Integer.parseInt(ver[2]), ver.length > 3 ? Integer.parseInt(ver[3]) : 0, findRelType(relS.substring(verMatcher.end())));
}
private static Type findRelType(String substring) {
if (substring.length() < 3 || substring.isEmpty()) return Type.UNKNOWN;
if (substring.isEmpty()) return Type.UNKNOWN;
String tS = substring;
if (tS.startsWith("-")) tS = tS.substring(1);
final String wrk = tS.toLowerCase(Locale.ENGLISH);

View file

@ -28,4 +28,8 @@
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
defaultTasks 'build'

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View file

@ -97,7 +97,7 @@ public enum Type {
public static final Map<String, Type> unModTypes = Collections.unmodifiableMap(types);
static {
Arrays.asList(values()).stream().forEach(type -> types.put(type.name().substring(0, type.name().length() < 3 ? type.name().length() : 3), type));
Arrays.asList(values()).stream().forEach(type -> types.put(type.name().substring(0, type.name().length() < 3 ? type.name().length() : 3).toLowerCase(Locale.ENGLISH), type));
}
}
}