Add --stable option to strip file dates

This commit is contained in:
md_5 2018-10-02 20:46:38 +10:00
parent e78721546a
commit 5dbf0ee84a
2 changed files with 6 additions and 0 deletions

View File

@ -212,6 +212,9 @@ public class JarRemapper extends CustomRemapper {
buffer.flush();
data = buffer.toByteArray();
}
if (SpecialSource.stable) {
entry.setTime(0);
}
out.putNextEntry(entry);
out.write(data);

View File

@ -53,6 +53,7 @@ public class SpecialSource {
public static boolean kill_lvt = false;
public static boolean kill_generics = false;
public static String identifier = null;
public static boolean stable = false;
public static void main(String[] args) throws Exception {
OptionParser parser = new OptionParser() {
@ -120,6 +121,7 @@ public class SpecialSource {
.withRequiredArg()
.ofType(Integer.class)
.defaultsTo(10);
acceptsAll(asList("stable"), "Attempts to make output stable for a given input");
acceptsAll(asList("v", "version"), "Displays version information");
@ -187,6 +189,7 @@ public class SpecialSource {
}
FileLocator.useCache = !options.has("force-redownload");
SpecialSource.stable = options.has("stable");
Jar jar1 = null, jar2 = null, jar3 = null;