Skip to content

Commit

Permalink
Support 4-digit mx versions
Browse files Browse the repository at this point in the history
The assumption that mx versions follow the MAJOR.MINOR.PATCH versioning
seems to not always hold. E.g. the following releases include an
additional 4th number:

* 5.275.7.1
* 6.9.1.1
* 7.4.1.1

(cherry picked from commit af6dcfb)
  • Loading branch information
zakkak committed Oct 16, 2024
1 parent 6c604d8 commit 5b0e950
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions build.java
Original file line number Diff line number Diff line change
Expand Up @@ -1526,18 +1526,24 @@ class MxVersion implements Comparable<MxVersion>
final int major;
final int minor;
final int patch;
final int build;
static final MxVersion mx5_313_0 = new MxVersion("5.313.0");

MxVersion(String version)
{
String[] split = version.split("\\.");
if (split.length != 3)
if (split.length < 3 || split.length > 4)
{
throw new IllegalArgumentException("Version should be of the form MAJOR.MINOR.PATCH not " + version);
throw new IllegalArgumentException("Version should be of the form MAJOR.MINOR.PATCH[.BUILD] not " + version);
}
major = Integer.parseInt(split[0]);
minor = Integer.parseInt(split[1]);
patch = Integer.parseInt(split[2]);
if (split.length == 4) {
build = Integer.parseInt(split[3]);
} else {
build = 0;
}
}

@Override
Expand All @@ -1553,7 +1559,12 @@ public int compareTo(MxVersion other)
{
return result;
}
return patch - other.patch;
result = patch - other.patch;
if (result != 0)
{
return result;
}
return build - other.build;
}
}

Expand Down

0 comments on commit 5b0e950

Please sign in to comment.