NeoGradle icon indicating copy to clipboard operation
NeoGradle copied to clipboard

Run configurations generated with incorrect output directory

Open SquidDev opened this issue 7 months ago • 1 comments

https://github.com/neoforged/NeoGradle/blob/96d3cf8699f31721b57170eb7f719e6cb64e3ef9/common/src/main/java/net/neoforged/gradle/common/util/run/RunsUtil.java#L92-L96

When getRunWithIdea is enabled in the IDEA run configuration, NG will specify that classes should be loaded from IntelliJ's output directory instead of Gradle's. However, the way classes within that directory are found doesn't appear to be correct when working with a multi-module setup:

  • If using a global output directory rather than a per-module one (this happens when working with Loom, as they set idea.module.inheritOutputDirs = true), then classes are put in $outDir/production/$moduleName rather than $outDir/production.
  • If not using a global output directory, then the output directory is only correct for the root module, and not any child modules.

Thinking about this more generally, I'm not entirely sure that configuring the output directory (or getRunWithIdea via Gralde) is the correct thing to do. Both those properties are workspace/user specific, and (as far as I know) cannot be controlled by Gradle.

I wonder if a better option would be to read IDEA's config directly - this is what Loom does, and it works pretty reliably.

I'm happy to take a look at a PR for this if that sounds reasonable?

SquidDev avatar Jan 15 '24 09:01 SquidDev