Skip to content

Conversation

@anforowicz
Copy link
Contributor

@anforowicz anforowicz commented Dec 4, 2025

PTAL?

The mdbook {{#include ...}} syntax is based on what I found in https://rust-lang.github.io/mdBook/format/mdbook.html#including-portions-of-a-file. I tested manually by running DISPLAY=:20 mdbook build -o under book/ and looking at the Bazel chapter.

I don't really use Bazel often, but I hope that including a more complete example helps. Not sure if a more canonical/reusable example is possible - I hope that Bazel experts if any can chime in with additional/future PRs if needed.

I understand that this PR probably doesn't directly help the reporter of #1676 (since they have more of a custom setup with an ad-hoc rust_binary target for cxxbridge-cmd and with cxxbridge-macro defined somewhere else (hopefully with a matching version).

This commit is motivated by the discussion in
dtolnay#1676.
Including the top-level `BUILD.bazel` will hopefully help to hightlight
how the same `version` is used across `cxxbridge`, `cxxbridge-macro`,
and `cxx` targets.
@sayrer
Copy link
Contributor

sayrer commented Dec 4, 2025

I understand that this PR probably doesn't directly help the reporter of #1676 (since they have more of a custom setup with an ad-hoc rust_binary target for cxxbridge-cmd and with cxxbridge-macro defined somewhere else (hopefully with a matching version).

It all matches, but the Bazel CXX docs leave this part unexplained:

        tool = "//:codegen",

I wish the cxxbridge command came as a separate target alongside "cxx" and "cxx_cc", which all works fine. Then, the version numbers would always match.

@anforowicz
Copy link
Contributor Author

[...] the Bazel CXX docs leave this part unexplained:

        tool = "//:codegen",

Ack. After this PR the docs will cover //:codegen target which is defined in the top-level BUILD.bazel file - see

cxx/BUILD.bazel

Lines 23 to 27 in 2901aa8

alias(
name = "codegen",
actual = ":cxxbridge",
visibility = ["//visibility:public"],
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants