Skip to content

Commit 2d2f17a

Browse files
committed
2026.9.29.5: a build reports each step once, with its outcome, and a status line states the build while it runs
The validation project's cross-verification of this pull request printed nothing for 40 minutes between the last `Compiling` line and `Finished`: ninja ran with `--quiet` and its output was examined after it exited. Design: .agents/docs/2026-09-29-build-progress-display-design.md. - ninja runs without `--quiet` and is read line by line (stream_exec). Its status lines (NINJA_STATUS, with an escape-sequence prefix that a nested ninja's relayed copy loses) give the counts; its log gives which step finished and when it started and ended; a step record written beside build.ninja (steps.tsv) names each step's package and identity; the `__action` wrapper reports when a check or prepare action starts. - A package's line is written when every step the graph assigns to it has run, or when the build ends: `done <span>`, `cached N units`, `failed`, or the steps that ran. Requested packages are listed, dependencies folded into one line; --verbose lists every package and each step as `[f/t] <command>`. - A build program has one line: `ran <time>`, `cached`, `failed`; `waiting`, `compiling` and `running` while live. - On a terminal the live lines and one status line are drawn below the output (mcpp.ui's region, one writer for every line, ten frames a second at most); in a log the status line is written after a minute of silence. - A failed step is reported when it fails, not after ninja exits. - `Finished` states the whole command's time and, for ten seconds or more, how it was spent and the dominant step. - Terminal detection works on macOS and Windows; a Windows console receives UTF-16. mcpp.log stays a leaf: mcpp.ui installs the terminal sink for its verbose records, and the model logs its events to the log file. - e2e 842 (log medium) and 843 (a pseudo-terminal); unit tests of the readers, the record, the text measures, the region and the completion rule; the e2e tests that read the old lines follow them, and those that read a `Compiling` line as "the build planned" ask build.ninja's time instead. - docs/00, 09, 30, 40 in both languages; CHANGELOG.
1 parent 656a024 commit 2d2f17a

64 files changed

Lines changed: 4303 additions & 427 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/docs/2026-09-29-build-progress-display-design.md‎

Lines changed: 729 additions & 0 deletions
Large diffs are not rendered by default.

‎CHANGELOG.md‎

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,42 @@ This release completes the workspace build graph in the commands around the
1010
build, from the validation project's post-release run of 2026.9.29.4: build
1111
programs are reused across selections and run dependencies first, the build
1212
database and `--configure-only` plan by configuration, and the output names
13-
what it reports.
13+
what it reports. A build now reports each step when its outcome is known, and
14+
shows what runs while it runs (`.agents/docs/2026-09-29-build-progress-display-design.md`).
15+
16+
### Added
17+
18+
- **A build reports each step once, with its outcome.** A package's line is
19+
written when every step the graph assigns to it has run (`done` with the
20+
span of its steps, read from ninja's log), when the global cache supplied it
21+
(`cached N units`), when a step of it failed (`failed`), or when the build
22+
ends. A package with nothing to do has no line. The packages the command was
23+
asked to build are listed; their dependencies are folded into one line, and
24+
a dependency that fails is named. `--verbose` lists every package and prints
25+
each step as ninja reports it (e2e 842).
26+
- **A status line states the build.** On a terminal the steps still running
27+
and one status line, `Building 612/1203 · 14:32 · gpp.gui: vcpkg install
28+
6:10`, are drawn below the output and updated in place; the status line
29+
names the longest-running `check` or `prepare` action, which the engine's
30+
action wrapper reports when it starts. In a log (CI, a pipe) only final lines
31+
are written, and the status line is written when the log has been silent for
32+
a minute (e2e 842, 843).
33+
- **`Finished` states the whole command's time**, and for a command of ten
34+
seconds or more how it was spent (`plan`, `programs`, `build`) and the step
35+
that took at least a quarter of the build.
1436

1537
### Fixed
1638

39+
- **A failed step is reported when it fails.** Its diagnostics were printed
40+
after ninja exited, that is, after every step still running had finished:
41+
a compile error beside a twenty-minute vcpkg install appeared twenty minutes
42+
late (e2e 842).
43+
- **macOS and Windows terminals are terminals.** Terminal detection was
44+
compiled only under `__unix__`, which Apple's compilers do not define, so
45+
the download bar and colours were drawn on Linux alone. A Windows console
46+
now receives mcpp's lines as UTF-16, so `·`, `→` and non-ASCII paths appear
47+
as written whatever its code page.
48+
1749
- **A member's build program is reused whichever members a command selects.**
1850
Its graph document listed every requester in the plan, the virtual root
1951
included, so the program's re-run key followed the selection: `-p`, `mcpp
@@ -37,9 +69,16 @@ what it reports.
3769

3870
### Behaviour changes
3971

40-
- **The build program status lines name the package**:
41-
`build.mcpp compiling <package>`, `running <package>`,
42-
`up to date <package> (cached)` (e2e 839).
72+
- **A build program has one line, which names its package and states its
73+
outcome**: `build.mcpp <package> ran <time>`, `cached` or `failed`, in
74+
place of `build.mcpp compiling <package>` and `running <package>`, and of
75+
`up to date <package> (cached)` (e2e 839, 842). The programs of the
76+
requested packages are listed, and those of their dependencies are folded
77+
into one line.
78+
- **`Compiling <package>` is written when the package's steps have run**, with
79+
their outcome, rather than for every direct dependency before ninja starts;
80+
the per-dependency `Cached <package> (N units)` line is `--verbose` output,
81+
as `cached N units` (e2e 842).
4382
- **A selected member is announced by its directory** in a `--workspace`
4483
build, also where another member depends on it (e2e 839).
4584
- **`mcpp pack` summarises many outputs.** A format that reports more than

‎docs/00-what-mcpp-is.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ int main() {
144144
```console
145145
$ mcpp run
146146
Inferred target hello (bin from src/main.cpp)
147-
Compiling hello v0.1.0 (.)
147+
Compiling hello v0.1.0 (.) done 0.61s
148+
148149
Finished dev [unoptimized + debuginfo] in 0.64s
149150
Running `target/x86_64-linux-gnu/0946988e9e4b52ba/bin/hello`
150151

‎docs/09-commands-by-scenario.md‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,56 @@ An index refresh is reported step by step when the xlings that mcpp drives
227227
emits progress events for it (xlings 2026.9.28.1+). With an older xlings it
228228
shows its status line and finishes silently, as before.
229229

230+
## What a build prints
231+
232+
A build reports each step once, when its outcome is known (2026.9.29.5+):
233+
234+
```console
235+
$ mcpp build --workspace
236+
build.mcpp gpp.core ran 16.00s
237+
build.mcpp gpp.gui ran 6.70s
238+
Compiling gpp.core (GalTranslPP) done 3m12s
239+
Compiling 23 dependencies done 6m20s
240+
Compiling gpp.gui (GPPGUI) done 38m05s
241+
242+
Finished fast-release [unoptimized + debuginfo] in 41m53s · plan 1m13s · programs 32s · build 40m08s · longest gpp.gui: vcpkg install 22m10s
243+
```
244+
245+
- A package's line names the package and states its outcome: `done` with the
246+
span of its steps, `cached` when the global cache supplied it, `failed`, or
247+
the number of its steps that ran when a failed build stopped before the
248+
package completed. A package with nothing to do has no line.
249+
- The packages the command was asked to build (the root package, or the
250+
selected members) are listed. The packages they depend on are folded into
251+
one line, and a dependency that fails is named.
252+
- A build program's line states `ran` with its time, `cached`, or `failed`.
253+
- A failed step is reported when it fails, with its diagnostics, while ninja
254+
waits for the steps still running.
255+
- `Finished` states the whole command's time. A command of ten seconds or
256+
more also states how the time was spent, and names the step that took at
257+
least a quarter of the build when there is one.
258+
259+
On a terminal, the steps still running and one status line are drawn below
260+
the output and updated in place:
261+
262+
```
263+
Compiling gpp.gui (GPPGUI) 61 steps
264+
265+
Building 612/1203 · 14:32 · gpp.gui: vcpkg install 6:10
266+
```
267+
268+
The status line counts the build's steps, shows the time since the command
269+
started, and names the longest-running `check` or `prepare` action; ninja
270+
reports every other step only when it finishes. When the output is not a
271+
terminal (a CI log, a pipe), only final lines are written, and the status line
272+
is written when the output has been silent for a minute. `TERM=dumb` selects
273+
that form on a terminal too.
274+
275+
`--verbose` lists every package, including those with nothing to do (`fresh`),
276+
states each build program's compile and run times, and prints every step as
277+
ninja reports it (`[f/t] <command>` and its output). `--quiet` prints none of
278+
it. Machine output (`--message-format json`) is unchanged.
279+
230280
## Validating a descriptor before publishing
231281

232282
`mcpp xpkg parse` reads a descriptor with the resolver's own grammar, so what

‎docs/30-build-mcpp.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,9 +1518,13 @@ variable, emit `mcpp:rerun-if-changed=config.h` / `mcpp:rerun-if-env-changed=USE
15181518
This replaces the old "process exited 0, so assume it's fine" guesswork with an
15191519
explicit input/output contract — incremental builds stay correct.
15201520
1521-
When nothing changed the output is `build.mcpp up to date <package> (cached)`;
1522-
otherwise `build.mcpp compiling <package>` / `running <package>` (the package
1523-
is named from 2026.9.29.5 on).
1521+
Each program has one line, written when it finishes (2026.9.29.5+):
1522+
`build.mcpp <package> cached` when nothing changed, `build.mcpp <package> ran
1523+
<time>` when it was compiled or run (with `--verbose`, `compiled <time> · ran
1524+
<time>`), and `failed` when it failed. On a terminal the line shows `waiting`,
1525+
`compiling` or `running` with a clock while the program is pending or running.
1526+
The programs of the packages the command was asked to build are listed; those of
1527+
their dependencies are folded into one line, `build.mcpp N dependencies`.
15241528
15251529
## Host tools from a dependency (mcpp 2026.8.5.1+)
15261530

‎docs/40-baremetal.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,18 @@ cd blinky
200200
mcpp run
201201
```
202202

203-
Measured output:
203+
Output (2026.9.29.5; the times vary by machine):
204204

205205
```
206206
Resolving toolchain
207207
Resolved llvm@22.1.8 → riscv64-none-elf → @mcpp/registry/data/xpkgs/xim-x-llvm/22.1.8/bin/clang++
208208
Resolved host toolchain for build.mcpp: clang 22.1.8 (x86_64-unknown-linux-gnu)
209-
build.mcpp compiling blinky
210-
build.mcpp running blinky
209+
build.mcpp blinky ran 0.41s
211210
Inferred sources [src/**/*.{cppm,cpp,cc,c,S,s,asm}]
212211
Inferred target blinky (bin from src/main.cpp)
213-
Compiling blinky v0.1.0 (.)
214-
Cached riscv-virt-rt v0.3.0 (1 unit)
212+
Compiling blinky v0.1.0 (.) done 0.04s
213+
Compiling 1 dependency cached
214+
215215
Finished dev [unoptimized + debuginfo] in 0.05s
216216
Size blinky text 8572 data 80 bss 5668 total 14320
217217
Running `…/xim-x-qemu-riscv/9.2.4-1/bin/qemu-system-riscv64 … target/riscv64-none-elf/…/bin/blinky`

‎docs/zh/00-what-mcpp-is.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ int main() {
125125
```console
126126
$ mcpp run
127127
Inferred target hello (bin from src/main.cpp)
128-
Compiling hello v0.1.0 (.)
128+
Compiling hello v0.1.0 (.) done 0.61s
129+
129130
Finished dev [unoptimized + debuginfo] in 0.64s
130131
Running `target/x86_64-linux-gnu/0946988e9e4b52ba/bin/hello`
131132

‎docs/zh/09-commands-by-scenario.md‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,48 @@ commit 记进 `mcpp.toml`;`mcpp index unpin` 移除它。
209209
当 mcpp 驱动的 xlings 为索引刷新发出进度事件时(xlings 2026.9.28.1+),索引刷新
210210
逐步报告。较旧的 xlings 下,它显示其状态行,然后安静地结束,与以前相同。
211211

212+
## 构建输出
213+
214+
构建在每一步的结果已知时报告一次(2026.9.29.5+):
215+
216+
```console
217+
$ mcpp build --workspace
218+
build.mcpp gpp.core ran 16.00s
219+
build.mcpp gpp.gui ran 6.70s
220+
Compiling gpp.core (GalTranslPP) done 3m12s
221+
Compiling 23 dependencies done 6m20s
222+
Compiling gpp.gui (GPPGUI) done 38m05s
223+
224+
Finished fast-release [unoptimized + debuginfo] in 41m53s · plan 1m13s · programs 32s · build 40m08s · longest gpp.gui: vcpkg install 22m10s
225+
```
226+
227+
- 包的行写出包名与结果:`done` 后接其各步骤的跨度,`cached` 表示由全局缓存提供,
228+
`failed`,或者在失败的构建于该包完成前停止时,写出它已运行的步骤数。没有工作
229+
的包不写行。
230+
- 命令被要求构建的包(根包或被选中的成员)逐个列出;它们依赖的包折叠为一行,
231+
失败的依赖单独写出名字。
232+
- 构建程序的行写出 `ran` 及其耗时、`cached` 或 `failed`。
233+
- 一个步骤失败时立即报告,连同其诊断;ninja 此时仍在等待正在运行的步骤。
234+
- `Finished` 写出整条命令的耗时。十秒及以上的命令还写出时间的分布,并在某一步
235+
占构建阶段四分之一以上时写出这一步。
236+
237+
在终端上,仍在运行的步骤与一行状态行绘制在输出下方,并原地更新:
238+
239+
```
240+
Compiling gpp.gui (GPPGUI) 61 steps
241+
242+
Building 612/1203 · 14:32 · gpp.gui: vcpkg install 6:10
243+
```
244+
245+
状态行给出构建的步骤计数、自命令开始以来的时间,以及运行最久的 `check` 或
246+
`prepare` 动作;其他步骤 ninja 只在完成时报告。输出不是终端时(CI 日志、管道),
247+
只写最终的行,并在输出静默一分钟时写一次状态行。`TERM=dumb` 在终端上也选择
248+
这种形式。
249+
250+
`--verbose` 列出每个包(包括没有工作的包,记为 `fresh`),写出每个构建程序的编译
251+
与运行耗时,并按 ninja 的报告打印每一步(`[f/t] <命令>` 及其输出)。`--quiet`
252+
不打印这些。机器输出(`--message-format json`)不变。
253+
212254
## 发布前校验描述符
213255

214256
`mcpp xpkg parse` 用解析器自己的文法读一个描述符,所以它报告的就是解析时

‎docs/zh/30-build-mcpp.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,8 +1276,11 @@ mcpp **不会**每次构建都重跑 `build.mcpp`。它会缓存程序产出的
12761276
`mcpp:rerun-if-changed=config.h` / `mcpp:rerun-if-env-changed=USE_FAST`。这用一份明确的
12771277
输入/输出契约取代了过去「进程退出码为 0 就当成功」的猜测——让增量构建保持正确。
12781278
1279-
无变化时输出 `build.mcpp up to date <包名> (cached)`;否则是 `build.mcpp compiling <包名>` /
1280-
`running <包名>`(自 2026.9.29.5 起写出包名)。
1279+
每个程序一行,在程序结束时写出(2026.9.29.5+):无变化时是 `build.mcpp <包名> cached`,
1280+
编译或运行过时是 `build.mcpp <包名> ran <耗时>`(`--verbose` 下为 `compiled <耗时> · ran
1281+
<耗时>`),失败时是 `failed`。在终端上,程序等待或运行期间该行显示 `waiting`、`compiling`
1282+
或 `running` 及计时。命令被要求构建的包的程序逐个列出;其依赖的程序折叠为一行
1283+
`build.mcpp N dependencies`。
12811284
12821285
## 依赖产出的 host 工具(mcpp 2026.8.5.1+)
12831286

‎docs/zh/40-baremetal.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,18 @@ cd blinky
170170
mcpp run
171171
```
172172

173-
实测输出:
173+
输出(2026.9.29.5;耗时因机器而异):
174174

175175
```
176176
Resolving toolchain
177177
Resolved llvm@22.1.8 → riscv64-none-elf → @mcpp/registry/data/xpkgs/xim-x-llvm/22.1.8/bin/clang++
178178
Resolved host toolchain for build.mcpp: clang 22.1.8 (x86_64-unknown-linux-gnu)
179-
build.mcpp compiling blinky
180-
build.mcpp running blinky
179+
build.mcpp blinky ran 0.41s
181180
Inferred sources [src/**/*.{cppm,cpp,cc,c,S,s,asm}]
182181
Inferred target blinky (bin from src/main.cpp)
183-
Compiling blinky v0.1.0 (.)
184-
Cached riscv-virt-rt v0.3.0 (1 unit)
182+
Compiling blinky v0.1.0 (.) done 0.04s
183+
Compiling 1 dependency cached
184+
185185
Finished dev [unoptimized + debuginfo] in 0.05s
186186
Size blinky text 8572 data 80 bss 5668 total 14320
187187
Running `…/xim-x-qemu-riscv/9.2.4-1/bin/qemu-system-riscv64 … target/riscv64-none-elf/…/bin/blinky`

0 commit comments

Comments
 (0)