mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-30 21:05:58 -05:00
Add a FileCollection to ModSettings
This commit is contained in:
@@ -27,6 +27,7 @@ package net.fabricmc.loom.api;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.gradle.api.Named;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
import org.gradle.api.provider.ListProperty;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -41,6 +42,11 @@ public abstract class ModSettings implements Named {
|
||||
*/
|
||||
public abstract ListProperty<SourceSet> getModSourceSets();
|
||||
|
||||
/**
|
||||
* List of classpath directories, or jar files used to populate the `fabric.classPathGroups` Fabric Loader system property.
|
||||
*/
|
||||
public abstract FileCollection getModFiles();
|
||||
|
||||
@Inject
|
||||
public ModSettings() {
|
||||
getModSourceSets().finalizeValueOnRead();
|
||||
|
||||
@@ -56,9 +56,14 @@ public final class SourceSetHelper {
|
||||
}
|
||||
|
||||
public static List<File> getClasspath(ModSettings modSettings, Project project) {
|
||||
return modSettings.getModSourceSets().get().stream()
|
||||
final List<File> files = new ArrayList<>();
|
||||
|
||||
files.addAll(modSettings.getModSourceSets().get().stream()
|
||||
.flatMap(sourceSet -> getClasspath(sourceSet, project).stream())
|
||||
.toList();
|
||||
.toList());
|
||||
files.addAll(modSettings.getModFiles().getFiles());
|
||||
|
||||
return Collections.unmodifiableList(files);
|
||||
}
|
||||
|
||||
public static List<File> getClasspath(SourceSet sourceSet, Project project) {
|
||||
|
||||
Reference in New Issue
Block a user