-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to create Bytes shader function #6
Conversation
15d96b4
to
6a422dd
Compare
8ae6e73
to
479b3f6
Compare
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 opened #7, that includes the changes here, to address the comments I added.
(inputStream, mapping) => | ||
if (rules.isEmpty) Some(inputStream -> mapping) | ||
else { | ||
bytcodeShader(rules, verbose)(readAllBytes(inputStream), mapping).map { case (bytes, newMapping) => |
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.
The bytcodeShader(rules, verbose)
can be factored, to avoid re-converting the rules.
if (rules.isEmpty) Some(inputStream -> mapping) | ||
else { | ||
bytcodeShader(rules, verbose)(readAllBytes(inputStream), mapping).map { case (bytes, newMapping) => | ||
new ByteArrayInputStream(bytes) { override def close(): Unit = inputStream.close() } -> newMapping |
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.
Why close inputStream
via this one? I'm not sure that makes sense, as inputStream
is read before that (via readAllBytes(inputStream)
).
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.
Don't we need to maintain the close chain? Otherwise we risk of leaving open InputStream
.
val shadedInputStream = | ||
if (proc.process(entry)) Some(entry.data -> entry.name) | ||
else None | ||
shadedInputStream.filterNot(a => excludes.contains(a._2)) |
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.
That condition can be pushed down, so that proc.process
isn't called.
Alright, so we are good to go with this version @eed3si9n @alexarchambault ? |
I'll defer to Alex's review, and merge. |
https://github.com/eed3si9n/jarjar-abrams/releases/tag/v0.3.0 on its way to Maven Central. |
Thanks @eed3si9n |
Related to the discussion in com-lihaoyi/mill#947 (comment)