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
  • Loading branch information
zakkak committed Jul 17, 2024
1 parent 48c154e commit af6dcfb
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 @@ -1527,18 +1527,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 @@ -1554,7 +1560,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 af6dcfb

Please sign in to comment.