quilt-loader icon indicating copy to clipboard operation
quilt-loader copied to clipboard

Space-separated SemVer version ranges fail for dependencies

Open lukebemish opened this issue 3 years ago • 9 comments

Space separated version ranges for defining dependency version bounds in quilt.mod.json do not work. For instance, taking the quilt template mod and replacing the quilt-loader version requirements in quilt.mod.json with "versions": ">=0.17.0 <0.18.0" causes a ModSolvingException:

[12:57:19] [main/ERROR] (Quilt Loader) Incompatible mod set!
org.quiltmc.loader.impl.FormattedException: org.quiltmc.loader.impl.discovery.ModSolvingException: Unhandled error involving mod 'Mod Name' (example_mod) v1.0.0+1.19:
Dependency for mod 'example_mod' on quilt_loader versions [>=0.17.0 <0.18.0] (0 valid options, 1 invalid options)
        x mod 'quilt_loader' version 0.17.1 loaded from /home/luke/src/quilt-template-mod/.gradle/quilt-loom-cache/remapped_mods/loom_mappings_1_19_2_layered_hash_1291776046_v2/org/quiltmc/quilt-loader/0.17.1/quilt-loader-0.17.1.jar
        at org.quiltmc.loader.impl.QuiltLoaderImpl.load(QuiltLoaderImpl.java:214) ~[quilt-loader-0.17.1.jar:?]
        at org.quiltmc.loader.impl.launch.knot.Knot.init(Knot.java:141) ~[quilt-loader-0.17.1.jar:?]
        at org.quiltmc.loader.impl.launch.knot.Knot.launch(Knot.java:70) [quilt-loader-0.17.1.jar:?]
        at org.quiltmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:24) [quilt-loader-0.17.1.jar:?]
        at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) [dev-launch-injector-0.2.1+build.8.jar:?]
Caused by: org.quiltmc.loader.impl.discovery.ModSolvingException: Unhandled error involving mod 'Mod Name' (example_mod) v1.0.0+1.19:
Dependency for mod 'example_mod' on quilt_loader versions [>=0.17.0 <0.18.0] (0 valid options, 1 invalid options)
        x mod 'quilt_loader' version 0.17.1 loaded from /home/luke/src/quilt-template-mod/.gradle/quilt-loom-cache/remapped_mods/loom_mappings_1_19_2_layered_hash_1291776046_v2/org/quiltmc/quilt-loader/0.17.1/quilt-loader-0.17.1.jar
        at org.quiltmc.loader.impl.solver.ModSolver.fallbackErrorDescription(ModSolver.java:615) ~[quilt-loader-0.17.1.jar:?]
        at org.quiltmc.loader.impl.solver.ModSolver.findCompatibleSet(ModSolver.java:244) ~[quilt-loader-0.17.1.jar:?]
        at org.quiltmc.loader.impl.discovery.ModResolver.resolve(ModResolver.java:430) ~[quilt-loader-0.17.1.jar:?]
        at org.quiltmc.loader.impl.QuiltLoaderImpl.setup(QuiltLoaderImpl.java:223) ~[quilt-loader-0.17.1.jar:?]
        at org.quiltmc.loader.impl.QuiltLoaderImpl.load(QuiltLoaderImpl.java:212) ~[quilt-loader-0.17.1.jar:?]

lukebemish avatar Aug 27 '22 18:08 lukebemish

I don't think QMJ supports multiple overlapping version constraints at the moment - neither with spaces or any other method. (the relevant part of the spec is here: https://github.com/QuiltMC/rfcs/blob/main/specification/0002-quilt.mod.json.md#the-versions-field)

AlexIIL avatar Aug 27 '22 19:08 AlexIIL

That links here: https://devhints.io/semver. I had also been told on discord that it did; if that is inaccurate, then what is the proper way to specify bounded version ranges? i.e, "less than this one and more than this". If there isn't currently any way to do that, I can look into what it would take to add that.

lukebemish avatar Aug 27 '22 19:08 lukebemish

A quick workaround is to use ~0.17.0, which means the same thing as your example

AlexIIL avatar Aug 27 '22 19:08 AlexIIL

In this example, yes. But, say, less than 0.18.5 and more than 0.17.0? That solution is not very flexible. If there is no way at present to do this, I'll look into making a PR

lukebemish avatar Aug 27 '22 19:08 lukebemish

I started to suggest a change to fix this - https://github.com/QuiltMC/rfcs/pull/56 - but that link wasn't present in the original spec -_-

AlexIIL avatar Aug 27 '22 19:08 AlexIIL

Additionally, this: https://github.com/QuiltMC/quilt-loader/blob/develop/src/main/java/org/quiltmc/loader/impl/util/version/VersionPredicateParser.java would seem to imply that some sort of space-separating parsing, or at least the infrastructure for it, already exists.

lukebemish avatar Aug 27 '22 19:08 lukebemish

That's for fabric.mod.json

AlexIIL avatar Aug 27 '22 19:08 AlexIIL

To be clear: you're not wrong - this is functionality we should have, but I've not worked on actually implementing this yet.

AlexIIL avatar Aug 27 '22 19:08 AlexIIL

Yes, I am aware. My point is, basically: the infrastructure for parsing versions of this sort is already present, though currently it is used only for fabric.mod.json and not for quilt.mod.json.

lukebemish avatar Aug 27 '22 19:08 lukebemish