Skip to content

Commit 16a0c1a

Browse files
2026.11.2.1: a dependency's patches and a dependency embedded in its consumer; #875; #881 (#882)
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent ce4dd4b commit 16a0c1a

41 files changed

Lines changed: 2487 additions & 151 deletions

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-10-30-ecosystem-part2-ide-and-language-service-design.md‎

Lines changed: 142 additions & 2 deletions
Large diffs are not rendered by default.

‎.agents/docs/2026-11-02-ecosystem-part3-ok-image-performance-parity-design.md‎

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

‎.agents/docs/README.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ superseded_by: 2026-09-07-....md # when status is superseded
1818
---
1919
```
2020

21-
344 records.
21+
345 records.
2222

2323
## By subject
2424

@@ -88,6 +88,10 @@ Records that declare one. Everything else is listed by date below.
8888

8989
- [Two answers and two silences: the scanner's second grammar, and the manifest keys nothing reads](2026-09-09-two-answers-and-two-silences.md) — active
9090

91+
### openkal-performance
92+
93+
- [生态设计 part 3:ok 映像的性能对等——引擎路径、openkal 运行时与观测](2026-11-02-ecosystem-part3-ok-image-performance-parity-design.md) — active
94+
9195
### plan
9296

9397
- [Eight reports after 2026.9.27.1: implementation plan](2026-09-27-eight-reports-implementation-plan.md) — active
@@ -154,6 +158,9 @@ Records that declare one. Everything else is listed by date below.
154158

155159
## By date
156160

161+
### 2026-11
162+
163+
- [生态设计 part 3:ok 映像的性能对等——引擎路径、openkal 运行时与观测](2026-11-02-ecosystem-part3-ok-image-performance-parity-design.md) — active
157164
### 2026-10
158165

159166
- [大型工作区的构建空间与复用(mcpp#874)](2026-10-31-workspace-space-and-reuse-design.md) — active

‎CHANGELOG.md‎

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,56 @@
44
> Each `## [<version>]` section is that release's notes. Entries are written in English
55
> from 2026.9.28.3 on; earlier entries remain as written.
66

7+
## [2026.11.2.1] - 2026-11-02
8+
9+
A dependency's source is used without being copied: a dependency edge carries
10+
patches, and a dependency is compiled into its consumer (design 2026-11-02,
11+
part 3 §14). With them, mcpp#875 and mcpp#881.
12+
13+
### Added
14+
15+
- **`patches = [...]` on a dependency edge** (docs/05). Unified diffs, named
16+
relative to the declaring manifest, applied in order to the verified source by
17+
mcpp's own exact applier (no fuzz, no search, no conversion of line endings;
18+
one leading directory of each path removed; renames, copies and binary changes
19+
refused). A patched library is another library, a variant: its identity is
20+
(package, version, patch set), its source a tree of its own under the mcpp
21+
home (`cache/src/<package>/<version>+p<digest>`), and its build, BMIs and
22+
cache entries its own. Version and git dependencies; a `path` dependency with
23+
patches is refused. `mcpp.lock` records the variant and each patch's path and
24+
SHA-256 (`variant`, `patches`); `mcpp emit sbom` states them as the component's
25+
pedigree. A variant's tree is collected by `cache gc`, `prune` and after a
26+
build as the cache's entries are. e2e 1001.
27+
- **`embed = true` and `exclude = [...]` on a dependency edge** (docs/05). The
28+
dependency's sources, less `exclude`, are compiled into the consumer with the
29+
consumer's flags and, for those files, the dependency's include directories
30+
and compile flags; the dependency builds nothing of its own in that
31+
configuration, and a program that reaches it without its embedder is refused
32+
naming both. `exclude` without `embed` is refused at the manifest. e2e 1002.
33+
- **One program, one variant of a package**: two programs of one configuration
34+
may each use their own patch set; a program that reaches two variants of a
35+
package, or a variant and the package without patches, is refused naming
36+
them. e2e 1003.
37+
38+
### Fixed
39+
40+
- **A build with a toolchain outside every provider found no ninja** (mcpp#875):
41+
the ninja mcpp installed into its own home is used after the one beside the
42+
compiler's provider and before PATH, and `MCPP_NINJA` names the same one. With
43+
none, the build is refused naming where it looked, instead of "cannot start
44+
'ninja'". e2e 1004.
45+
- **`clean --stale` said every directory was current after keeping one**
46+
(mcpp#881): directories kept for being newer than the window are counted, and
47+
the summary says how many and within what window. The default window of
48+
`--older-than` is `[build] keep_days` (3 days), the window of the sweep after a
49+
build, instead of one day. The SubOS remedies name the home:
50+
`XLINGS_HOME=<registry> xlings self doctor --fix`. e2e 1005.
51+
52+
### Design
53+
54+
- Design 2026-11-02 part 3 (ok image performance parity), approved; part 2
55+
rev 11 and 12 corrections.
56+
757
## [2026.10.31.3] - 2026-10-31
858

959
A large workspace keeps its bytes once and builds each output once (mcpp#874;
@@ -2906,7 +2956,7 @@ C 库来自依赖图的链接此前没有 `--sysroot`,clang 会从宿主推导 `
29062956

29072957
### 成员清单只有一种读法
29082958

2909-
`mcpp publish`、`mcpp pack`、`mcpp emit xpkg`、`mcpp toolchain list`、`mcpp sbom`、`mcpp index list`/`update`、
2959+
`mcpp publish`、`mcpp pack`、`mcpp emit xpkg`、`mcpp toolchain list`、`mcpp emit sbom`、`mcpp index list`/`update`、
29102960
`mcpp update` 的索引刷新、快路径的身份判定与测试发现,此前直接读取成员目录中的原始清单:省略
29112961
`version` 的成员被拒绝,未写 `[toolchain]` 的成员在 `toolchain list` 中显示全局默认工具链,而同一
29122962
目录下的 `mcpp build` 用的是工作空间的工具链。现在它们与 `prepare_build` 经同一个函数读取继承后的

‎docs/05-dependencies.md‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,61 @@ each of them may have its own module of one name.
610610
A module that several programs share is best provided by one package that the
611611
others depend on; it is then compiled once.
612612

613+
### A dependency's patches, and a dependency embedded in its consumer (mcpp 2026.11+)
614+
615+
Two fields of a dependency edge use a package's source without copying it.
616+
617+
```toml
618+
[dependencies]
619+
"compat.zlib" = { version = "1.3.2", patches = ["patches/0001-fix.patch"] }
620+
"compat.mimalloc" = { version = "3.6.1", embed = true, exclude = ["*/src/prim/prim.c"] }
621+
```
622+
623+
**`patches`** are unified diffs (`diff -u`, `git format-patch`), named relative
624+
to the manifest that declares them and applied in order to the package's
625+
verified source.
626+
627+
- A patched library is another library, a **variant**: its identity is the
628+
package, its version and the patch set, named by the SHA-256 over each
629+
patch's SHA-256 in order (not by the files' names). Its source is a tree of
630+
its own, `cache/src/<package>/<version>+p<digest>` under the mcpp home, and
631+
its build, its BMIs and its cache entries are its own. One patch set carried
632+
by two packages is one variant.
633+
- The applier is mcpp's and is exact: a hunk applies where its header says,
634+
every line of context and every line it removes byte for byte, or the build
635+
is refused naming the patch, the file, the hunk and the line. Nothing is
636+
searched for elsewhere and no line ending is converted. Paths in a patch
637+
carry one leading directory (`a/`, `b/`), which is removed. Renames, copies
638+
and binary changes are refused.
639+
- Version and git dependencies may carry patches; a `path` dependency is a tree
640+
its consumer owns and is refused with them.
641+
- `mcpp.lock` names the variant and each patch by its path and SHA-256;
642+
`mcpp emit sbom` states them as the component's pedigree.
643+
- One program holds one variant of a package. Two programs of one
644+
configuration (members of a workspace) may each use their own; a program
645+
that reaches two variants of one package, or a variant and the package
646+
without patches, is refused, naming them.
647+
- The variant's tree is collected as the cache's entries are: by `mcpp cache
648+
gc` and `prune`, and after a build once unused for `[cache] unused_days`.
649+
650+
**`embed = true`** compiles the dependency into its consumer.
651+
652+
- The dependency's sources, as its description selects them and less
653+
`exclude` (globs relative to the dependency's root), are compiled as the
654+
consumer's, with the consumer's flags and, for those files, the
655+
dependency's include directories and compile flags.
656+
- The dependency builds nothing of its own in that configuration: every other
657+
edge to it takes its interface, and the embedder supplies its definitions.
658+
A program that reaches it without its embedder is refused, naming both.
659+
- `exclude` is allowed only with `embed`: a library built on its own that
660+
compiled fewer files would change for every consumer, which is a patch's to
661+
state.
662+
663+
A C library uses `embed` to carry an allocator or another dependency that would
664+
otherwise need the C library itself to be built. A package that uses either
665+
field states `mcpp = ">=2026.11"` in `[package]`, so that an older mcpp refuses
666+
it rather than building it without its patches.
667+
613668
## Current limitations
614669

615670
- **Two things need the network, and only two:** resolving a branch that has no

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ the fast paths read. Three consequences follow from that definition:
5656

5757
- A directory no record names is not deleted merely for that. `mcpp test`
5858
builds through a path that writes no record, and so does a `--no-cache`
59-
build. An unrecorded directory written within `--older-than` (one day by
60-
default) is kept; older than that it goes, and the cost of being wrong is one
61-
rebuild of a configuration nothing has touched since.
59+
build. An unrecorded directory written within `--older-than` is kept; older
60+
than that it goes, and the cost of being wrong is one rebuild of a
61+
configuration nothing has touched since. The default window is `[build]
62+
keep_days` of `config.toml` (3 days), the window the sweep after a build
63+
uses, so the two agree on what is recent (2026.11). When it kept a
64+
directory, the summary says how many and within what window.
6265
- With no record at all the command refuses rather than guess. One
6366
`mcpp build` establishes what is current.
6467
- Directories under `target/` that are not fingerprint directories — `dist/`

‎docs/zh/05-dependencies.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,45 @@ updater = { path = "../updater", artifacts = ["updater"] }
533533

534534
几个程序共用的模块,最好由一个包提供、其余的包依赖它;这样它只编译一次。
535535

536+
### 依赖的补丁,以及嵌入使用者的依赖(mcpp 2026.11+)
537+
538+
依赖边上的两个字段让一个包使用另一个包的源码而不拷贝它。
539+
540+
```toml
541+
[dependencies]
542+
"compat.zlib" = { version = "1.3.2", patches = ["patches/0001-fix.patch"] }
543+
"compat.mimalloc" = { version = "3.6.1", embed = true, exclude = ["*/src/prim/prim.c"] }
544+
```
545+
546+
**`patches`** 是 unified diff(`diff -u`、`git format-patch` 的输出),路径相对于声明它们的清单,
547+
按顺序应用到该包已校验的源码上。
548+
549+
- 打过补丁的库是另一个库,即**变体**:它的身份是包、版本与补丁集;补丁集以各补丁 SHA-256 依序
550+
再取的 SHA-256 命名,与文件名无关。变体有自己的源码树(mcpp home 下
551+
`cache/src/<包>/<版本>+p<摘要>`),构建、BMI 与缓存条目都是自己的。两个包携带同一组补丁,得到
552+
同一个变体。
553+
- 应用器是 mcpp 自己的,而且是精确的:一个 hunk 只在其头部所写的位置应用,每一行上下文与每一行
554+
删除都必须逐字节相符,否则构建被拒绝,并指出补丁、文件、hunk 与行号。不在别处查找,不转换换行。
555+
补丁中的路径带一级前导目录(`a/`、`b/`),应用时去掉。改名、复制与二进制改动被拒绝。
556+
- 版本依赖与 git 依赖可以带补丁;`path` 依赖是使用者自己拥有的源码树,带补丁时被拒绝。
557+
- `mcpp.lock` 记录变体,以及每个补丁的路径与 SHA-256;`mcpp emit sbom` 把它们写作组件的 pedigree。
558+
- 一个程序只持有一个包的一个变体。同一配置中的两个程序(工作区的成员)可以各用自己的变体;一个
559+
程序同时到达同一个包的两个变体,或一个变体与不带补丁的该包时被拒绝,消息点名两者。
560+
- 变体的源码树与缓存条目一样回收:`mcpp cache gc`、`prune`,以及构建之后超过
561+
`[cache] unused_days` 未用的。
562+
563+
**`embed = true`** 把依赖编进使用者。
564+
565+
- 依赖的源文件(按其描述选出,再减去 `exclude`,glob 相对于依赖的根目录)作为使用者的源文件编译:
566+
使用使用者的编译参数,并且对这些文件另加依赖的 include 目录与编译参数。
567+
- 在这一配置中,该依赖自己不编译任何东西:指向它的其他边只取它的接口,定义由嵌入者提供。一个程序
568+
到达它而不含其嵌入者时被拒绝,消息点名两者。
569+
- `exclude` 只能与 `embed` 一起使用:一个单独构建的库若少编译一些文件,它对所有使用者都变了,
570+
这应当由补丁陈述。
571+
572+
C 库用 `embed` 携带分配器之类本身需要 C 库才能构建的依赖。使用其中任一字段的包在 `[package]` 中写
573+
`mcpp = ">=2026.11"`,使旧版 mcpp 拒绝它,而不是不带补丁地构建它。
574+
536575
## 当前边界
537576

538577
- **只有两件事需要网络,而且只有这两件:** 解析一个在 lock 里没有 commit 的

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ Would remove 1 directory (0.0 B)
4848
路径读取。这个定义带来三个推论:
4949

5050
- 一个没有记录的目录,不会仅因此就被删除。`mcpp test` 走的构建路径不写
51-
记录,`--no-cache` 构建同样不写。未被记录、但写在 `--older-than`(默认
52-
一天)之内的目录会被保留;更旧的会被删,判断出错的代价是重编一个此后
53-
无人碰过的配置。
51+
记录,`--no-cache` 构建同样不写。未被记录、但写在 `--older-than` 之内的
52+
目录会被保留;更旧的会被删,判断出错的代价是重编一个此后无人碰过的配置。
53+
默认窗口是 `config.toml` 的 `[build] keep_days`(3 天),即构建后清理所用
54+
的同一个窗口,两者对"新"的定义一致(2026.11)。保留了目录时,摘要给出
55+
保留的个数与窗口。
5456
- 完全没有记录时,命令拒绝执行,而不是去猜。跑一次 `mcpp build` 就能确立
5557
什么是当前的。
5658
- `target/` 下不是指纹目录的东西 —— 例如 `mcpp pack` 的 `dist/` —— 从不

‎mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mcpp"
3-
version = "2026.10.31.3"
3+
version = "2026.11.2.1"
44
description = "Modern C++ build & package management tool"
55
license = "Apache-2.0"
66
authors = ["mcpp-community"]

‎modules/manifest/src/dep_spec.cppm‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,26 @@ struct DependencySpec {
113113
// into publicUsage unconditionally. Only build.mcpp-INJECTED include dirs
114114
// are private-only.)
115115
bool reexport = false;
116+
// design 2026-11-02 (part 3) §14: a patched dependency is another
117+
// library. `patches` are unified diffs applied in order to the verified
118+
// source; the edge's dependency becomes the VARIANT (package, version,
119+
// patch set), with a source tree, a build and a cache of its own. Each path
120+
// is absolute here --- the reader resolves it against the directory of the
121+
// manifest that declared it, so the patch belongs to the package that
122+
// carries it --- and `patchesDigest` names the set: the SHA-256 over each
123+
// patch's own SHA-256, in order (empty for no patches). Version and git
124+
// edges only: a `path` dependency is a tree its consumer already owns.
125+
std::vector<std::string> patches;
126+
std::string patchesDigest;
127+
// `embed = true`: the dependency's sources (as its description selects
128+
// them, less `exclude`) are compiled INTO this consumer with the
129+
// consumer's flags and the dependency's include directories and macros,
130+
// and the dependency is not built as a library of its own. The embedder is
131+
// the dependency's supplier in every program it is in; other edges to the
132+
// same package there take its interface only. `exclude` (globs relative to
133+
// the dependency's root) is allowed only with `embed`.
134+
bool embed = false;
135+
std::vector<std::string> exclude;
116136
bool defaultFeatures = true; // consumer opt-out: `default-features = false`
117137
bool defaultFeaturesDeclared = false;
118138
// A member edge (workspace design 2026-09-29 §15): the edge from a

0 commit comments

Comments
 (0)