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

Bazel: Protobuf classes must be built and used as a dependency to be included in the classpath #164

Closed
theothertomelliott opened this issue Aug 25, 2020 · 2 comments · Fixed by #166

Comments

@theothertomelliott
Copy link
Contributor

Observed Behavior

When a Bazel workspace includes java_proto_library macros, the proto must be added as a dependency of at least one java_library rule to appear in the classpath for autocompletion, etc.

Expected Behavior

Based on how the rest of the classpath is built, I believe the intention is that proto classes would be included regardless of whether or not they were already used.

Reproduction Steps

See: https://github.com/theothertomelliott/bazel-issues/tree/vscode_java_protos

===

It looks like the cause is a combination of Java protos being created as aspects rather than rules, so they don't show up with aquery by default (https://stackoverflow.com/questions/63430530/bazel-aquery-returns-no-action-information-for-java-proto-library/63455560#63455560), and the list of types included in the classpath aquery not including proto_library.

I'd be happy to submit a PR to include all protos up-front, as I've got pretty close to a solution while investigating.

@georgewfraser
Copy link
Owner

A PR would be welcome!!

@georgewfraser
Copy link
Owner

The basic strategy for dealing with bazel is to compute a global classpath, that contains the union of the classpaths of every java library and binary in the project. The idea is that the language server doesn't try to deeply understand your build. Instead, it is basically permissive about errors in your dependency structure, and assumes that bazel itself will reveal those to you when you build at the command line.

@theothertomelliott theothertomelliott changed the title Bazel: Protobuf classes must be build and used as a dependency to be included in the classpath Bazel: Protobuf classes must be built and used as a dependency to be included in the classpath Aug 28, 2020
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

Successfully merging a pull request may close this issue.

2 participants