bazel-contrib / bazel_features

Support Bazel "feature detection" from starlark
https://docs.google.com/document/d/1HJf3gMYIrzmTRqbD4nWXH2eJRHXjLrOU0mmIeZplUzY/edit#heading=h.5mcn15i0e1ch
Apache License 2.0
19 stars 15 forks source link

Add a feature to test whether Stardoc support module extensions. #34

Closed phst closed 9 months ago

phst commented 9 months ago

See https://github.com/bazelbuild/stardoc/issues/192.

See logic in https://github.com/phst/rules_elisp/blob/8606695e977b876ffb38f881f54e50de1606a733/docs/BUILD for prior art.

phst commented 9 months ago

In https://github.com/phst/rules_elisp/blob/8606695e977b876ffb38f881f54e50de1606a733/docs/BUILD I selectively build the extensions target (for a Starlark file containing module extensions) depending on whether the current Bazel version is 7 or not. Whether this works or not appears to depend mainly on the Bazel version, at least for recent enough Stardoc versions. Happy to switch to a better approach if there's one!

fmeum commented 9 months ago

There is, you can detect the required Bazel feature directly: https://github.com/bazelbuild/stardoc/blob/bf441c86274770ea281d21e22292ecdaa6451eaa/stardoc/stardoc.bzl#L88

Let me know if that doesn't work and we can reconsider this.

phst commented 9 months ago

It works, thanks! https://github.com/phst/rules_elisp/commit/57787964fda190305fc7353e618da089ed3aff4b