-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop recommending that mods depend on an optional dependency via runtimeOnly #48
Conversation
Note: this really is something where the MDK ought to display good practice, as I have seen mods out in the wild copying what the MDK does for this type of dependency and so publishing bad transitive runtime dependencies which get pulled in by anything trying to depend on them. |
What are we actually trying to achieve here? As such I think adding them as a run dependency, instead of a configuration is the better approach. Is it not? |
Mods cannot be declared as run dependencies, as that sets them up on the wrong layer. And |
What maty said; plus, run-specific dependencies are confusing when people are used to dependencies in the dependencies block, and runtime-local dependencies should not be an "advanced" thing by any means. The run-specific dependency block seems primarily meant for being fed into the task that generated the minecraft classpath; that's not the issue here, the issue is preventing publishing of something where depending on it normally is just fine. |
Yes and I agree that this is the correct solution. |
No, I don't agree. These aren't "I want this in dev for convenience" dependencies, these are "I'm compiling against this and need to test with it" dependencies. If you're declaring a gradle dep on it to compile against it, you want to be able to use gradle for the testing dependency too. Beyond that -- you can't/shouldn't commit the mods folder to git. People want their optional dependencies on git so that if they clone the repo fresh, it's good to go |
I hope you are not suggesting that I download JEI, EMI, Curios and REI by hand and place them there 👀 |
Currently, the MDK has an example dependency, commented out, on JEI using
compileOnly
andruntimeOnly
. It is implied that this is an optional dependency, both as JEI is normally an optional dependency and becauseimplementation
is not used. However, the use ofruntimeOnly
does not create an optional dependency;runtimeOnly
adds a dependency to bothruntimeClasspath
(what gets used in dev to run the game) andruntimeElements
(the dependencies you publish, in a pom or module metadata, as "I need these at runtime"). This means that any mod depending on a mod that depends on JEI this way will attempt to pull in JEI at runtime as a transitive dependency! This was not an issue with old forgegradle, asfg.deobf
stripped all transitive dependencies, but it is an issue now and the MDK should recommend good practice. As an optional dependency, it should be added only toruntimeClasspath
, which must be done through another configuration asruntimeClasspath
cannot have dependencies directly declared. This PR solves this in the correct way.