Add support for remote --first-jar/--second-jar
Example: java -jar target/SpecialSource-1.3-SNAPSHOT-shaded.jar --first-jar http://assets.minecraft.net/1_4_7/minecraft_server.jar --second-jar http://repo.bukkit.org/content/groups/public/org/bukkit/minecraft-server/1.4.7/minecraft-server-1.4.7.jar
This commit is contained in:
parent
308d1b4413
commit
91803d03ea
@ -51,11 +51,11 @@ public class SpecialSource {
|
||||
|
||||
acceptsAll(asList("a", "first-jar"), "First jar with original names, for generating mapping")
|
||||
.withRequiredArg()
|
||||
.ofType(File.class);
|
||||
.ofType(String.class);
|
||||
|
||||
acceptsAll(asList("b", "second-jar"), "Second jar with renamed names, for generating mapping")
|
||||
.withRequiredArg()
|
||||
.ofType(File.class);
|
||||
.ofType(String.class);
|
||||
|
||||
acceptsAll(asList("s", "srg-out"), "Mapping file output")
|
||||
.withRequiredArg()
|
||||
@ -127,8 +127,8 @@ public class SpecialSource {
|
||||
if (options.has("first-jar") && options.has("second-jar")) {
|
||||
// Generate mappings from two otherwise-identical jars
|
||||
log("Reading jars");
|
||||
Jar jar1 = Jar.init((File) options.valueOf("first-jar"));
|
||||
Jar jar2 = Jar.init((File) options.valueOf("second-jar"));
|
||||
Jar jar1 = Jar.init(URLDownloader.getLocalFile((String) options.valueOf("first-jar")));
|
||||
Jar jar2 = Jar.init(URLDownloader.getLocalFile((String) options.valueOf("second-jar")));
|
||||
|
||||
log("Creating jar compare");
|
||||
JarComparer visitor1 = new JarComparer(jar1);
|
||||
|
@ -48,14 +48,14 @@ public class URLDownloader {
|
||||
System.out.println("Downloading "+url);
|
||||
}
|
||||
|
||||
url.openConnection();
|
||||
url.openConnection(); // TODO: cache local downloads, and reuse temp files unless forced
|
||||
InputStream inputStream = url.openStream();
|
||||
|
||||
String path = url.getPath();
|
||||
String baseName = URLDownloader.getNameWithoutExtension(path);
|
||||
String extension = Files.getFileExtension(path);
|
||||
|
||||
File tempFile = File.createTempFile(baseName, "." + extension);
|
||||
File tempFile = File.createTempFile(baseName, "." + extension); // TODO: use non-random filenames
|
||||
FileOutputStream outputStream = new FileOutputStream(tempFile);
|
||||
|
||||
byte[] buffer = new byte[4096];
|
||||
|
Loading…
Reference in New Issue
Block a user