bazelbuild / stardoc

Stardoc: Starlark Documentation Generator
Apache License 2.0
103 stars 40 forks source link

Remove explicit dependency on protobuf #221

Closed fmeum closed 1 month ago

fmeum commented 1 month ago

With --incompatible_enable_proto_toolchain_resolution, the root module is supposed to provide a proto_lang_toolchain for Java, which injects the runtime. Hardcoded dependencies on the protobuf module would negate the benefits of supplying a toolchain with precompiled protoc and runtime.

Since the only used symbol from the protobuf runtime was an exception class, it has been replaced with a check for its class name. If more protobuf runtime symbols should be needed in the future, they should be obtained from a current_java_proto_runtime target that first looks for a proto_lang_toolchain for Java and only then falls back to the hardcoded reference.

The WORKSPACE deps macro still brings in com_google_protobuf as this may be the only source of the repo for users.

fmeum commented 1 month ago

CC @alexeagle @comius

I needed to make this change to finally remove any dependency on @com_google_protobuf from a ruleset using stardoc to build its documentation. This greatly speeds up GitHub Actions CI times.

fmeum commented 1 month ago

Could you create a release with this change? Then modules in the BCR could start using it without patches.

alexeagle commented 1 month ago

+1 on request for release, I'm running into the need to patch this out as well

alexeagle commented 3 weeks ago

@tetromino ping again on a release, the last one is 309 days ago

tetromino commented 2 weeks ago

@alexeagle - I want to get #231, #232, and #216 in before cutting the release.

alexeagle commented 2 weeks ago

LMK if you're interested in the techniques we use for OSS rulesets so release instructions are just "push a tag". Makes it such a non-event that you could release both before and after landing some things 😜

comius commented 2 weeks ago

LMK if you're interested in the techniques we use for OSS rulesets so release instructions are just "push a tag". Makes it such a non-event that you could release both before and after landing some things 😜

I agree it’s cool. Me and @meteorcloudy spent a couple of hours each, fixing it on Monday for a minor rules_proto release. But I really think it’s cool when it works. ;)

meteorcloudy commented 2 weeks ago

BTW, the issue we hit for rules_proto release is https://github.com/bazel-contrib/.github/issues/16, where XDG_CACHE_HOME is now also respected by Bazel

tetromino commented 2 weeks ago

@alexeagle - stardoc-0.7.0 has been released and is now in the central registry. Sorry for the wait!

LMK if you're interested in the techniques we use for OSS rulesets so release instructions are just "push a tag".

Sure - do you have a good example in mind that Stardoc can follow?