Supply the configuration to the run Exec directly (#232)

* Supply the configuration to the run Exec directly

This allows the implicit task dependencies from project() dependencies
to flow into the run tasks.

* Make unmappedMods a CFC to track task information

Deprecates the old methods, and they should probably be removed with
0.5.
This commit is contained in:
Octavia Togami
2020-06-29 07:25:05 -07:00
committed by GitHub
parent 2d7421d4ed
commit 886d77ce0c
5 changed files with 37 additions and 37 deletions

View File

@@ -28,12 +28,12 @@ import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.function.BiPredicate;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
@@ -43,6 +43,7 @@ import org.cadixdev.mercury.Mercury;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.file.ConfigurableFileCollection;
import org.gradle.api.plugins.BasePluginConvention;
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
@@ -62,12 +63,12 @@ public class LoomGradleExtension {
public File accessWidener = null;
public Function<String, Object> intermediaryUrl = mcVer -> "https://maven.fabricmc.net/net/fabricmc/intermediary/" + mcVer + "/intermediary-" + mcVer + "-v2.jar";
private List<Path> unmappedModsBuilt = new ArrayList<>();
private final ConfigurableFileCollection unmappedMods;
final List<LoomDecompiler> decompilers = new ArrayList<>();
//Not to be set in the build.gradle
private Project project;
private final Project project;
private LoomDependencyManager dependencyManager;
private JarProcessorManager jarProcessorManager;
private JsonObject installerJson;
@@ -92,14 +93,30 @@ public class LoomGradleExtension {
public LoomGradleExtension(Project project) {
this.project = project;
this.unmappedMods = project.files();
}
/**
* @see ConfigurableFileCollection#from(Object...)
* @deprecated use {@link #getUnmappedModCollection()}{@code .from()} instead
*/
@Deprecated
public void addUnmappedMod(Path file) {
unmappedModsBuilt.add(file);
getUnmappedModCollection().from(file);
}
/**
* @deprecated use {@link #getUnmappedModCollection()} instead
*/
@Deprecated
public List<Path> getUnmappedMods() {
return Collections.unmodifiableList(unmappedModsBuilt);
return unmappedMods.getFiles().stream()
.map(File::toPath)
.collect(Collectors.toList());
}
public ConfigurableFileCollection getUnmappedModCollection() {
return unmappedMods;
}
public void setInstallerJson(JsonObject object) {