diff --git a/src/main/java/net/neoforged/moddevgradle/internal/RunUtils.java b/src/main/java/net/neoforged/moddevgradle/internal/RunUtils.java index f4a37ef1..4ed4bce2 100644 --- a/src/main/java/net/neoforged/moddevgradle/internal/RunUtils.java +++ b/src/main/java/net/neoforged/moddevgradle/internal/RunUtils.java @@ -36,6 +36,7 @@ import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; @@ -199,8 +200,15 @@ public static ModFoldersProvider getIdeaModFoldersProvider(Project project, @Nul .collect(Collectors.toMap(ModModel::getName, mod -> { var modFolder = project.getObjects().newInstance(ModFolder.class); modFolder.getFolders().from(InternalModelHelper.getModConfiguration(mod)); - for (var sourceSet : mod.getModSourceSets().get()) { - // TODO: this is probably broken in multiproject builds + var sourceSets = new ArrayList<>(mod.getModSourceSets().get()); + // Brings IJ in line with how we do it in Gradle + if (includeUnitTests) { + var testSourceSet = ExtensionUtils.getSourceSets(project).findByName("test"); + if (testSourceSet != null && !sourceSets.contains(testSourceSet)) { + sourceSets.add(testSourceSet); + } + } + for (var sourceSet : sourceSets) { var sourceSetDir = outputDirectory.toPath().resolve(getIdeaOutName(sourceSet)); modFolder.getFolders().from(sourceSetDir.resolve("classes")); modFolder.getFolders().from(sourceSetDir.resolve("resources"));