Skip to content

Commit

Permalink
Fix executing IJ tests in simple cases
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Jun 15, 2024
1 parent 469dc9c commit f311f23
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/net/neoforged/moddevgradle/internal/RunUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
Expand Down

0 comments on commit f311f23

Please sign in to comment.