-
Notifications
You must be signed in to change notification settings - Fork 29
scala_proto_library contains code for all dependencies #218
Comments
Any thoughts here? This seems like it could be pretty bad in larger projects? Since the |
@andyscott would you have bandwidth to take a look? @bjchambers's points sound valid to me, but I have very limited experience with protobuf |
The solution for this is to use an aspect that adds granular protoc compilation steps for each small grouping of proto files. It's not terribly hard to implement, so I can take a look this next week. tweag/rules_haskell has done this for quite some time, and bazelbuild/rules_scala followed suit not too long ago. |
When It seems like an easier fix would be to pass only the protos in |
Any progress / updates? |
Is there any reason why the fix proposed in #217 doesn't work? |
Hey @bjchambers sorry about the slow responses; it's a busy time of year. I still must defer to Andy on this one. @andyscott friendly ping : ) |
I originally noticed this when debugging why I was getting unexpected "indirect dependency" problems.
If you have two proto libraries, such that one depends on the other (eg., A <- B), then the scala library jar for B will contain all the code for the protos in A. I suspect this is because the
proto_library
rule produces a (concatenated) descriptor describing both thesrc
proto and any protos in the dependency set, and thescala_proto_library
then produces code for all the entries (not just those that were listed in the srcs).See #217 for a test reproducing the issue and a proposed fix.
(I'm not sure if this is what is causing my indirect dependency error, but my theory was that even though I had a direct dependency on A, and wasn't directly using B, it was registered as "used" because it redefined the classes from A)
The text was updated successfully, but these errors were encountered: