-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
In-memory shading #39
Conversation
ZipOutputStream by default will use Code Page 437. This switch to using JarOutputStream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few suggestions.
Thanks for doing this. Excited to reduce duplication or jarjar implementations and for the improved testing.
I wonder if you have any ideas for how we could set up CI to test with more than one time zone to verify that resulting shaded jars are time zone independent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more questions that maybe we can address later if you want.
entry.setCompressedSize(-1) | ||
out.putNextEntry(entry) | ||
out.write(struct.data) | ||
} else if (struct.name.endsWith("/")) () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not be first? Not sure why it is here actually. The else of this if is also returning ()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do want entries that ends with /
to transform like shapeless/
becomes foo/shapeless
. The original else if
in Java code exempts directories from duplicate entry exception. If we ignore the duplicate entry exception, like I am doing here, then this clause is meaningless.
sha256 might be a blunt hammer to check this, but it shows that I still have some stability issue:
I don't think it's quite enforcing the minimal timestamp yet. |
@@ -30,7 +30,7 @@ object Zip { | |||
// --------- ---------- ----- ---- | |||
// 0 00-00-1980 04:08 META-INF/ | |||
// 988 00-00-1980 04:08 META-INF/MANIFEST.MF | |||
private final val minimumTimestamp = 315705600L | |||
private final val minimumTimestamp = 315705600000L |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was off by 1000x (milisec).
@@ -65,6 +66,8 @@ object ShaderTest extends BasicTestSuite { | |||
) | |||
val entries = Zip.list(tempJar).map(_._1) | |||
assert(entries.contains(expectedClass)) | |||
val lines = Process(s"unzip -l $tempJar").!!.linesIterator.toList.take(10) | |||
lines.foreach(println) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When green let's merge!
Fixes #38
Problem
File name entry encoding issue.
Solution
JarOutputStream
or Jar* series of streams instead of Zip*. This is because PKWare spec says that the file names should be encoded using IBM Code Page 437, but JARs use UTF-8. JDK 7 adds a parameter to workaround this but generally JAR isn't ZIP in these details.