Skip to content
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

New user guide to jar_jar and bazel-deps #14

Open
sid374 opened this issue Jul 9, 2019 · 2 comments
Open

New user guide to jar_jar and bazel-deps #14

sid374 opened this issue Jul 9, 2019 · 2 comments

Comments

@sid374
Copy link

sid374 commented Jul 9, 2019

Preface: I'm new to bazel, bazel-deps and jar_jar. I've tried reading the available documentation but haven't found satisfactory answers suitable for a new user.

Problem:
We use bazel-deps to download and use a bunch of 3rd party dependencies. Two of these libraries (azure-storage and cassandra-driver) have conflicting dependencies on the version of guava that they require (20 and 19 respectively). I'm trying to use bazel_jar_jar to shade the azure-storage library so that I can have 2 different versions of guava coexist.

Questions:

  1. Is there a way to make bazel_jar_jar play nice with bazel-deps? Bazel deps seems to generate it's own BUILD.bazel files for every dependency specified. There's a warning saying that we shouldn't edit these files manually, which I would have to do to use jar_jar. I see a bunch of options in the documentation but it's not clear if any of them can help setting up bazel_jar_jar rules
  2. Could someone please give point me to a beginner friendly guide/documentation which I can follow to get some more insight
@johnynek
Copy link
Collaborator

bazel-deps wants to normalize all version jars down to 1 single jar. There isn't a mechanism to nave separate ones.

What I would do if I were trying to solve this would be to have two configuration files:

  1. your main/default versions.
  2. the minimal set you need for the exceptional cases.

then generate two separate third party directories, and then you could use jar_jar to shade one of them.

We use shading in a few cases at Stripe, but we usually manage this by manually adding those jars via http_jar or similar and constructing by hand the target we need. It's not fun, but the goal of the monorepo is a single version of all jars, so we work more to get there than to solve workarounds for mixing versions.

I hope this is helpful.

Good luck.

@sid374
Copy link
Author

sid374 commented Jul 15, 2019

Thanks for the insight! My current approach was to do it by hand, but will give what you suggested a shot as well.

There doesn't really seem to be a clean way around this, since the issue is inherently messy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants