MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
526 stars 447 forks source link

Make mappings a runtime-only dependency #891

Closed Su5eD closed 1 year ago

Su5eD commented 2 years ago

Removes mappings from the compile classpath.

Mappings are first and foremost a runtime dependency. They contain no code, so adding them to the compile classpath is redundant. Plus with the module system in play, this creates a direct conflict as the module-path can only contain jar and jmod files.1

Here's an example use case for compiling a modular service that depends on fmlloader, a legacy jar. By assigning the compile classpath to the module path, we could easily use non-modular jars in our library.

compileJava {
    options.compilerArgs << '--module-path' << classpath.asPath
}

There's a catch though: currently, the classpath can not be a valid module path because it contains an invalid artifact - mappings. If we try to compile our code in this configuration, the compiler will crash.