Skip to content

Conversation

johnynek
Copy link
Contributor

@johnynek johnynek commented May 19, 2016

This is to address #53

This adds a jar creator that is a minor edit of:
https://github.com/bazelbuild/bazel/blob/master/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/jarhelper/JarCreator.java

to remove the unneeded guava dependency (so it would build easier), which sets the timestamps to fixed values, which makes the jars pure functions of the contents.

@johnynek
Copy link
Contributor Author

this seems to pass on linux, but it fails on my OSX machine.

@damienmg
Copy link
Contributor

test this please

@bazel-io
Copy link

Can one of the admins verify this patch?

@johnynek
Copy link
Contributor Author

Here is the issue:

http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/sun/tools/jar/Main.java#445

jar seems to hardwire writing the current time. Not sure how linux escapes this.

@johnynek
Copy link
Contributor Author

@johnynek
Copy link
Contributor Author

This passes on OSX.

@ianoc @non this is what I came up with.

This is minor edit of:
https://github.com/bazelbuild/bazel/blob/master/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/jarhelper/JarCreator.java

to remove the unneeded guava dependency (so it would build easier).

@johnynek
Copy link
Contributor Author

this closes #53

@johnynek
Copy link
Contributor Author

@smparkes @dinowernli review?

This does not change the build time for an internal repo relative to sha: 7b891ad

@smparkes
Copy link
Contributor

Nice. LGTM

@johnynek johnynek merged commit b5c40b3 into master May 26, 2016
@johnynek johnynek deleted the oscar/add-identical-check branch May 26, 2016 16:29
@@ -0,0 +1,5 @@
java_binary(name = "jar",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, @bazel_tools//tools/zip:zipper is a zip implementation that strip out timestamp. Might be easier to refer to it that to fork SingleJar's Jar implementation. (Also faster)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is good to know about instead of using system zip, but what about making manifests? Seems nice to reuse that bit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, then maybe you can use directly the SingleJar binary. Just ask if you need to get rid of the file fork and I can probably help you sort that out.

@dinowernli
Copy link
Contributor

Sorry, out of town ;)

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants