Use Gradle Internal Pair

This commit is contained in:
Brady 2018-10-12 18:08:15 -05:00
parent 8fba36c05e
commit 93286a646f
No known key found for this signature in database
GPG Key ID: 73A788379A197567

View File

@ -19,13 +19,13 @@ package baritone.gradle;
import baritone.gradle.util.Determinizer; import baritone.gradle.util.Determinizer;
import com.google.gson.*; import com.google.gson.*;
import javafx.util.Pair;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency; import org.gradle.api.artifacts.Dependency;
import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.TaskAction;
import org.gradle.internal.Pair;
import java.io.*; import java.io.*;
import java.net.URL; import java.net.URL;
@ -195,7 +195,7 @@ public class ProguardTask extends DefaultTask {
Map<String, Pair<Configuration, Dependency>> dependencyLookupMap = new HashMap<>(); Map<String, Pair<Configuration, Dependency>> dependencyLookupMap = new HashMap<>();
getProject().getConfigurations().stream().filter(Configuration::isCanBeResolved).forEach(config -> getProject().getConfigurations().stream().filter(Configuration::isCanBeResolved).forEach(config ->
config.getAllDependencies().forEach(dependency -> config.getAllDependencies().forEach(dependency ->
dependencyLookupMap.putIfAbsent(dependency.getName() + "-" + dependency.getVersion(), new Pair<>(config, dependency)))); dependencyLookupMap.putIfAbsent(dependency.getName() + "-" + dependency.getVersion(), Pair.of(config, dependency))));
// Create the directory if it doesn't already exist // Create the directory if it doesn't already exist
Path tempLibraries = getTemporaryFile(TEMP_LIBRARY_DIR); Path tempLibraries = getTemporaryFile(TEMP_LIBRARY_DIR);
@ -227,7 +227,7 @@ public class ProguardTask extends DefaultTask {
Objects.requireNonNull(pair); Objects.requireNonNull(pair);
// Find the library jar file, and copy it to tempLibraries // Find the library jar file, and copy it to tempLibraries
for (File file : pair.getKey().files(pair.getValue())) { for (File file : pair.getLeft().files(pair.getRight())) {
if (file.getName().startsWith(lib)) { if (file.getName().startsWith(lib)) {
Files.copy(file.toPath(), getTemporaryFile("tempLibraries/" + lib + ".jar"), REPLACE_EXISTING); Files.copy(file.toPath(), getTemporaryFile("tempLibraries/" + lib + ".jar"), REPLACE_EXISTING);
} }