Skip to content

Commit 605e9c2

Browse files
feat(platform): the version group takes part in resolution, and the built-in platform is a series
A platform's [platform.versions] was checked after the walk only. The platform is the first package the graph resolves, and its group now binds every later request of a member: a request whose constraint admits the group's version resolves to it though the index holds a newer patch, and one that does not is refused before anything compiles, naming the request and the group (SPEC-013 §7.5). The check after the walk stays as an assertion. The target table selects openkal-platform@^0.24, a series: its newest release whose [package] mcpp floor this engine meets, skipping and naming a release made for a newer one; mcpp.lock keeps the release while the series admits it, and `mcpp update` moves it (SPEC-013 §14, §15.1). A platform patch no longer needs an mcpp release. e2e 1020 and 1021; SPEC-013 1.4; docs 04, 05, 35, 50. Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent 74d1df4 commit 605e9c2

17 files changed

Lines changed: 409 additions & 41 deletions

‎docs/04-mcpp-toml.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ the platform's own key names ([35 — Platforms](35-platforms.md)):
15181518

15191519
```toml
15201520
[target.'cfg(os = "openkal")']
1521-
platform = "openkal-platform@0.24.0" # or { path = "…" }, or "none"
1521+
platform = "openkal-platform@^0.24" # a series, a version, { path = "…" }, or "none"
15221522

15231523
[target.'cfg(platform = "openkal")'.layers]
15241524
c-abi = { path = "../openkal-musl" }

‎docs/05-dependencies.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,21 @@ package. The same holds for `linkage`
202202
on a selected member's dependency edges, which is honoured, and refused when
203203
two selected members ask for two forms of one package.
204204

205+
**A later edge that asks more features (mcpp 2026.11.7.1+).** A package is
206+
built with the union of the features its edges ask. When an edge reaches a
207+
package already resolved and activates a feature the earlier edges did not,
208+
that feature's `[feature-deps]` and forwards are walked as well, so the
209+
dependencies it needs, and the features it asks of them, reach the graph.
210+
Before, the feature's sources were compiled and its dependencies were not
211+
(mcpp#897; for example `v` selected beside `s`, which asks `v` for `x`).
212+
213+
**Under a platform's version group (mcpp 2026.11.7.1+).** When the target's
214+
platform states `[platform.versions]`, a request of a package the group lists,
215+
by version, resolves to the group's version if its constraint admits it, and is
216+
refused naming the request and the group if it does not (docs/35, "The version
217+
group"). A family whose packages name one another by compatible ranges is
218+
therefore resolved by its group, one version of each package per build.
219+
205220
### The identity of a `path` or `git` dependency (mcpp 2026.9.14.2+)
206221

207222
A `path` or `git` dependency is the package its manifest declares, whatever key

‎docs/35-platforms.md‎

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The first of these that answers selects the target's platform:
113113

114114
| Source | Spelling |
115115
|---|---|
116-
| the command line | `--platform openkal-platform@0.24.0`, `--platform path:../openkal-platform`, `--platform none` |
116+
| the command line | `--platform openkal-platform@0.24.1`, a series `--platform openkal-platform@^0.24`, `--platform path:../openkal-platform`, `--platform none` |
117117
| the environment | `MCPP_TARGET_X86_64_OPENKAL_PLATFORM=…` |
118118
| the project | `[target.<selector>] platform = "openkal-platform@0.24.0"`, or `{ path = "…" }` |
119119
| this machine | the same key in `~/.mcpp/config.toml` |
@@ -160,20 +160,39 @@ same system and architecture that it serves.
160160

161161
## The version group
162162

163-
`[platform.versions]` names one version of each package of a family whose
164-
packages pin one another exactly. A graph that holds another version of one of
165-
them is refused before anything compiles:
163+
`[platform.versions]` names one version of each package of a family. From mcpp
164+
2026.11.7.1 the group chooses: the platform is the first package the graph
165+
resolves, and each later request of a package the group lists, by version,
166+
resolves to the group's version when its constraint admits it, though the index
167+
holds a newer patch. openkal's packages name one another by compatible ranges
168+
(`openkal-musl = "^0.28.0"`), so the group's choice is what a build links. A
169+
request the group's version does not satisfy is refused before anything
170+
compiles:
166171

167172
```
168-
error: openkal-musl 0.22.2 is in this build, and the platform openkal-platform 0.24.0 is a version group that names openkal-musl 0.28.0.
169-
requested by: own
170-
The family's packages pin one another exactly, so two versions of one of
171-
them cannot be linked into one program. Either select the platform release
172-
of that version ([target.<selector>] platform = "openkal-platform@<version>"), or write
173-
openkal-musl = "0.28.0" where it is requested.
173+
error: openkal-musl is requested as '^0.27.0' by app, and the platform openkal-platform 0.24.1 is a version group
174+
that names openkal-musl 0.28.1.
175+
The group chooses one version of each package of the family for a
176+
build. Either select the platform release of the version you need
177+
([target.<selector>] platform = "openkal-platform@<version>"), or admit 0.28.1 where
178+
it is requested (openkal-musl = "^0.28.1").
174179
```
175180

176-
A package taken from a directory or a repository is not bound by the group.
181+
A package built for this machine only (a tool's) and a package taken from a
182+
directory or a repository are not bound by the group. An mcpp before
183+
2026.11.7.1 checks the group after resolution instead; a family released as one
184+
index change resolves the same either way.
185+
186+
## The built-in platform is a series
187+
188+
The target table selects `openkal-platform@^0.24` for the two ok-image targets:
189+
a series. A series takes its newest release whose `[package] mcpp` floor this
190+
mcpp meets, naming each release it skips for a newer engine, and `mcpp.lock`
191+
records it; the next build takes the recorded release while the series admits
192+
it. `mcpp update` (or `mcpp update openkal-platform`) drops the record, and the
193+
build after it takes the newest release again. A project selects a series of
194+
its own the same way, `platform = "openkal-platform@^0.24"`, and an exact
195+
release with a version.
177196

178197
## Writing a platform package
179198

‎docs/50-machine-output.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ installation, which is located on the machine rather than installed by mcpp. A
527527
target row is `{target, note, toolchain, pin, status, default}`, and `status` is
528528
one of `installed` / `available` / `via dependency graph` / `planned`.
529529
A target row also carries `platform` (2026.10.27.1+): the platform package the
530-
target table selects for it (`mcpplibs.openkal-platform@0.24.0`), or `null`.
530+
target table selects for it (the series `mcpplibs.openkal-platform@^0.24` from 2026.11.7.1), or `null`.
531531

532532
**`toolchain` and `pin` are not the same field twice.** `toolchain` is what
533533
the row is associated with — the installed payload on an installed row, the

‎docs/specs/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
| [SPEC-010](home-initialization.md) | home 选择、单跳入口、初始化、网络边界与单次运行的 `--home` | 草案 v0.2 | 2026-10-26 | mcpp >= 2026.10.19.1;网络能力逐条标注;§6 mcpp >= 2026.10.26.1、xlings >= 2026.10.26.1 |
4343
| [SPEC-011](concurrency.md) | 并发运行:三段、构建目录锁、原子发布、`mcpp.lock` 的乐观写入、取消 | 评审中 v1.0 | 2026-10-26 | mcpp >= 2026.10.26.1 |
4444
| [SPEC-012](human-output.md) | 面向人的输出:两条流、两种介质、行的种类、颜色 | 评审中 v1.0 | 2026-10-26 | mcpp >= 2026.10.26.1 |
45-
| [SPEC-013](platforms.md) | 平台:`[platform]` 的七组键、版本组与 `hosted`,三种写法与层次,目标图与宿主图的选择,`cfg(platform)`,依赖图的补全,链接、命名与封装,运行器与载体,平台阶段与协议 17 | 评审中 v1.2 | 2026-10-29 | mcpp >= 2026.10.27.1;§10 的执行宿主与 §11 的载体架构 mcpp >= 2026.10.29.1 |
45+
| [SPEC-013](platforms.md) | 平台:`[platform]` 的七组键、版本组与 `hosted`,三种写法与层次,目标图与宿主图的选择,`cfg(platform)`,依赖图的补全,链接、命名与封装,运行器与载体,平台阶段与协议 17 | 评审中 v1.4 | 2026-11-07 | mcpp >= 2026.10.27.1;§10 的执行宿主与 §11 的载体架构 mcpp >= 2026.10.29.1;§7.5 版本组参与解析与 §14 平台系列 mcpp >= 2026.11.7.1 |
4646
| [SPEC-014](packaging.md) | 打包与分发:链接、闭包、容器三个维度与构建腿,腿的合并,暂存树与 `mcpp-package.json`,平台的树、运行覆盖、单文件、polyglot、容器列表、签名、压缩、合并与分发描述 | 评审中 v2.1 | 2026-10-31 | mcpp >= 2026.10.31.1;逐条标注 |
4747
| [SPEC-015](target-sets.md) | 目标集合与腿:集合的写法与展开,命令对多条腿的语义,串行规划与一起构建,测试归档,机器输出 | 评审中 v1.0 | 2026-10-30 | mcpp >= 2026.10.30.1 |
4848

‎docs/specs/platforms.md‎

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
|---|---|
55
| 规范编号 | SPEC-013 |
66
| 标题 | 平台:一类目标的可复用配置,其声明、选择、合并、对依赖图的补全、链接与封装、运行器与载体 |
7-
| 状态 | 评审中 v1.3 |
8-
| 版本 | 1.3 |
9-
| 最后修改 | 2026-10-30 |
10-
| 对应实现 | mcpp >= 2026.10.27.1;§10 的执行宿主与 §11 的载体架构 mcpp >= 2026.10.29.1;`runner.hosts`、载体列表、`descriptor_keys` 与 `universal` 的弃用 mcpp >= 2026.10.30.1;逐条标注 |
7+
| 状态 | 评审中 v1.4 |
8+
| 版本 | 1.4 |
9+
| 最后修改 | 2026-11-07 |
10+
| 对应实现 | mcpp >= 2026.10.27.1;§10 的执行宿主与 §11 的载体架构 mcpp >= 2026.10.29.1;`runner.hosts`、载体列表、`descriptor_keys` 与 `universal` 的弃用 mcpp >= 2026.10.30.1;§7.5 版本组参与解析、§14 平台系列与 §15.1 系列的锁 mcpp >= 2026.11.7.1;逐条标注 |
1111
| 相关设计文档 | `.agents/docs/2026-10-28-platforms-design.md`、`.agents/docs/2026-10-28-platforms-part2-packaging-and-distribution-design.md`、`.agents/docs/2026-10-29-openkal-run-test-pack-design.md` |
1212
| 相关 issue | mcpp#846、mcpp#847、mcpp#848 |
1313
| 相关规范 | [SPEC-002](target-side.md)(目标侧的层)、[SPEC-004](manifest-semantics.md)(条件化形状)、[SPEC-006](toolchain-management.md)(工具链选择)、[SPEC-007](build-plugins.md)(构建程序与协议)、[SPEC-011](concurrency.md)(原子发布)、[SPEC-014](packaging.md)(打包) |
@@ -138,7 +138,7 @@ plugin = "build.mcpp"
138138
| 值 | 含义 |
139139
|---|---|
140140
| `none` | 不使用平台 |
141-
| `"<name>@<version>"`、包引用表 | 一个平台包,按普通依赖解析、获取与锁定 |
141+
| `"<name>@<约束>"`、包引用表 | 一个平台包,按普通依赖解析、获取与锁定;约束为版本或 SemVer 范围(`^0.24`),范围即一个平台系列(§14) |
142142
| `path:<dir>`,或写成路径的值(以 `/`、`./`、`../`、`~` 开头,Windows 盘符,或含路径分隔符且不含 `@`) | 一个目录中的平台包;命令行与环境变量中的相对路径相对于 mcpp 的启动目录 |
143143

144144
一个目录的清单不可读时,选择**必须**以该清单的错误失败。**已实现**
@@ -236,10 +236,14 @@ plugin = "build.mcpp"
236236

237237
### 7.5 版本组
238238

239-
`versions` 中的包以不同于组中版本的版本出现在图中时拒绝(`platform-version-group`),消息写出该包、两个版本、
240-
请求链与两条出路:选择携带所需版本的平台版本,或在请求处把该包写成组中的版本。只为本机构建的包(工具)
241-
与以 `path`、`git` 取得的包不受版本组约束。检查在每一轮补全之前与最后一轮之后进行,使工程固定的一个版本以
242-
版本组的冲突报告,而不是以平台加入的包遇到第二个版本报告。**已实现**
239+
版本组是解析的约束(mcpp >= 2026.11.7.1)。平台包是目标图解析的第一个包;读到它之后,图中对 `versions` 所列的包、
240+
以版本发出的每个请求,在请求的约束容许组中版本时解析为组中版本,不容许时拒绝(`platform-version-group`),消息写出
241+
该包、请求的约束与请求者、版本组及其版本,以及两条出路:选择携带所需版本的平台版本,或在请求处容许组中版本
242+
(`<包> = "^<版本>"`)。索引中有更新的补丁时,结果仍是组中版本。只为本机构建的包(工具)与以 `path`、`git` 取得的包
243+
不受版本组约束。
244+
245+
解析之后的检查保留为断言:在每一轮补全之前与最后一轮之后,图中 `versions` 所列的包都是组中版本。早于 2026.11.7.1
246+
的引擎只做这一检查;对一个以兼容范围互相依赖、且整组一次发布到索引的家族,两者的结果相同。**已实现**
243247

244248
### 7.6 多版本改名的边界
245249

@@ -387,9 +391,16 @@ run_under = ["qemu-aarch64"]
387391
## 14. 内置平台与目标表
388392

389393
宿主目标(Linux、macOS、Windows、Android、iOS、Emscripten)的约定留在引擎中,无平台包。目标表有平台列:
390-
`x86_64-openkal`、`aarch64-openkal` 的值为 `mcpplibs.openkal-platform@<version>`,即这两个目标的内置支持;
391-
选择来源报告为 `built-in`。项目可以不等引擎更新,以 `[target.<selector>] platform` 选择另一个版本。
392-
**已实现**
394+
`x86_64-openkal`、`aarch64-openkal` 的值为平台系列 `mcpplibs.openkal-platform@^0.24`,即这两个目标的内置支持;
395+
选择来源报告为 `built-in`。项目可以以 `[target.<selector>] platform` 选择另一个版本或系列。**已实现**
396+
397+
**平台系列(mcpp >= 2026.11.7.1)。** 以范围选择的平台是一个系列:
398+
399+
1. 锁中记录了这一平台包(`origin = "platform"`)且记录的版本满足范围时,取记录的版本(§15.1);
400+
2. 否则取范围内最新、且其 `[package] mcpp` 下限不高于当前引擎的版本;跳过的版本连同所需的引擎版本写入报告;
401+
3. 结果写入 `mcpp.lock`;`mcpp update`(或 `mcpp update <平台包>`)删除记录,下一次构建按第 2 条重新选择。
402+
403+
平台发布补丁版本因此不需要发布 mcpp。精确版本(`@0.24.1`、`@=0.24.1`)按写出的取。**已实现**
393404

394405
**描述符键(mcpp >= 2026.10.30.1)。** 每个目标行声明它读取依赖描述符的哪些按平台块及其顺序,第一个存在的块被读取;
395406
`xpm` 下的版本与 `mcpp` 段的按平台表都按此读取,构建机不参与:
@@ -420,6 +431,9 @@ openkal-platform 的 `targets` 因此不含 WebAssembly。Web 经 `wasm32-emscri
420431
条目中去掉,不再被任何配置解析的条目被删除;一个条目的版本改变时其 `targets` 只剩这次的配置;条目按身份排序。为本机的
421432
构建与为 `x86_64-openkal` 的构建、打包因此不互相改写锁。**已实现**
422433

434+
以系列选择的平台包(§14)从锁中读回:记录的版本满足系列时被采用,这是锁对版本依赖的唯一一处约束;其他版本依赖
435+
每次按约束重新解析,锁只作断言(`--locked`)。**已实现**(mcpp >= 2026.11.7.1)
436+
423437
### 15.2 身份
424438

425439
平台包与它加入的包是依赖图的成员,进入配置指纹的依赖部分;换平台或平台版本即换构建目录。平台的身份为
@@ -488,7 +502,8 @@ openkal-platform 的 `targets` 因此不含 WebAssembly。Web 经 `wasm32-emscri
488502
2. 选择按 §3.1、§4.1 的顺序;`none` 不使用平台;目录形式读取目录中的清单。
489503
3. `cfg(platform = ...)` 下写 `platform` 被拒绝。
490504
4. 图已提供某层时平台不加入该层的包,报告为 `graph`;`false` 不加入。
491-
5. 版本组冲突在任何链接之前拒绝,消息给出两条出路。
505+
5. 版本组冲突在任何编译之前拒绝,消息写出请求与版本组并给出两条出路;容许组中版本的范围解析为组中版本,
506+
即使索引中有更新的版本;开发树不受约束(e2e 951、1020)。
492507
6. 封装失败不发布产物,保留上一次的产物。
493508
7. `same-arch` 的运行器不运行其他架构的产物,并给出 `run_under` 的写法;`mcpp test` 的人类输出给出完整的原因恰好一次(e2e 960)。
494509
8. 平台的工具在任何图中按宿主约定构建。
@@ -500,6 +515,8 @@ openkal-platform 的 `targets` 因此不含 WebAssembly。Web 经 `wasm32-emscri
500515
12. 给出执行宿主时,`mcpp run` 与 `mcpp test` 交给它的运行器程序是产物架构的 ELF;本机有该架构的 qemu 时映像经它运行、
501516
测试通过;`mcpp self env` 报告拒绝的原因,给出执行宿主时报告另一架构的运行器(e2e 960)。
502517
13. 映像的单文件的载体是映像架构的程序;`--mode self-contained` 的单目标包是树,携带该架构的运行器(e2e 961)。
518+
14. 以系列选择的平台取引擎可读的最新版本,跳过下限更高的版本并写出;锁记录的版本在系列内时被采用,`mcpp update` 之后
519+
取更新的版本(e2e 1021)。
503520

504521
## 变更记录
505522

@@ -509,3 +526,4 @@ openkal-platform 的 `targets` 因此不含 WebAssembly。Web 经 `wasm32-emscri
509526
| 1.1 | 2026-10-28 | `[platform] universal`;载体的三种携带形式(运行器形式、映像、映像组的 zip)、`mcpp_carried_digest`、Mach-O 节名 `__carried`、按系统的行;平台阶段可声明包格式与 artifact action;`self env --host` 报告运行器与工具;判据 10、11(e2e 952、953)。 |
510527
| 1.2 | 2026-10-29 | mcpp 2026.10.29.1:§10 给出执行宿主时 `same-arch` 运行器的程序为产物架构的载体运行器形式,`mcpp test` 写出完整的拒绝原因一次;§11 单目标包与单文件的程序为产物架构的,不构建的行在生成工程之前被拒绝;§14 ok 映像与 Web;§16 `self env` 报告运行器程序的架构、执行宿主与拒绝,平台包的 `mcpp test` 运行给出执行宿主的目标;判据 7、12、13(e2e 960、961)。 |
511528
| 1.3 | 2026-10-30 | mcpp 2026.10.30.1(设计 2026-10-29 §4.3–§4.5、§13.3):§1.1 `universal` 弃用、不起作用;`runner.hosts`;`carrier` 接受列表,每项的 `hosts` 与 `build`;`descriptor_keys`;§10 执行宿主的运行器程序按 `hosts` 选择载体项;§11 携带映像的载体只属于单文件,树携带运行器形式;判据 13 改写(e2e 961)。 |
529+
| 1.4 | 2026-11-07 | mcpp 2026.11.7.1(设计 2026-11-07 §4.1.4、§4.2.2 A2/A3):§7.5 版本组参与解析,解析后的检查保留为断言;§3.2 平台引用接受 SemVer 约束;§14 目标表的平台列为系列 `^0.24`,系列取引擎可读的最新版本;§15.1 系列从锁中读回,`mcpp update` 移动它;判据 5 改写、14 新增(e2e 1020、1021)。 |

‎docs/zh/04-mcpp-toml.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,7 @@ runner 与 `run_under`。
13971397

13981398
```toml
13991399
[target.'cfg(os = "openkal")']
1400-
platform = "openkal-platform@0.24.0" # or { path = "…" }, or "none"
1400+
platform = "openkal-platform@^0.24" # a series, a version, { path = "…" }, or "none"
14011401

14021402
[target.'cfg(platform = "openkal")'.layers]
14031403
c-abi = { path = "../openkal-musl" }

‎docs/zh/05-dependencies.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,14 @@ sdk = { version = "1.0", visibility = "private" }
178178
一个配置只构建一个包的一份 checkout。被选中成员依赖边上的 `linkage` 同理:它会被采纳;两个被选中成员
179179
为同一个包要求两种形态时被拒绝。
180180

181+
**后到的边要求更多特性(mcpp 2026.11.7.1+)。** 一个包以其各条边所要求特性的并集构建。一条边到达已解析的包、并激活
182+
此前各边没有激活的特性时,该特性的 `[feature-deps]` 与转发也一并遍历,使它需要的依赖及其对这些依赖要求的特性进入
183+
依赖图。此前该特性的源码会被编译,依赖却不会进入依赖图(mcpp#897;例如 `v` 与要求 `v` 的 `x` 特性的 `s` 一同被选中)。
184+
185+
**平台版本组之下(mcpp 2026.11.7.1+)。** 目标的平台声明了 `[platform.versions]` 时,对版本组所列包的版本请求,若其约束
186+
容许组中版本则解析为组中版本,否则以点名请求与版本组的错误拒绝(docs/35“版本组”)。包之间以兼容范围互相依赖的家族
187+
因此由其版本组解析,每次构建每个包一个版本。
188+
181189
### `path` 或 `git` 依赖的身份(mcpp 2026.9.14.2+)
182190

183191
`path` 或 `git` 依赖就是它的 manifest 所声明的那个包,与指向它的键无关。来源

0 commit comments

Comments
 (0)