Skip to content
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

Run configurations generated with incorrect output directory #103

Open
SquidDev opened this issue Jan 15, 2024 · 1 comment
Open

Run configurations generated with incorrect output directory #103

SquidDev opened this issue Jan 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@SquidDev
Copy link
Contributor

if (ideaRunsExtension.getRunWithIdea().get()) {
final File parentDir = ideaRunsExtension.getOutDirectory().get().getAsFile();
final File sourceSetDir = new File(parentDir, getIntellijOutName(sourceSet));
return Stream.of(new File(sourceSetDir, "resources"), new File(sourceSetDir, "classes"));
}

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?

@marchermans
Copy link
Contributor

Yes sure, a PR for this is welcome!

@sciwhiz12 sciwhiz12 added the bug Something isn't working label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants