Revert "Ugly fix to mercury classpath not having jetbrains annotations"

This reverts commit 33fdd9ff
dev/0.11
modmuss50 2020-10-12 19:24:11 +01:00
parent 33fdd9ffb2
commit e545a92166
3 changed files with 3 additions and 21 deletions

View File

@ -40,15 +40,12 @@ import java.util.stream.Collectors;
import org.apache.commons.io.FileUtils;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Dependency;
import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.DependencyProvider;
import net.fabricmc.loom.util.RemappedConfigurationEntry;
public class LaunchProvider extends DependencyProvider {
public Dependency annotationDependency;
public LaunchProvider(Project project) {
super(project);
}
@ -80,7 +77,7 @@ public class LaunchProvider extends DependencyProvider {
addDependency(Constants.Dependencies.DEV_LAUNCH_INJECTOR + Constants.Dependencies.Versions.DEV_LAUNCH_INJECTOR, "runtimeOnly");
addDependency(Constants.Dependencies.TERMINAL_CONSOLE_APPENDER + Constants.Dependencies.Versions.TERMINAL_CONSOLE_APPENDER, "runtimeOnly");
annotationDependency = addDependency(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS, "compileOnly");
addDependency(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS, "compileOnly");
postPopulationScheduler.accept(this::writeRemapClassPath);
}

View File

@ -67,12 +67,12 @@ public abstract class DependencyProvider {
addDependency(object, "compile");
}
public Dependency addDependency(Object object, String target) {
public void addDependency(Object object, String target) {
if (object instanceof File) {
object = project.files(object);
}
return project.getDependencies().add(target, object);
project.getDependencies().add(target, object);
}
public void register(LoomDependencyManager dependencyManager) {

View File

@ -30,19 +30,16 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import org.cadixdev.lorenz.MappingSet;
import org.cadixdev.mercury.Mercury;
import org.cadixdev.mercury.remapper.MercuryRemapper;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Dependency;
import org.zeroturnaround.zip.ZipUtil;
import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.providers.MappingsProvider;
import net.fabricmc.loom.providers.LaunchProvider;
import net.fabricmc.loom.util.progress.ProgressLogger;
import net.fabricmc.lorenztiny.TinyMappingsReader;
import net.fabricmc.mapping.tree.TinyTree;
@ -179,18 +176,6 @@ public class SourceRemapper {
m.getClassPath().add(extension.getMinecraftMappedProvider().getMappedJar().toPath());
m.getClassPath().add(extension.getMinecraftMappedProvider().getIntermediaryJar().toPath());
Dependency annotationDependency = extension.getDependencyManager().getProvider(LaunchProvider.class).annotationDependency;
Set<File> files = project.getConfigurations().getByName("compileOnly")
.files(annotationDependency);
if (files.size() != 1) {
throw new RuntimeException(String.format("Found %d files for the annotations, expected 1", files.size()));
}
for (File file : files) {
m.getClassPath().add(file.toPath());
}
m.getProcessors().add(MercuryRemapper.create(mappings));
return m;