Skip to content

Commit 985b7ca

Browse files
authored
docs: a build plugin names the libraries its modules import in [dependencies] (mcpp 2026.10.11.1) (#520)
From mcpp 2026.10.11.1 (mcpp-community/mcpp#797) a build plugin's [dependencies] are compiled with it for the build programs that use it, and reexport = true hands one on to their build.mcpp. A plugin built on mcpp.plugins' plugins-core names it there. The [build-dependencies] entry with host-module = true, the spelling before that release, is read as a dependency as well, reported as deprecated, and no longer read from mcpp 2027.1. A [build-dependencies] edge gives the build program the library without host-module = true.
1 parent 6a3153a commit 985b7ca

2 files changed

Lines changed: 24 additions & 15 deletions

File tree

‎docs/package-types.md‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,9 @@ one deliberately uses no generated code, this one is generated code end to end.
298298

299299
A build plugin is a package whose modules a consumer's `build.mcpp` imports: its
300300
units import `mcpp.core` (also spelled `mcpp`) and reach a consumer through a
301-
`[build-dependencies]` edge with `host-module = true`. Three rules admit one to
302-
this index (mcpp#734):
301+
`[build-dependencies]` edge, which gives the build program the package's library
302+
(`host-module = true` states it explicitly). Three rules admit one to this index
303+
(mcpp#734):
303304

304305
- **Module names.** A plugin names its build-program modules
305306
`mcpp.<namespace>.*` after its own namespace (`mcpp.acme.protobuf`). The second
@@ -310,15 +311,20 @@ this index (mcpp#734):
310311
(`tests/check_reserved_namespace.lua`). Modules the package also offers to
311312
programs follow the library rule, `<namespace>.<name>.*` (mcpp SPEC-008 I3).
312313
- **The manifest.** The official general library is reached through the feature
313-
`plugins-core`. A plugin built on it depends on `mcpp.plugins` with
314-
`host-module = true` and `features = ["plugins-core"]`, and adds
315-
`reexport = true` when its consumers' build programs import the library
316-
themselves:
314+
`plugins-core`. What a plugin's own modules import is in its
315+
`[dependencies]`: a plugin built on the library depends on `mcpp.plugins`
316+
with `features = ["plugins-core"]`, and adds `reexport = true` when its
317+
consumers' build programs import the library themselves (mcpp 2026.10.11.1+,
318+
mcpp#797):
317319

318320
```toml
319-
[build-dependencies.mcpp]
320-
plugins = { version = "0.17.0", features = ["plugins-core"], host-module = true, reexport = true }
321+
[dependencies.mcpp]
322+
plugins = { version = "0.17.0", features = ["plugins-core"], reexport = true }
321323
```
324+
325+
The same entry in `[build-dependencies]` with `host-module = true`, the
326+
spelling before 2026.10.11.1, is read as a dependency of the plugin as well
327+
and reported as deprecated; mcpp 2027.1 no longer reads it.
322328
- **The engine floor.** The package states the first mcpp release it needs,
323329
`[package] mcpp = ">=<release>"`; an older engine stops and names the upgrade.
324330
A plugin that reads the build information (the resolved tools, `mcpp::report`)

‎docs/zh/package-types.md‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,22 +275,25 @@ protobuf 最经典的坑——在这里**语法上无法表达**。`mcpp build -
275275
## I. 构建插件包(`mcpp.plugins`)
276276

277277
构建插件是其模块由消费方 `build.mcpp` 导入的包:它的单元导入 `mcpp.core`(也写作 `mcpp`),
278-
经带 `host-module = true` 的 `[build-dependencies]` 边到达消费方。进入本索引需满足三条规则
279-
(mcpp#734):
278+
经 `[build-dependencies]` 边到达消费方,该边把包的库交给构建程序(`host-module = true` 显式写出
279+
这一点)。进入本索引需满足三条规则(mcpp#734):
280280

281281
- **模块名。** 插件以自身命名空间为其构建程序模块命名:`mcpp.<namespace>.*`(例如
282282
`mcpp.acme.protobuf`)。第二段 `core`、`plugins`、`deps`、`rules`、`dist`、`tools` 属于 mcpp
283283
项目。其他包使用它们时引擎给出警告(mcpp SPEC-007 §9);构建输出含该警告的成员在
284284
`tests/run_members.sh` 中失败,lint 拒绝与之同名的命名空间(`tests/check_reserved_namespace.lua`)。
285285
包同时提供给程序的模块遵循库的规则 `<namespace>.<name>.*`(mcpp SPEC-008 I3)。
286-
- **清单。** 官方通用库经 feature `plugins-core` 提供。基于它的插件以 `host-module = true` 与
287-
`features = ["plugins-core"]` 依赖 `mcpp.plugins`;其消费方的构建程序也直接导入该库时,再加
288-
`reexport = true`:
286+
- **清单。** 官方通用库经 feature `plugins-core` 提供。插件自身模块导入的东西写在它的
287+
`[dependencies]` 中:基于该库的插件以 `features = ["plugins-core"]` 依赖 `mcpp.plugins`;其消费方
288+
的构建程序也直接导入该库时,再加 `reexport = true`(mcpp 2026.10.11.1+,mcpp#797):
289289

290290
```toml
291-
[build-dependencies.mcpp]
292-
plugins = { version = "0.17.0", features = ["plugins-core"], host-module = true, reexport = true }
291+
[dependencies.mcpp]
292+
plugins = { version = "0.17.0", features = ["plugins-core"], reexport = true }
293293
```
294+
295+
2026.10.11.1 之前的写法,即在 `[build-dependencies]` 中写同一条目并带 `host-module = true`,也被读作
296+
插件的依赖并报告为已弃用;mcpp 2027.1 起不再读取。
294297
- **引擎下限。** 包以 `[package] mcpp = ">=<release>"` 写明所需的最早 mcpp 版本;更旧的引擎停止并
295298
写出升级方式。读取构建信息(解析出的工具、`mcpp::report`)的插件需要 2026.9.28.3。
296299

0 commit comments

Comments
 (0)