MelonLoader icon indicating copy to clipboard operation
MelonLoader copied to clipboard

[RFC] MelonInfo constructor with `(int, int, int)` versioning

Open xKiraiChan opened this issue 3 years ago • 7 comments

MelonLoader's preferred versioning system is SemVer, which commonly uses 3 integers delimited by periods. Some creators have accidentally put a v into their version number not expecting ML to add one. Using an integer tuple would prevent this.

Since this would be an override, it shouldn't break old mods using the old constructor.

Additionally, this would allow in the future for MelonLoader to check if a dependency's version meets the minimum that a mod requires.

Example:

[assembly: MelonInfo(typeof(...), "Name", "1.2.3", "Author", "Link")] could be converted to [assembly: MelonInfo(typeof(...), "Name", (1, 2, 3), "Author", "Link")]

xKiraiChan avatar Dec 01 '21 23:12 xKiraiChan

version.Replace("v", string.Empty) problem solved

slxdy avatar Dec 01 '21 23:12 slxdy

and then you have to deal with V, version, Version, ...

Why suggest a bandage fix over a better design?

xKiraiChan avatar Dec 01 '21 23:12 xKiraiChan

Additionally, MelonLoader does not support a null version (but used to), but strings are able to be empty or \x1b[1D If versioning is going to be enforced it would be easier using integral types

xKiraiChan avatar Dec 01 '21 23:12 xKiraiChan

This could be a thing. Maybe not implemented this way and not replacing the string function (since we can have semvers like 1.2.3-testing2), but I like the idea

Slaynash avatar Dec 02 '21 00:12 Slaynash

Why not (int, int, int) or (int, int, int, string), then the string just gets appended to the end when it is written to console or printed?

Ex: [assembly: MelonInfo(typeof(...), "Name", (1, 2, 3, "-beta"), "Author", "Link")] which would print version as 1.2.3-beta. The string parameter could be called comment, branch, or something along those lines.

Edit: It may also be helpful to add a method into MelonUtils that converts SemVer strings into the int/string representation of it.

loukylor avatar Dec 02 '21 04:12 loukylor

This is now added in the latest alpha-development nightly build.

HerpDerpinstine avatar Oct 14 '22 03:10 HerpDerpinstine

Moving this back to v0.6.0 as the recent attempt for v0.5.7 caused Melon compilation issues.

HerpDerpinstine avatar Oct 26 '22 18:10 HerpDerpinstine