mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Update MCE - Remove auto population of minVersion in mixins - Drop some log levels.
This commit is contained in:
@@ -27,13 +27,10 @@ package net.fabricmc.loom;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -44,12 +41,10 @@ import org.cadixdev.mercury.Mercury;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.NamedDomainObjectContainer;
|
||||
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 org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
||||
import net.fabricmc.loom.configuration.LoomDependencyManager;
|
||||
@@ -263,81 +258,6 @@ public class LoomGradleExtension {
|
||||
return new File(getProjectPersistentCache(), "launch.cfg");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Dependency findDependency(Project p, Collection<Configuration> configs, BiPredicate<String, String> groupNameFilter) {
|
||||
for (Configuration config : configs) {
|
||||
for (Dependency dependency : config.getDependencies()) {
|
||||
String group = dependency.getGroup();
|
||||
String name = dependency.getName();
|
||||
|
||||
if (groupNameFilter.test(group, name)) {
|
||||
p.getLogger().debug("Loom findDependency found: " + group + ":" + name + ":" + dependency.getVersion());
|
||||
return dependency;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private <T> T recurseProjects(Function<Project, T> projectTFunction) {
|
||||
Project p = this.project;
|
||||
T result;
|
||||
|
||||
while (p.getRootProject() != p) {
|
||||
if ((result = projectTFunction.apply(p)) != null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
p = p.getRootProject();
|
||||
}
|
||||
|
||||
result = projectTFunction.apply(p);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Dependency getMixinDependency() {
|
||||
return recurseProjects(p -> {
|
||||
List<Configuration> configs = new ArrayList<>();
|
||||
// check compile classpath first
|
||||
Configuration possibleCompileClasspath = p.getConfigurations().findByName("compileClasspath");
|
||||
|
||||
if (possibleCompileClasspath != null) {
|
||||
configs.add(possibleCompileClasspath);
|
||||
}
|
||||
|
||||
// failing that, buildscript
|
||||
configs.addAll(p.getBuildscript().getConfigurations());
|
||||
|
||||
return findDependency(p, configs, (group, name) -> {
|
||||
if (name.equalsIgnoreCase("mixin") && group.equalsIgnoreCase("org.spongepowered")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return name.equalsIgnoreCase("sponge-mixin") && group.equalsIgnoreCase("net.fabricmc");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getMixinJsonVersion() {
|
||||
Dependency dependency = getMixinDependency();
|
||||
|
||||
if (dependency != null) {
|
||||
if (dependency.getGroup().equalsIgnoreCase("net.fabricmc")) {
|
||||
if (Objects.requireNonNull(dependency.getVersion()).split("\\.").length >= 4) {
|
||||
return dependency.getVersion().substring(0, dependency.getVersion().lastIndexOf('.')) + "-SNAPSHOT";
|
||||
}
|
||||
}
|
||||
|
||||
return dependency.getVersion();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getLoaderLaunchMethod() {
|
||||
return loaderLaunchMethod != null ? loaderLaunchMethod : "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user