Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/fabricmc/loom/api/ModSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void sourceSet(String sourceSetName, String projectPath) {
if (projectPath.equals(getProject().getPath())) {
// Shortcut for source sets in our own project.
SourceSetReference ref = new SourceSetReference(SourceSetHelper.getSourceSetByName(sourceSetName, getProject()), getProject());
List<File> classpath = SourceSetHelper.getClasspath(ref);
List<File> classpath = SourceSetHelper.getClasspath(ref, false);
getModFiles().from(classpath);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static ExternalClasspathGroupDTO createFromProject(Project project) {

for (SourceSet sourceSet : sourceSets) {
SourceSetReference ref = new SourceSetReference(sourceSet, project);
List<File> classpath = SourceSetHelper.getClasspath(ref);
List<File> classpath = SourceSetHelper.getClasspath(ref, true);
classpaths.put(sourceSet.getName(), classpath.stream().map(File::getAbsolutePath).toList());
}

Expand Down
12 changes: 7 additions & 5 deletions src/main/java/net/fabricmc/loom/util/gradle/SourceSetHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,12 @@ private static Project getProjectFromSourceSetOutput(SourceSetOutput sourceSetOu
return it.hasNext() ? it.next().getProject() : null;
}

public static List<File> getClasspath(SourceSetReference reference) {
/**
* @param forExport set to true when this classpath is going to be exported for another project to consume.
*/
public static List<File> getClasspath(SourceSetReference reference, boolean forExport) {
final Project project = reference.project();
final List<File> classpath = getGradleClasspath(reference, project);
final List<File> classpath = getGradleClasspath(reference, forExport);

classpath.addAll(getIdeaClasspath(reference, project));
classpath.addAll(getIdeaModuleCompileOutput(reference));
Expand All @@ -124,7 +127,7 @@ public static List<File> getClasspath(SourceSetReference reference) {
return classpath;
}

private static List<File> getGradleClasspath(SourceSetReference reference, Project project) {
private static List<File> getGradleClasspath(SourceSetReference reference, boolean forExport) {
final SourceSetOutput output = reference.sourceSet().getOutput();
final File resources = output.getResourcesDir();

Expand All @@ -137,8 +140,7 @@ private static List<File> getGradleClasspath(SourceSetReference reference, Proje
}

// Add dev jars from dependency projects if the source set is "main".
if (SourceSet.MAIN_SOURCE_SET_NAME.equals(reference.sourceSet().getName()) && !reference.project().getPath().equals(project.getPath())
&& GradleUtils.isLoomProject(reference.project())) {
if (forExport && SourceSet.MAIN_SOURCE_SET_NAME.equals(reference.sourceSet().getName()) && GradleUtils.isLoomProject(reference.project())) {
final Configuration namedElements = reference.project().getConfigurations().getByName(Constants.Configurations.NAMED_ELEMENTS);

// Note: We're not looking at the artifacts from configuration variants. It's probably not needed
Expand Down