Skip to content

Commit b63b3ed

Browse files
committed
docs(07/17): 依赖的 [xlings] 声明会被采纳,且 xpkg_dir 现在回答范围 —— 两处陈述已过期
1 parent fb01aac commit b63b3ed

4 files changed

Lines changed: 53 additions & 9 deletions

File tree

docs/07-build-mcpp.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ int main() {
121121
| `mcpp::link_flag(s)` *(2026.9.6.5+)* | `mcpp:link-flag=` |
122122
| `mcpp::link_script(p)` *(2026.8.19+)* | `mcpp:link-script=` |
123123
| `mcpp::runner(tok)` *(2026.8.19.2+)* | `mcpp:runner=` — see below |
124-
| `mcpp::xpkg_dir(ns, name)` / `mcpp::xpkg_dir(name)` *(2026.8.19+)* | the payload directory of a package this manifest declared in `[xlings.workspace]`; `""` when it was not declared or is not installed (see below) |
124+
| `mcpp::xpkg_dir(ns, name)` / `mcpp::xpkg_dir(name)` *(2026.8.19+)* | the payload directory of a package declared in `[xlings.workspace]` — by this manifest, or by a dependency compiled into this build program *(2026.9.6.6+)*; `""` when it was not declared or is not installed (see below) |
125125
| `mcpp::warning(text)` *(2026.8.21.2+)* | `mcpp:warning=` — see below |
126126
| `mcpp::action{…}.submit()` *(2026.8.5.1+)* | `mcpp:action=` — declares a **build-graph node** instead of doing the work here (see below) |
127127

@@ -335,6 +335,18 @@ A **pinned** reference resolves to exactly that version or to nothing. A
335335
build that asked for `1.8.12` and silently got `1.9.0` is an answer only
336336
discovered later, in the artifact.
337337

338+
A **constrained** one (`>=8.5.0`, `^1.2`) resolves to the highest installed
339+
version satisfying it *(2026.9.6.6+)*. Before that release the whole version
340+
position was compared against a directory name, so a range installed a payload
341+
and then answered that nothing was installed — which is why a rule package
342+
could not state a floor and every project repeated its rule's package list.
343+
344+
**A package a DEPENDENCY declared is answered too** *(2026.9.6.6+)*, at the
345+
version this build actually installed rather than the one the local manifest
346+
wrote. One package means one version: where a project and a rule both name it,
347+
the declaration nearer the artifact wins and both sides are told the same
348+
answer. See *One package, one version* in [05 — mcpp.toml](05-mcpp-toml.md).
349+
338350
**`[feature-xlings.<f>]` is answered too, while `<f>` is active**
339351
*(2026.9.6.2+)*. That table has provisioned its packages since it existed --
340352
naming one downloads and installs it -- but the build program's environment was

docs/17-the-project-environment.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ behind it.
6868
### 2.1 Which version pins apply (2026.9.3+)
6969

7070
Naming an environment also changes where a tool's version comes from. A
71-
project's own `[xlings.workspace]` entries always win; what differs is what
72-
they are laid over:
71+
project's own `[xlings.workspace]` entries always win — over the environment
72+
here, and over a dependency's declaration by the rule in section 3 — and what
73+
differs is what they are laid over:
7374

7475
| The project declares | The version of a tool it did not name comes from |
7576
|---|---|
@@ -93,9 +94,23 @@ different question from `PATH` and stays a different answer: a build program
9394
that needs a package's data files (protoc's well-known `.proto` files, say)
9495
asks for the directory, and one that needs to *run* a program asks `PATH`.
9596

96-
A dependency's own `[xlings]` declaration is never consulted or propagated. In
97-
a workspace build the workspace root owns the selection; a member's declaration
98-
applies only when that member is built as an independent root.
97+
**A workspace member's declaration is not the workspace's.** In a workspace
98+
build the workspace root owns the selection; a member's `[xlings]` applies only
99+
when that member is built as an independent root.
100+
101+
**A dependency's declaration is a different matter, and it is honoured**
102+
(2026.9.5.4+ for `[xlings] deps`, 2026.9.6.6 for the version rule below). A
103+
board-support package knows which emulator reaches its machine, and a rule
104+
package knows which toolkit its rule drives; a consumer that had to repeat
105+
either is the duplication such packages exist to remove. What the dependency
106+
declares is installed, and `MCPP_XPKG_<NAME>_DIR` answers for it in that
107+
dependency's own build program.
108+
109+
Where a project and a dependency name **one package**, one version of it is
110+
installed: identity is `(namespace, name)` and the version is a constraint on
111+
it. The declaration nearer the artifact wins and the override is reported;
112+
a pin that fails a requirement the other side stated is refused naming both.
113+
See *One package, one version* in [05 — mcpp.toml](05-mcpp-toml.md).
99114

100115
## 4. Reading an environment, never creating one
101116

docs/zh/07-build-mcpp.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ int main() {
110110
| `mcpp::link_flag(s)` *(2026.9.6.5+)* | `mcpp:link-flag=` |
111111
| `mcpp::link_script(p)` *(2026.8.19+)* | `mcpp:link-script=` |
112112
| `mcpp::runner(tok)` *(2026.8.19.2+)* | `mcpp:runner=` —— 见下 |
113-
| `mcpp::xpkg_dir(ns, name)` / `mcpp::xpkg_dir(name)` *(2026.8.19+)* | 本 manifest 在 `[xlings.workspace]` 里声明的包的载荷目录;没声明或没安装时返回 `""`(见下) |
113+
| `mcpp::xpkg_dir(ns, name)` / `mcpp::xpkg_dir(name)` *(2026.8.19+)* | `[xlings.workspace]` 里声明的包的载荷目录 —— 本 manifest 声明的,或编进本构建程序的某个依赖声明的(2026.9.6.6+);没声明或没安装时返回 `""`(见下) |
114114
| `mcpp::warning(text)` *(2026.8.21.2+)* | `mcpp:warning=` —— 见下 |
115115
| `mcpp::action{…}.submit()` *(2026.8.5.1+)* | `mcpp:action=` —— **声明一个构建图节点**,而不是在这里把活干了(见下) |
116116

@@ -289,6 +289,14 @@ store 内部结构 —— 与 `dep_dir` 存在的理由相同。
289289
**带版本固定**的引用只解析到那个版本,否则什么都不返回。请求 `1.8.12` 却静默拿
290290
`1.9.0`,是那种要到产物里才被发现的答案。
291291

292+
**带约束**的引用(`>=8.5.0``^1.2`)解析到满足它的**最高已安装版本**
293+
(2026.9.6.6+)。在那之前整个版本位是拿去与目录名比对的,于是一条范围装上了载荷,然后
294+
回答「没装」—— 这正是规则包无法声明下界、而每个工程都要把规则的包列表重写一遍的原因。
295+
296+
**依赖声明的包同样被作答**(2026.9.6.6+),而且答的是这次构建**真正装上**的版本,不是
297+
本地 manifest 写下的那个。一个包只有一个版本:工程与规则都命名它时,离产物更近的声明赢,
298+
而两侧被告知同一个答案。见 [05 — mcpp.toml](05-mcpp-toml.md) 的「一个包一个版本」。
299+
292300
**`[feature-xlings.<f>]``<f>` 生效时同样被作答**(2026.9.6.2+)。这张表从诞生
293301
起就参与供给 —— 在那里写下一个包,它就会被下载并安装 —— 但构建程序的环境只由
294302
`[xlings.workspace]` 填充,于是载荷明明在盘上,`xpkg_dir` 却返回 `""`。这时构建程序

docs/zh/17-the-project-environment.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,17 @@ SubOS 里。前置让被声明的环境成为默认答案;其余的仍在它后
7979
的数据文件(比如 protoc 自带的 well-known `.proto`)的构建程序问目录,需要
8080
**运行**某个程序的构建程序问 `PATH`
8181

82-
依赖自己的 `[xlings]` 声明从不被读取也不被传播。工作区构建中由工作区根持有这个
83-
选择;成员的声明只在该成员作为独立根被构建时生效。
82+
**工作区成员的声明不是工作区的声明。** 工作区构建中由工作区根持有这个选择;成员的
83+
`[xlings]` 只在该成员作为独立根被构建时生效。
84+
85+
**依赖的声明是另一回事,而且它被采纳**(`[xlings] deps` 自 2026.9.5.4,下面那条版本
86+
规则自 2026.9.6.6)。板级支持包知道哪个模拟器够得到它那台机器,规则包知道它驱动哪个
87+
工具包;要消费者把这些再写一遍,正是这类包存在的意义所反对的重复。依赖声明的东西会被
88+
装上,而 `MCPP_XPKG_<NAME>_DIR` 在那个依赖自己的构建程序里为它作答。
89+
90+
工程与依赖命名**同一个包**时,只装它的一个版本:身份是 `(namespace, name)`,版本是这个
91+
包上的约束。离产物更近的声明赢,并且覆盖会被报出来;不满足对方所陈述之要求的钉会被拒绝
92+
并点出两侧。见 [05 — mcpp.toml](05-mcpp-toml.md) 的「一个包一个版本」。
8493

8594
## 4. 只读取环境,从不创建环境
8695

0 commit comments

Comments
 (0)