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

@com_google_protobuf//:protobuf_java_util pulls in duplicate classes #9192

Closed
eikemeier opened this issue Nov 5, 2021 · 4 comments · Fixed by #9195
Closed

@com_google_protobuf//:protobuf_java_util pulls in duplicate classes #9192

eikemeier opened this issue Nov 5, 2021 · 4 comments · Fixed by #9195

Comments

@eikemeier
Copy link
Contributor

What version of protobuf and what language are you using?
Version: v3.19.1
Language: Java

What operating system (Linux, Windows, ...) and version?
macOS 10.15.7

What runtime / compiler are you using (e.g., python version or gcc version)
JDK 17.0.1

What did you do?
This is a follow-up to #8925

Steps to reproduce the behavior:

Check out https://github.com/eikemeier/proto-java2
bazel run //:main

What did you expect to see
No duplicate resources.

What did you see instead?
Multiple copies of the same class, see output of the tool. @com_google_protobuf//:protobuf_java_util pulls in

com_google_protobuf/libtimestamp_proto-speed.jar
com_google_protobuf/java/core/libcore.jar
com_google_protobuf/java/core/liblite_runtime_only.jar
com_google_protobuf/java/util/libutil.jar
com_google_protobuf/java/core/liblite.jar

See also the README in the repository above to reproduce.

Anything else we should know about your project / environment
Nothing special, Bazelisk or Bazel 5.0rc1 required.

eikemeier added a commit to eikemeier/proto-java2 that referenced this issue Nov 5, 2021
@perezd
Copy link
Contributor

perezd commented Nov 5, 2021

hmmm, aside from the changes we made to bazel to remove the dupes, I am not sure what to do here. Looking at the graph, it's depending on standard java_library targets which shouldn't be causing duplication. Is there any more debugging you can help us with?

@eikemeier
Copy link
Contributor Author

eikemeier commented Nov 5, 2021

Is there any more debugging you can help us with?

I'm not an expert, but @com_google_protobuf//:protobuf_java aka @com_google_protobuf//java/core doesn't depend on lite:

$ bazel query 'deps(@com_google_protobuf//java/core)' --output package | fgrep com_google_protobuf  
@com_google_protobuf//
@com_google_protobuf//java/core

while @com_google_protobuf//java/util does:

$ eik@Silver proto_java2 % bazel query 'deps(@com_google_protobuf//java/util)' --output package | fgrep com_google_protobuf  
@com_google_protobuf//
@com_google_protobuf//java/core
@com_google_protobuf//java/lite
@com_google_protobuf//java/util

and I guess it shouldn't.

That would probably be

"//java/lite",

@perezd
Copy link
Contributor

perezd commented Nov 5, 2021

Oh interesting, can you try a PR that removes it and see if it's OK? https://github.com/protocolbuffers/protobuf/blob/master/java/util/BUILD#L15

That is probably just an error.

@eikemeier
Copy link
Contributor Author

Oh interesting, can you try a PR that removes it and see if it's OK?

Indeed, it does, see the latest commit of https://github.com/eikemeier/proto-java2

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

Successfully merging a pull request may close this issue.

3 participants