QuiltMC / quilt-loom

MIT License
22 stars 19 forks source link

Transitive Dependencies not added to compile classpath #27

Closed Oliver-makes-code closed 1 year ago

Oliver-makes-code commented 1 year ago

I'm making a create addon, and when I add Create as a modImplementation, it doesn't add its deps to the compile classpath. They're still there at runtime, but not at compile. https://paste.gg/p/anonymous/92124257a4624dcaa17a28c46d6cbfc3

TibiNonEst commented 1 year ago

I can't seem to recreate this, can I see your build.gradle file?

sisby-folk commented 1 year ago

This could be a 1.1/1.0 iffy cross-support issue? on loom 1.0, a bunch of stuff is weirdly marked as runtime scope in maven poms on publish. Like - modImplementation is published as runtime, as an example. This caused us some problems because we found that modCompileOnly would still pull all of these runtime dependencies under 1.0.

Pretty sure runtime scoping is supposed to be fixed to some extent in 1.1, which we're looking forward to.

So, it might be you can't recreate it because the thing was published with loom 1.0 and has a weird runtime-filled pom? @Oliver-makes-code can you link the relevant create pom directly?

TibiNonEst commented 1 year ago

Did anything ever come of this?

TibiNonEst commented 1 year ago

Ok so, we just had a long discussion about this on discord and here's what's up. The @sisby-folk are right. Loom prior to 1.1 contained bugged behavior with dependency scoping where transitive dependencies scoped for runtime were being pulled in for compile as well in mod configurations. What this meant is mods, create in this case, relied on dependencies which got exposed as APIs when they should not have. Thus, when a mod depended on create, create's dependencies, compile and runtime, got pulled in as compile-time dependencies to the mod. Starting with loom 1.1 transitive dependencies scoped as runtime will only be pulled in as runtime, thus removing API access to them if your mod solely depends on create (or whatever mod).

To resolve this, create should either depend on these dependencies in an API configuration (ex. modApi) so they get scoped as compile time and correctly pulled in, or mod authors need to depend on these dependencies themselves, bypassing the transitive dependency altogether.

Thanks to @lukebemish for helping me come to this conclusion, I don't know if I would have been able to figure it out without you :P.