unscuff everything
This commit is contained in:
@@ -40,17 +40,13 @@ class BaritoneGradleTask extends DefaultTask {
|
|||||||
PROGUARD_STANDALONE_CONFIG = "standalone.pro",
|
PROGUARD_STANDALONE_CONFIG = "standalone.pro",
|
||||||
PROGUARD_EXPORT_PATH = "proguard_out.jar",
|
PROGUARD_EXPORT_PATH = "proguard_out.jar",
|
||||||
|
|
||||||
TEMP_LIBRARY_DIR = "tempLibraries/",
|
|
||||||
|
|
||||||
ARTIFACT_STANDARD = "%s-%s.jar",
|
ARTIFACT_STANDARD = "%s-%s.jar",
|
||||||
ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar",
|
ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar",
|
||||||
ARTIFACT_API = "%s-api-%s.jar",
|
ARTIFACT_API = "%s-api-%s.jar",
|
||||||
ARTIFACT_STANDALONE = "%s-standalone-%s.jar",
|
ARTIFACT_STANDALONE = "%s-standalone-%s.jar";
|
||||||
ARTIFACT_FORGE_API = "%s-api-forge-%s.jar",
|
|
||||||
ARTIFACT_FORGE_STANDALONE = "%s-standalone-forge-%s.jar";
|
|
||||||
|
|
||||||
protected String artifactName, artifactVersion;
|
protected String artifactName, artifactVersion;
|
||||||
protected Path artifactPath, artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, artifactForgeApiPath, artifactForgeStandalonePath, proguardOut;
|
protected Path artifactPath, artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, proguardOut;
|
||||||
|
|
||||||
protected void verifyArtifacts() throws IllegalStateException {
|
protected void verifyArtifacts() throws IllegalStateException {
|
||||||
this.artifactName = getProject().getName();
|
this.artifactName = getProject().getName();
|
||||||
@@ -60,8 +56,6 @@ class BaritoneGradleTask extends DefaultTask {
|
|||||||
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED));
|
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED));
|
||||||
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API));
|
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API));
|
||||||
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE));
|
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE));
|
||||||
this.artifactForgeApiPath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_API));
|
|
||||||
this.artifactForgeStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_STANDALONE));
|
|
||||||
|
|
||||||
this.proguardOut = this.getTemporaryFile(PROGUARD_EXPORT_PATH);
|
this.proguardOut = this.getTemporaryFile(PROGUARD_EXPORT_PATH);
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ public class CreateDistTask extends BaritoneGradleTask {
|
|||||||
Path api = getRelativeFile("dist/" + formatVersion(ARTIFACT_API));
|
Path api = getRelativeFile("dist/" + formatVersion(ARTIFACT_API));
|
||||||
Path standalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE));
|
Path standalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE));
|
||||||
Path unoptimized = getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED));
|
Path unoptimized = getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED));
|
||||||
Path forgeApi = getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_API));
|
|
||||||
Path forgeStandalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_STANDALONE));
|
|
||||||
|
|
||||||
// NIO will not automatically create directories
|
// NIO will not automatically create directories
|
||||||
Path dir = getRelativeFile("dist/");
|
Path dir = getRelativeFile("dist/");
|
||||||
@@ -58,11 +56,9 @@ public class CreateDistTask extends BaritoneGradleTask {
|
|||||||
Files.copy(this.artifactApiPath, api, REPLACE_EXISTING);
|
Files.copy(this.artifactApiPath, api, REPLACE_EXISTING);
|
||||||
Files.copy(this.artifactStandalonePath, standalone, REPLACE_EXISTING);
|
Files.copy(this.artifactStandalonePath, standalone, REPLACE_EXISTING);
|
||||||
Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING);
|
Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING);
|
||||||
Files.copy(this.artifactForgeApiPath, forgeApi, REPLACE_EXISTING);
|
|
||||||
Files.copy(this.artifactForgeStandalonePath, forgeStandalone, REPLACE_EXISTING);
|
|
||||||
|
|
||||||
// Calculate all checksums and format them like "shasum"
|
// Calculate all checksums and format them like "shasum"
|
||||||
List<String> shasum = Stream.of(api, forgeApi, standalone, forgeStandalone, unoptimized)
|
List<String> shasum = Stream.of(api, standalone, unoptimized)
|
||||||
.map(path -> sha1(path) + " " + path.getFileName().toString())
|
.map(path -> sha1(path) + " " + path.getFileName().toString())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|||||||
@@ -18,26 +18,18 @@
|
|||||||
package baritone.gradle.task;
|
package baritone.gradle.task;
|
||||||
|
|
||||||
import baritone.gradle.util.Determinizer;
|
import baritone.gradle.util.Determinizer;
|
||||||
import baritone.gradle.util.MappingType;
|
|
||||||
import baritone.gradle.util.ReobfWrapper;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.gradle.api.NamedDomainObjectContainer;
|
import org.gradle.api.plugins.JavaPluginConvention;
|
||||||
import org.gradle.api.artifacts.Configuration;
|
|
||||||
import org.gradle.api.artifacts.Dependency;
|
|
||||||
import org.gradle.api.internal.plugins.DefaultConvention;
|
|
||||||
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.lang.reflect.Field;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.regex.Matcher;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.stream.Stream;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
@@ -49,18 +41,12 @@ import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
|||||||
*/
|
*/
|
||||||
public class ProguardTask extends BaritoneGradleTask {
|
public class ProguardTask extends BaritoneGradleTask {
|
||||||
|
|
||||||
private static final Pattern TEMP_LIBRARY_PATTERN = Pattern.compile("-libraryjars 'tempLibraries\\/([a-zA-Z0-9/_\\-\\.]+)\\.jar'");
|
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
private String extract;
|
private String extract;
|
||||||
|
|
||||||
private List<String> requiredLibraries;
|
|
||||||
|
|
||||||
private File mixin;
|
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
protected void exec() throws Exception {
|
protected void exec() throws Exception {
|
||||||
super.verifyArtifacts();
|
super.verifyArtifacts();
|
||||||
@@ -70,7 +56,6 @@ public class ProguardTask extends BaritoneGradleTask {
|
|||||||
downloadProguard();
|
downloadProguard();
|
||||||
extractProguard();
|
extractProguard();
|
||||||
generateConfigs();
|
generateConfigs();
|
||||||
acquireDependencies();
|
|
||||||
proguardApi();
|
proguardApi();
|
||||||
proguardStandalone();
|
proguardStandalone();
|
||||||
cleanup();
|
cleanup();
|
||||||
@@ -81,7 +66,7 @@ public class ProguardTask extends BaritoneGradleTask {
|
|||||||
Files.delete(this.artifactUnoptimizedPath);
|
Files.delete(this.artifactUnoptimizedPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Determinizer.determinize(this.artifactPath.toString(), this.artifactUnoptimizedPath.toString(), Optional.empty());
|
Determinizer.determinize(this.artifactPath.toString(), this.artifactUnoptimizedPath.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void downloadProguard() throws Exception {
|
private void downloadProguard() throws Exception {
|
||||||
@@ -114,6 +99,19 @@ public class ProguardTask extends BaritoneGradleTask {
|
|||||||
String out = IOUtils.toString(p.getInputStream(), "UTF-8").split("\n")[0].split("Opened ")[1].replace("]", "");
|
String out = IOUtils.toString(p.getInputStream(), "UTF-8").split("\n")[0].split("Opened ")[1].replace("]", "");
|
||||||
template.add(2, "-libraryjars '" + out + "'");
|
template.add(2, "-libraryjars '" + out + "'");
|
||||||
|
|
||||||
|
// Discover all of the libraries that we will need to acquire from gradle
|
||||||
|
acquireDependencies().forEach(f -> {
|
||||||
|
if (f.toString().endsWith("-recomp.jar")) {
|
||||||
|
// remove MCP mapped jar
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (f.toString().endsWith("client-extra.jar")) {
|
||||||
|
// go from the extra to the original downloaded client
|
||||||
|
f = new File(f.getParentFile(), "client.jar");
|
||||||
|
}
|
||||||
|
template.add(2, "-libraryjars '" + f + "'");
|
||||||
|
});
|
||||||
|
|
||||||
// API config doesn't require any changes from the changes that we made to the template
|
// API config doesn't require any changes from the changes that we made to the template
|
||||||
Files.write(getTemporaryFile(PROGUARD_API_CONFIG), template);
|
Files.write(getTemporaryFile(PROGUARD_API_CONFIG), template);
|
||||||
|
|
||||||
@@ -121,165 +119,20 @@ public class ProguardTask extends BaritoneGradleTask {
|
|||||||
List<String> standalone = new ArrayList<>(template);
|
List<String> standalone = new ArrayList<>(template);
|
||||||
standalone.removeIf(s -> s.contains("# this is the keep api"));
|
standalone.removeIf(s -> s.contains("# this is the keep api"));
|
||||||
Files.write(getTemporaryFile(PROGUARD_STANDALONE_CONFIG), standalone);
|
Files.write(getTemporaryFile(PROGUARD_STANDALONE_CONFIG), standalone);
|
||||||
|
|
||||||
// Discover all of the libraries that we will need to acquire from gradle
|
|
||||||
this.requiredLibraries = new ArrayList<>();
|
|
||||||
template.forEach(line -> {
|
|
||||||
if (!line.startsWith("#")) {
|
|
||||||
Matcher m = TEMP_LIBRARY_PATTERN.matcher(line);
|
|
||||||
if (m.find()) {
|
|
||||||
this.requiredLibraries.add(m.group(1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void acquireDependencies() throws Exception {
|
private Stream<File> acquireDependencies() {
|
||||||
|
return getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("launch").getRuntimeClasspath().getFiles().stream().filter(File::isFile);
|
||||||
// Create a map of all of the dependencies that we are able to access in this project
|
|
||||||
// Likely a better way to do this, I just pair the dependency with the first valid configuration
|
|
||||||
Map<String, Pair<Configuration, Dependency>> dependencyLookupMap = new HashMap<>();
|
|
||||||
getProject().getConfigurations().stream().filter(Configuration::isCanBeResolved).forEach(config ->
|
|
||||||
config.getAllDependencies().forEach(dependency ->
|
|
||||||
dependencyLookupMap.putIfAbsent(dependency.getName() + "-" + dependency.getVersion(), Pair.of(config, dependency))));
|
|
||||||
|
|
||||||
// Create the directory if it doesn't already exist
|
|
||||||
Path tempLibraries = getTemporaryFile(TEMP_LIBRARY_DIR);
|
|
||||||
if (!Files.exists(tempLibraries)) {
|
|
||||||
Files.createDirectory(tempLibraries);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterate the required libraries to copy them to tempLibraries
|
|
||||||
for (String lib : this.requiredLibraries) {
|
|
||||||
// copy from the forgegradle cache
|
|
||||||
if (lib.equals("minecraft")) {
|
|
||||||
Path cachedJar = getMinecraftJar();
|
|
||||||
Path inTempDir = getTemporaryFile("tempLibraries/minecraft.jar");
|
|
||||||
// TODO: maybe try not to copy every time
|
|
||||||
Files.copy(cachedJar, inTempDir, REPLACE_EXISTING);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find a configuration/dependency pair that matches the desired library
|
|
||||||
Pair<Configuration, Dependency> pair = null;
|
|
||||||
for (Map.Entry<String, Pair<Configuration, Dependency>> entry : dependencyLookupMap.entrySet()) {
|
|
||||||
if (entry.getKey().startsWith(lib)) {
|
|
||||||
pair = entry.getValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The pair must be non-null
|
|
||||||
Objects.requireNonNull(pair);
|
|
||||||
|
|
||||||
// Find the library jar file, and copy it to tempLibraries
|
|
||||||
for (File file : pair.getLeft().files(pair.getRight())) {
|
|
||||||
if (file.getName().startsWith(lib)) {
|
|
||||||
if (lib.contains("mixin")) {
|
|
||||||
mixin = file;
|
|
||||||
}
|
|
||||||
Files.copy(file.toPath(), getTemporaryFile("tempLibraries/" + lib + ".jar"), REPLACE_EXISTING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mixin == null) {
|
|
||||||
throw new IllegalStateException("Unable to find mixin jar");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// a bunch of epic stuff to get the path to the cached jar
|
|
||||||
private Path getMinecraftJar() throws Exception {
|
|
||||||
MappingType mappingType;
|
|
||||||
try {
|
|
||||||
mappingType = getMappingType();
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.err.println("Failed to get mapping type, assuming NOTCH.");
|
|
||||||
mappingType = MappingType.NOTCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
String suffix;
|
|
||||||
switch (mappingType) {
|
|
||||||
case NOTCH:
|
|
||||||
suffix = "";
|
|
||||||
break;
|
|
||||||
case SEARGE:
|
|
||||||
suffix = "-srgBin";
|
|
||||||
break;
|
|
||||||
case CUSTOM:
|
|
||||||
throw new IllegalStateException("Custom mappings not supported!");
|
|
||||||
default:
|
|
||||||
throw new IllegalStateException("Unknown mapping type: " + mappingType);
|
|
||||||
}
|
|
||||||
|
|
||||||
DefaultConvention convention = (DefaultConvention) this.getProject().getConvention();
|
|
||||||
Object extension = convention.getAsMap().get("minecraft");
|
|
||||||
Objects.requireNonNull(extension);
|
|
||||||
|
|
||||||
// for some reason cant use Class.forName
|
|
||||||
Class<?> class_baseExtension = extension.getClass().getSuperclass().getSuperclass().getSuperclass(); // <-- cursed
|
|
||||||
Field f_replacer = class_baseExtension.getDeclaredField("replacer");
|
|
||||||
f_replacer.setAccessible(true);
|
|
||||||
Object replacer = f_replacer.get(extension);
|
|
||||||
Class<?> class_replacementProvider = replacer.getClass();
|
|
||||||
Field replacement_replaceMap = class_replacementProvider.getDeclaredField("replaceMap");
|
|
||||||
replacement_replaceMap.setAccessible(true);
|
|
||||||
|
|
||||||
Map<String, Object> replacements = (Map) replacement_replaceMap.get(replacer);
|
|
||||||
String cacheDir = replacements.get("CACHE_DIR").toString() + "/net/minecraft";
|
|
||||||
String mcVersion = replacements.get("MC_VERSION").toString();
|
|
||||||
String mcpInsert = replacements.get("MAPPING_CHANNEL").toString() + "/" + replacements.get("MAPPING_VERSION").toString();
|
|
||||||
String fullJarName = "minecraft-" + mcVersion + suffix + ".jar";
|
|
||||||
|
|
||||||
String baseDir = String.format("%s/minecraft/%s/", cacheDir, mcVersion);
|
|
||||||
|
|
||||||
String jarPath;
|
|
||||||
if (mappingType == MappingType.SEARGE) {
|
|
||||||
jarPath = String.format("%s/%s/%s", baseDir, mcpInsert, fullJarName);
|
|
||||||
} else {
|
|
||||||
jarPath = baseDir + fullJarName;
|
|
||||||
}
|
|
||||||
jarPath = jarPath
|
|
||||||
.replace("/", File.separator)
|
|
||||||
.replace("\\", File.separator); // hecking regex
|
|
||||||
|
|
||||||
return new File(jarPath).toPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
// throws IllegalStateException if mapping type is ambiguous or it fails to find it
|
|
||||||
private MappingType getMappingType() {
|
|
||||||
// if it fails to find this then its probably a forgegradle version problem
|
|
||||||
Set<Object> reobf = (NamedDomainObjectContainer<Object>) this.getProject().getExtensions().getByName("reobf");
|
|
||||||
|
|
||||||
List<MappingType> mappingTypes = getUsedMappingTypes(reobf);
|
|
||||||
long mappingTypesUsed = mappingTypes.size();
|
|
||||||
if (mappingTypesUsed == 0) {
|
|
||||||
throw new IllegalStateException("Failed to find mapping type (no jar task?)");
|
|
||||||
}
|
|
||||||
if (mappingTypesUsed > 1) {
|
|
||||||
throw new IllegalStateException("Ambiguous mapping type (multiple jars with different mapping types?)");
|
|
||||||
}
|
|
||||||
|
|
||||||
return mappingTypes.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<MappingType> getUsedMappingTypes(Set<Object> reobf) {
|
|
||||||
return reobf.stream()
|
|
||||||
.map(ReobfWrapper::new)
|
|
||||||
.map(ReobfWrapper::getMappingType)
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void proguardApi() throws Exception {
|
private void proguardApi() throws Exception {
|
||||||
runProguard(getTemporaryFile(PROGUARD_API_CONFIG));
|
runProguard(getTemporaryFile(PROGUARD_API_CONFIG));
|
||||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString(), Optional.empty());
|
Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString());
|
||||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactForgeApiPath.toString(), Optional.of(mixin));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void proguardStandalone() throws Exception {
|
private void proguardStandalone() throws Exception {
|
||||||
runProguard(getTemporaryFile(PROGUARD_STANDALONE_CONFIG));
|
runProguard(getTemporaryFile(PROGUARD_STANDALONE_CONFIG));
|
||||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString(), Optional.empty());
|
Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString());
|
||||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactForgeStandalonePath.toString(), Optional.of(mixin));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanup() {
|
private void cleanup() {
|
||||||
|
|||||||
@@ -22,7 +22,10 @@ import com.google.gson.stream.JsonReader;
|
|||||||
import com.google.gson.stream.JsonWriter;
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.jar.JarOutputStream;
|
import java.util.jar.JarOutputStream;
|
||||||
@@ -36,7 +39,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
public class Determinizer {
|
public class Determinizer {
|
||||||
|
|
||||||
public static void determinize(String inputPath, String outputPath, Optional<File> toInclude) throws IOException {
|
public static void determinize(String inputPath, String outputPath) throws IOException {
|
||||||
System.out.println("Running Determinizer");
|
System.out.println("Running Determinizer");
|
||||||
System.out.println(" Input path: " + inputPath);
|
System.out.println(" Input path: " + inputPath);
|
||||||
System.out.println(" Output path: " + outputPath);
|
System.out.println(" Output path: " + outputPath);
|
||||||
@@ -63,30 +66,10 @@ public class Determinizer {
|
|||||||
if (entry.getName().endsWith(".refmap.json")) {
|
if (entry.getName().endsWith(".refmap.json")) {
|
||||||
JsonObject object = new JsonParser().parse(new InputStreamReader(jarFile.getInputStream(entry))).getAsJsonObject();
|
JsonObject object = new JsonParser().parse(new InputStreamReader(jarFile.getInputStream(entry))).getAsJsonObject();
|
||||||
jos.write(writeSorted(object).getBytes());
|
jos.write(writeSorted(object).getBytes());
|
||||||
} else if (entry.getName().equals("META-INF/MANIFEST.MF") && toInclude.isPresent()) { // only replace for forge jar
|
|
||||||
ByteArrayOutputStream cancer = new ByteArrayOutputStream();
|
|
||||||
copy(jarFile.getInputStream(entry), cancer);
|
|
||||||
String manifest = new String(cancer.toByteArray());
|
|
||||||
if (!manifest.contains("baritone.launch.BaritoneTweaker")) {
|
|
||||||
throw new IllegalStateException("unable to replace");
|
|
||||||
}
|
|
||||||
manifest = manifest.replace("baritone.launch.BaritoneTweaker", "org.spongepowered.asm.launch.MixinTweaker");
|
|
||||||
jos.write(manifest.getBytes());
|
|
||||||
} else {
|
} else {
|
||||||
copy(jarFile.getInputStream(entry), jos);
|
copy(jarFile.getInputStream(entry), jos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toInclude.isPresent()) {
|
|
||||||
try (JarFile mixin = new JarFile(toInclude.get())) {
|
|
||||||
for (JarEntry entry : mixin.stream().sorted(Comparator.comparing(JarEntry::getName)).collect(Collectors.toList())) {
|
|
||||||
if (entry.getName().startsWith("META-INF") && !entry.getName().startsWith("META-INF/services")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
jos.putNextEntry(entry);
|
|
||||||
copy(mixin.getInputStream(entry), jos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jos.finish();
|
jos.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-50
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
# lwjgl is weird
|
# lwjgl is weird
|
||||||
-dontwarn org.lwjgl.**
|
-dontwarn org.lwjgl.**
|
||||||
|
# also lwjgl lol
|
||||||
|
-dontwarn module-info
|
||||||
|
|
||||||
-keep class baritone.api.** { *; } # this is the keep api
|
-keep class baritone.api.** { *; } # this is the keep api
|
||||||
|
|
||||||
@@ -29,56 +31,6 @@
|
|||||||
# need to keep mixin names
|
# need to keep mixin names
|
||||||
-keep class baritone.launch.** { *; }
|
-keep class baritone.launch.** { *; }
|
||||||
|
|
||||||
# copy all necessary libraries into tempLibraries to build
|
|
||||||
|
|
||||||
# The correct jar will be copied from the forgegradle cache based on the mapping type being compiled with
|
|
||||||
-libraryjars 'tempLibraries/minecraft.jar'
|
|
||||||
|
|
||||||
-libraryjars 'tempLibraries/SimpleTweaker-1.2.jar'
|
|
||||||
|
|
||||||
-libraryjars 'tempLibraries/authlib-1.5.25.jar'
|
|
||||||
-libraryjars 'tempLibraries/codecjorbis-20101023.jar'
|
|
||||||
-libraryjars 'tempLibraries/codecwav-20101023.jar'
|
|
||||||
-libraryjars 'tempLibraries/commons-codec-1.10.jar'
|
|
||||||
-libraryjars 'tempLibraries/commons-compress-1.8.1.jar'
|
|
||||||
-libraryjars 'tempLibraries/commons-io-2.5.jar'
|
|
||||||
-libraryjars 'tempLibraries/commons-lang3-3.5.jar'
|
|
||||||
-libraryjars 'tempLibraries/commons-logging-1.1.3.jar'
|
|
||||||
-libraryjars 'tempLibraries/fastutil-7.1.0.jar'
|
|
||||||
-libraryjars 'tempLibraries/gson-2.8.0.jar'
|
|
||||||
-libraryjars 'tempLibraries/guava-21.0.jar'
|
|
||||||
-libraryjars 'tempLibraries/httpclient-4.3.3.jar'
|
|
||||||
-libraryjars 'tempLibraries/httpcore-4.3.2.jar'
|
|
||||||
-libraryjars 'tempLibraries/icu4j-core-mojang-51.2.jar'
|
|
||||||
-libraryjars 'tempLibraries/jinput-2.0.5.jar'
|
|
||||||
-libraryjars 'tempLibraries/jna-4.4.0.jar'
|
|
||||||
-libraryjars 'tempLibraries/jopt-simple-5.0.3.jar'
|
|
||||||
-libraryjars 'tempLibraries/jsr305-3.0.1.jar'
|
|
||||||
-libraryjars 'tempLibraries/jutils-1.0.0.jar'
|
|
||||||
-libraryjars 'tempLibraries/libraryjavasound-20101123.jar'
|
|
||||||
-libraryjars 'tempLibraries/librarylwjglopenal-20100824.jar'
|
|
||||||
-libraryjars 'tempLibraries/log4j-api-2.8.1.jar'
|
|
||||||
-libraryjars 'tempLibraries/log4j-core-2.8.1.jar'
|
|
||||||
|
|
||||||
# startsWith is used to check the library, and mac/linux differ in which version they use
|
|
||||||
# this is FINE
|
|
||||||
-libraryjars 'tempLibraries/lwjgl-.jar'
|
|
||||||
-libraryjars 'tempLibraries/lwjgl_util-.jar'
|
|
||||||
|
|
||||||
-libraryjars 'tempLibraries/netty-all-4.1.9.Final.jar'
|
|
||||||
-libraryjars 'tempLibraries/oshi-core-1.1.jar'
|
|
||||||
-libraryjars 'tempLibraries/patchy-1.1.jar'
|
|
||||||
-libraryjars 'tempLibraries/platform-3.4.0.jar'
|
|
||||||
-libraryjars 'tempLibraries/realms-1.10.22.jar'
|
|
||||||
-libraryjars 'tempLibraries/soundsystem-20120107.jar'
|
|
||||||
-libraryjars 'tempLibraries/text2speech-1.10.3.jar'
|
|
||||||
|
|
||||||
-libraryjars 'tempLibraries/mixin-0.7.11-SNAPSHOT.jar'
|
|
||||||
-libraryjars 'tempLibraries/launchwrapper-1.11.jar' # TODO why does only 1.11.jar exist?
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Keep - Applications. Keep all application classes, along with their 'main'
|
# Keep - Applications. Keep all application classes, along with their 'main'
|
||||||
# methods.
|
# methods.
|
||||||
-keepclasseswithmembers public class * {
|
-keepclasseswithmembers public class * {
|
||||||
|
|||||||
Reference in New Issue
Block a user