Skip to content

Bazel backdating#3223

Draft
mgeisler wants to merge 3 commits into
mainfrom
bazel-backdating
Draft

Bazel backdating#3223
mgeisler wants to merge 3 commits into
mainfrom
bazel-backdating

Conversation

@mgeisler

Copy link
Copy Markdown
Collaborator

Hey @qwandor and @djmitche, this is a WIP of where I'm taking the project. On this branch,

% bazel build :da
# ...
Target //:da up-to-date:
  bazel-bin/da_html
  bazel-bin/da_pandoc

produces a Danish book!

I've been spinning off small bits and pieces of this WIP commit over the last few weeks in the PRs you've reviewed.

mgeisler added 3 commits June 25, 2026 22:41
This moves the remaining two tools into Bazel: `i18n-report` and
`mdbook` itself. They are still installed with

    cargo xtask install-tools

to make this less disruptive. This will go away as we start using the
`mdbook` rule in Bazel to build the many books.
This ensures that future use of the `mdbook` rule will use `mdbook`
version 5.0.3 to match #3207.
bazel: add repository rule to generate per-renderer book.toml

When `mdbook` is running, it renders output for each of the `output`
keys. This happens sequentially and we need different output for
different cases:

| Renderer     | English | Translations | Use Case                    |
| ------------ | ------- | ------------ | --------------------------- |
| `html`       | ✓       | ✓            | Website HTML output         |
| `pandoc`     | ✓       | ✓            | PDF generation              |
| `exerciser`  | ✓       | ✗            | Exercise starter code       |
| `xgettext`   | ✓       | ✗            | `.pot` file for translators |
| `linkcheck2` | ✓       | ✗            | Link validation in CI       |

This little repository rule is a step towards this: it lets us trim
the `book.toml` file down to the renderers we want to each case. We
can thus keep maintaining the overall set of renderers in the checked
in `book.toml` file, and then select a subset of the settings at build
time.
@mgeisler

Copy link
Copy Markdown
Collaborator Author

From this infrastructure, it's a small step to make a :website target which builds all known languages, puts them into the correct sub-directory and voila, we can now move all logic out of shell scripts and YAML files (and into .bzl files).

The complexity is still there... but it's now suddenly in a form that allows us to reproduce things locally that we could not really do easily today.

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.

1 participant