|
1 | | -# See MODULE.bazel: this cannot build xlings today, and the blocker is the |
2 | | -# workspace boundary rather than anything about modules. |
| 1 | +# The bazel arm of the xlings control target. See MODULE.bazel for why the two |
| 2 | +# interesting things — the tree and its dependencies — are external repositories |
| 3 | +# rather than globs, and mcpp_registry.bzl for how they are built. |
3 | 4 | # |
4 | | -# The shape a working version would take is kept here so the gap is legible: |
| 5 | +# THIS PACKAGE DECLARES ONE RULE ON PURPOSE, and that one rule is the point of |
| 6 | +# the file. It used to declare none: a comment-only BUILD.bazel makes |
| 7 | +# `bazel build //...` exit 0 in 0.14s with `Found 0 targets`, and the harness |
| 8 | +# published that as a 0.43s cold build in a column next to cmake's 94s. |
| 9 | +# bench/src/engines/bazel.cppm now asks `bazel query kind(rule, //...)` before it |
| 10 | +# will measure anything here, so an empty description reports a reason instead of |
| 11 | +# a number — but the fix for "no rules" is a rule. |
5 | 12 | # |
6 | | -# cc_binary( |
7 | | -# name = "xlings", |
8 | | -# srcs = ["src/main.cpp"], |
9 | | -# module_interfaces = glob(["src/**/*.cppm"]) + [ |
10 | | -# "std.cppm", # copied from libc++, listed FIRST |
11 | | -# ], |
12 | | -# includes = ["src/libs/json"], |
13 | | -# defines = ["LIBARCHIVE_STATIC", "UNICODE", "_UNICODE"], |
14 | | -# copts = ["-std=c++23", "-Wno-reserved-module-identifier"], |
15 | | -# linkopts = ["-static-libstdc++"], |
16 | | -# ) |
| 13 | +# The alias, rather than the cc_binary itself, because `module_interfaces` takes |
| 14 | +# labels bazel can glob and the sources live in a submodule this package must not |
| 15 | +# write into. @xlings_tree carries the generated cc_binary; see _XLINGS_BUILD in |
| 16 | +# mcpp_registry.bzl for the source set and why it is not `src/main.cpp` alone. |
17 | 17 | # |
18 | | -# built with: |
19 | | -# bazel build //:xlings --experimental_cpp_modules --features=cpp_modules --force_pic |
| 18 | +# MEASURED, on bazel 9.2.0 + rules_cc 0.2.22 with the payload clang 22.1.8, |
| 19 | +# `--compilation_mode=opt`, cold after `bazel clean`: |
20 | 20 | # |
21 | | -# ...from inside the xlings checkout, which is the part that does not work: this |
22 | | -# description would have to be written INTO the tree being measured. |
| 21 | +# tree TUs compiled cold `--version` |
| 22 | +# xlings-2026.8.11.2 110 .cppm + 2 .cpp 46.4s xlings 2026.8.11.2 |
| 23 | +# xlings-2026.8.13.1 110 .cppm + 92 .cpp 18.0s xlings 2026.8.13.1 |
| 24 | +# |
| 25 | +# plus the dependency set, whose counts are the check that the .xpkg.lua |
| 26 | +# manifests are being read rather than the trees globbed: libarchive 127 (a glob |
| 27 | +# is 132), lua 32 (a glob is 34, and the two extra each define `main`), mbedtls |
| 28 | +# 108, xz 74, ftxui 73, zstd 26, zlib 15, bzip2 7, lz4 5, and 19 translation |
| 29 | +# units across the four mcpplibs packages — 18 of them module interfaces, one of |
| 30 | +# which is the generated mcpplibs.xpkg.lua_stdlib. |
| 31 | +# |
| 32 | +# bazel build //:xlings # the default pin |
| 33 | +# BENCH_PROJECT_ROOT=$PWD/xlings-2026.8.11.2 bazel build //:xlings |
| 34 | +# bazel run //:xlings -- --version |
| 35 | +# |
| 36 | +# The binary itself lands at |
| 37 | +# bazel-bin/external/+xlings_tree+xlings_tree/xlings |
| 38 | +# because that is the repository that owns the rule; `bazel run` above is the |
| 39 | +# path-independent way to reach it. |
| 40 | + |
| 41 | +alias( |
| 42 | + name = "xlings", |
| 43 | + actual = "@xlings_tree//:xlings", |
| 44 | + visibility = ["//visibility:public"], |
| 45 | +) |
0 commit comments