feat: bit more configurable proto toolchain#1718
feat: bit more configurable proto toolchain#1718simuons merged 12 commits intobazel-contrib:masterfrom
Conversation
mbland
left a comment
There was a problem hiding this comment.
If/when this goes in, it'll need a section added under "Breaking changes in rules_scala 7.x" in README.md. Probably an h4 (starting with ####) at the end of the "New scala_toolchains() API for WORKSPACE" section (before "@io_bazel_rules_scala_config is now @rules_scala_config").
Run bazel run //tools:lint_fix to fix the ./test_lint.sh error.
Also, it's good to run ./test_all.sh before pushing. It'll run all the CI scripts on your local machine, plus dt_patches/dt_patch_test.sh.
It looks like "test_scala_version 2.12.20" from test_version.sh failed:
ERROR: /workdir/test_version/test_scala_version_1742216337/BUILD:161:14:
scala @//:lib_with_scala_proto_dep failed:
(Exit 1): scalac failed:
error executing Scalac command
(from target //:lib_with_scala_proto_dep)
bazel-out/k8-opt-exec-ST-a828a81199fe/bin/external/rules_scala/src/java/io/bazel/rulesscala/scalac/scalac
@bazel-out/k8-fastbuild/bin/lib_with_scala_proto_dep.jar-0.params
--
| TestServer.scala:6: error:
| object TestServiceGrpc is not a member of package test.proto.test_service
| import test_service.TestServiceGrpcIf you want to iterate on this , you can run RULES_SCALA_TEST_ONLY="test_scala_version 2.12.20" ./test_version.sh. (Hmm, maybe I should add these tips to README.md?)
|
Hi, @kczulko, thanks for PR. Your approach looks good to me. I remember there was a discussion in the past "list of opts vs individual attribute in toolchain for each opt" but I don't remember remember where it was. I'll try to look around and get back to this. |
simuons
left a comment
There was a problem hiding this comment.
As I said overall I like the change. But I think we should handle "default" generator differently. Waiting for your comment.
3e7ee3e to
6569e90
Compare
mbland
left a comment
There was a problem hiding this comment.
Thanks for adding the docs. I've some editorial suggestions that hopefully make things a little clearer.
df7e4bb to
3c25cdf
Compare
…)" This reverts commit c1e58d3.
Description
Hello,
Over a year ago I had the experience of porting a project from sbt to rules_scala. One of the quirks of such a migration was protobuf. That time I've used
rules_proto_grpcto overcome this part but I thought it should be possible with built-in proto toolchain fromrules_scala. Now I finally had some time to take this journey and check it. Here are the results:proto_enable_all_optionsremoved - I think that user should define the options. Thisallseems to be a bit out of date, e.g.scala3_sourceswas not included there.grpcdep id removed - Similar to above. The code that was merging compile deps was checkingwith_grpcflag that also got removed. I took an approach that here, as well, user knows what he wants so ifgrpcflag was added to the toolchain configuration, that means you need to provide proper dependencies as well. IMHO this grpc dep id was a bit artificial but I'm keen to hear some other opinion.main_generatorremoved - for this approach the main_generator becomes the default one and got moved tonamed_generatorswith its default name set toscala.I assume there might be a places which are not ready yet (like
docs). Let's see what CI will tell us.Motivation
scala3_sources)