bazel-contrib / rules-template

A template for creating a new Bazel ruleset
Apache License 2.0
82 stars 22 forks source link

Guidance on tool authoring #57

Closed sengelha closed 7 months ago

sengelha commented 1 year ago

Many languages require building and using supplementary tools, like @io_bazel_rules_go's use of a builder tool. Is there guidance on the "right" way to author tools which are used by this rules-template, and hook them up to the ruleset? What about if mylang is not an appropriate language in which to author these tools?

In the past, I've written these tools as:

  1. sh_binary()s, which doesn't work out of the box on Windows particularly well, and often depends on other system tools
  2. py_binary()s, which don't work well in Bazel remote build scenarios, particularly when using python3 and third-party pip libraries
  3. go_binary()s, which end up polluting my rulesets with external references to @io_bazel_rules_go
alexeagle commented 7 months ago

Yes, I wrote this up in https://blog.aspect.build/releasing-bazel-rulesets-rust and you can see aspect-build/rules_py and aspect-build/bazel_lib are examples.

I'll add to docs here.