-
Notifications
You must be signed in to change notification settings - Fork 278
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
How to use a scala_proto_library target as a dependency? #1304
Comments
Very interestingly, the following file is on the classpath, when I debug compiling my
|
If I add a repl target as: scala_repl(
name = "repl",
deps = [":proto_scala_lib"],
) Then I compile the REPL target, start the REPL and from there I can import the generated protobuf classes. |
This is some other issue, closing. |
This issue was caused by the scalapb compiler plugin's version. |
Reiterating. The issue is, that (comparing to sbt), when I create this configuration, there are missing Java classes, with the "${file}OuterClass" names. Is there any way to enable those? I found a ticket that mentions this feature: scalapb/ScalaPB#26 I'm not sure, is there maybe a flag that I should turn on when using |
It is about adding the following settings, it would be in sbt:
Wondering how these can be set up for Bazel. |
I found that I can create a proto toolchain, that has with_flat_package, but there is no more with_java option. scala_proto_toolchain(
name = "enable_all_options_toolchain_impl",
visibility = ["//visibility:public"],
with_flat_package = True,
#with_java = True,
) I guess with_java was removed. Is there a way to get an equivalent feature? |
This may be a duplicate of: #765 |
Hi @gergelyfabian indeed this is duplicate of mentioned issue. |
Thanks! I'll just write my workaround here, if anyone is wondering in the future:
|
I've create a Protobuf configuration basing on available examples (https://github.com/liucijus/rules-scala-proto-toolchain):
With this configuration the "library" target does not see the files generated from protobuf ("not a member of package" errors).
I can see that the necessary files are produced by scala_proto_library ("proto_scala_lib"):
When I unpack
bazel-bin/{my-package}/proto_lib_scalapb.jar
, the generated files are in those jars. However I cannot giveproto_lib_scalapb
as a dependency for mylibrary
target.I'm using rules_scala at version 6e37eac.
The text was updated successfully, but these errors were encountered: