Skip to content

Use zipper rather than jdk/jar in the thrift rules #286

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

Merged
merged 8 commits into from
Sep 30, 2017
Merged

Conversation

johnynek
Copy link
Contributor

Bazel has a built in command for building zips deterministically. Use that rather than the find + timestamp setting trick.

closes #282

@@ -135,8 +148,7 @@ thrift_library = rule(
"absolute_prefixes": attr.string_list(),
# This is a list of JARs which only contain Thrift files
"external_jars": attr.label_list(),
"_jar": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/jdk:jar"), allow_files=True),
"_jdk": attr.label(default=Label("//tools/defaults:jdk"), allow_files=True),
"_zipper": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/zip:zipper"), allow_files=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL this exsited! This kind of thing needs better publicity. I've cargo culted around the restamped archive code in like every archive rule I've written

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right?

@johnynek
Copy link
Contributor Author

I tested this final version on our largest internal repo and it seemed to work (and get rid of an annoying warning we saw when we had targets with no thrifts that only had external jars).

@ittaiz
Copy link
Contributor

ittaiz commented Sep 30, 2017

@johnynek looks good.
A) Can you squash the 6 commits which are related to this so I'll be able to rebase? I think I can't squash due to the shared commits and I'd rather not add all these intermediate commits.
B) Shouldn't we use the zipper also in the scala.bzl? I seem to remember we also do a song and dance there (don't remember an exact location though).

@johnynek
Copy link
Contributor Author

@ittaiz if we squash, then the 2 branches that depend on this will likely have a painful merge process. I would really like to just regular merge these as is to avoid that. Then the other two can be easily squash merged into the repo saving precious time.

@johnynek
Copy link
Contributor Author

oh, wait, you did merge regular, so I think I can squash merge this now into one commit in the github UI.

Trying.

Thanks!

@johnynek johnynek merged commit ecbe5e7 into master Sep 30, 2017
@johnynek
Copy link
Contributor Author

yeah, that worked: ecbe5e7

@ittaiz
Copy link
Contributor

ittaiz commented Sep 30, 2017

Glad to hear. Are you saying you chose squash in the github UI and it was smart enough to only squash the last six commits? Didn't know that.
Also, WDYT about B from above?

@johnynek
Copy link
Contributor Author

@ittaiz I agree: #288

@ittaiz
Copy link
Contributor

ittaiz commented Sep 30, 2017 via email

@johnynek
Copy link
Contributor Author

@ittaiz I don't think we can because each action needs to make one output. We use JarCreator to produce single outputs from actions, but maybe I'm wrong. Maybe the action can write to a directory, and a subsequent action can read that directory.

That said, I don't see the big win there. That java code was also from bazel, it works and can be compiled with JIT so it is fast. I think spinning up a jvm to make an empty jar is definitely a bummer.

@ittaiz
Copy link
Contributor

ittaiz commented Sep 30, 2017

You're right on both counts. I agree.

@ittaiz ittaiz deleted the oscar/use-zipper branch April 15, 2018 07:52
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.

use bazel_tools zip instead of a call to jar in thrift rules
4 participants