Skip to content

Commit aeb7a05

Browse files
committed
manifest+docs: the recommended spelling is the namespace on the key, and the advisory teaches it
An entry names a package and then says which version of it, so the namespace belongs to the name: "xim:picolibc-riscv" = "1.8.12". Official packages use that form. The advisory for the superseded deps key suggested the other one. That form is accepted and is what the materialised .xlings.json carries — a key there is an xvm target and the scope qualifies the version — but it is the file's vocabulary, not the author's. A suggestion is copied, so one that teaches the non-recommended form pushes the convention the wrong way. XlingsEntry::authored_line is the recommended spelling and the advisory's only source for it, so the message and the documentation cannot drift. docs/05 states the form and why the other is still accepted; docs/13 and the project-subos example follow. Both languages. Parsing is unchanged, and so is the materialised file.
1 parent e9fdf57 commit aeb7a05

12 files changed

Lines changed: 83 additions & 35 deletions

File tree

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33
> 本文件追踪 `mcpp-community/mcpp` 公开仓的版本演进。
44
> 格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)
55
6+
## [2026.9.3.2] — 2026-09-03
7+
8+
`[xlings.workspace]`**推荐书写形态**定为命名空间在键上,官方包全部使用它;
9+
mcpp 打印的建议行随之改成同一形态。
10+
11+
```toml
12+
[xlings.workspace]
13+
"xim:picolibc-riscv" = "1.8.12"
14+
```
15+
16+
> **建议行是会被照抄的。** `[xlings] deps` 的替代提示此前给出的是
17+
> `picolibc-riscv = "xim:1.8.12"` —— 命名空间在版本上。那种形态仍然接受,但它是
18+
> **物化出来的文件**所用的词汇(那里的键是 xvm target,scope 限定版本),不是作者
19+
> 书写的词汇(先点名一个包,再说用它的哪个版本)。一个教人写非推荐形态的提示,会
20+
> 把约定推向它自己的反面。
21+
22+
### 变更
23+
24+
- `[xlings] deps` 的替代提示改为推荐形态,键带引号(TOML 裸键不能含冒号)。
25+
- `docs/05` §2.13 明确写出推荐形态与它的理由,并说明另一种形态为何仍然接受;
26+
`docs/13``examples/07-project-subos` 的示例改成推荐形态。中英双份。
27+
28+
行为不变:两种形态解析结果完全相同,物化出来的 `.xlings.json` 也不变。
29+
630
## [2026.9.3.1] — 2026-09-03
731

832
`[xlings]` 收敛成一张表。`[xlings.workspace]` 说出工程用哪个包、用哪个版本,mcpp

docs/05-mcpp-toml.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,11 +1870,10 @@ who can judge it is looking at the release, not at this build.
18701870

18711871
```toml
18721872
[xlings.workspace] # what this project's environment contains
1873-
cmake = "3.28"
1874-
picolibc-riscv = "xim:1.8.12" # namespace on the version
1875-
"xim:qemu-user-aarch64" = "7.2.0" # or on the key - quotes required
1876-
code = "" # present; version unconstrained
1877-
llvm = { macosx = "20", default = "22" }
1873+
cmake = "3.28"
1874+
"xim:picolibc-riscv" = "1.8.12" # a namespaced package - quotes required
1875+
code = "" # present; version unconstrained
1876+
llvm = { macosx = "20", default = "22" }
18781877
```
18791878

18801879
```toml
@@ -1900,14 +1899,20 @@ to.
19001899
| `cmake = "3.28"` | that version |
19011900
| `llvm = "22"` | the highest installed `22.*`; a version prefix resolves |
19021901
| `code = ""` | present, version unconstrained |
1903-
| `picolibc-riscv = "xim:1.8.12"` | from the `xim` index |
1904-
| `"xim:picolibc-riscv" = "1.8.12"` | the same entry, namespace written on the key |
1902+
| `"xim:picolibc-riscv" = "1.8.12"` | a package from the `xim` index |
19051903
| `llvm = { macosx = "20", default = "22" }` | per host platform |
19061904

1907-
The namespace may be written on either half. Writing it on the key requires
1908-
**quotes**, because a TOML bare key cannot contain a colon. Writing it on both
1909-
halves with different values is an error, and so is naming one package twice
1910-
under two spellings.
1905+
**A namespaced package is written `"<namespace>:<name>" = "<version>"`, and the
1906+
quotes are required** — a TOML bare key cannot contain a colon. That is the
1907+
recommended form and the one every official package uses: an entry names a
1908+
package and then says which version of it, so the namespace belongs to the
1909+
name.
1910+
1911+
The namespace is also accepted on the version (`picolibc-riscv = "xim:1.8.12"`),
1912+
because that is what the materialised `.xlings.json` carries — a key there is an
1913+
xvm target and the scope qualifies the version. Two vocabularies, one entry.
1914+
Writing it on both halves with different values is an error, and so is naming
1915+
one package twice under two spellings.
19111916

19121917
Platform keys are xlings' own — `linux`, `macosx`, `windows` — plus `default`.
19131918
`macos` and `macosx` are the same platform written in two vocabularies (mcpp's

docs/13-baremetal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ The package's manifest declares the emulator and nothing else:
671671

672672
```toml
673673
[xlings.workspace]
674-
qemu-riscv = "xim:9.2.4-1"
674+
"xim:qemu-riscv" = "9.2.4-1"
675675
```
676676

677677
Linking `clang_rt.builtins` is not optional on this board. picolibc formats

docs/zh/05-mcpp-toml.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,11 +1595,10 @@ platforms = ["linux", "macos", "windows"]
15951595

15961596
```toml
15971597
[xlings.workspace] # 这个工程的环境里有什么
1598-
cmake = "3.28"
1599-
picolibc-riscv = "xim:1.8.12" # 命名空间写在版本上
1600-
"xim:qemu-user-aarch64" = "7.2.0" # 或写在键上 —— 必须带引号
1601-
code = "" # 存在即可,版本不限
1602-
llvm = { macosx = "20", default = "22" }
1598+
cmake = "3.28"
1599+
"xim:picolibc-riscv" = "1.8.12" # 带命名空间的包 —— 必须带引号
1600+
code = "" # 存在即可,版本不限
1601+
llvm = { macosx = "20", default = "22" }
16031602
```
16041603

16051604
```toml
@@ -1622,12 +1621,16 @@ mcpp 既供给它——机器上没有就装,有就映射——也把它物化
16221621
| `cmake = "3.28"` | 该版本 |
16231622
| `llvm = "22"` | 已装的最高 `22.*`;版本前缀会被解析 |
16241623
| `code = ""` | 存在即可,版本不限 |
1625-
| `picolibc-riscv = "xim:1.8.12"` | 来自 `xim` 索引 |
1626-
| `"xim:picolibc-riscv" = "1.8.12"` | 同一条,命名空间写在键上 |
1624+
| `"xim:picolibc-riscv" = "1.8.12"` | 来自 `xim` 索引的包 |
16271625
| `llvm = { macosx = "20", default = "22" }` | 按宿主平台 |
16281626

1629-
命名空间写在哪一半都可以。写在键上**必须带引号**,因为 TOML 的裸键不能含冒号。
1630-
两半都写且不一致是错误;同一个包用两种拼法出现两次也是错误。
1627+
**带命名空间的包写成 `"<命名空间>:<名字>" = "<版本>"`,引号必需** —— TOML 的裸键
1628+
不能含冒号。这是**推荐形态,也是所有官方包使用的形态**:一条条目先点名一个包,
1629+
再说用它的哪个版本,所以命名空间属于名字。
1630+
1631+
命名空间写在版本上(`picolibc-riscv = "xim:1.8.12"`)同样接受,因为物化出来的
1632+
`.xlings.json` 里正是那种形态 —— 那里的键是 xvm target,scope 限定的是版本。
1633+
两套词汇,同一条条目。两半都写且不一致是错误;同一个包用两种拼法出现两次也是错误。
16311634

16321635
平台键是 xlings 自己的 —— `linux``macosx``windows`,外加 `default``macos`
16331636
`macosx` 是同一个平台的两套词汇(mcpp 的三元组说前者,描述符与 xlings 的项目

docs/zh/13-baremetal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ int main() {
603603

604604
```toml
605605
[xlings.workspace]
606-
qemu-riscv = "xim:9.2.4-1"
606+
"xim:qemu-riscv" = "9.2.4-1"
607607
```
608608

609609
在这块板子上链接 `clang_rt.builtins` 不是可选项。picolibc 通过 ryu 格式化浮点值,

examples/07-project-subos/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ warning: project-subos: this project's subos is populated
1919
subos = "default"
2020

2121
[xlings.workspace]
22-
qemu-riscv = "xim:9.2.4-1"
22+
"xim:qemu-riscv" = "9.2.4-1"
2323
```
2424

2525
`subos` names the environment this project builds in. mcpp already used that

examples/07-project-subos/mcpp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ subos = "default"
2727
# project uses it at. mcpp provisions it and pins it, which is why the emulator
2828
# below is both installed on the first build and the one the project resolves.
2929
[xlings.workspace]
30-
qemu-riscv = "xim:9.2.4-1"
30+
"xim:qemu-riscv" = "9.2.4-1"

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.9.3.1"
3+
version = "2026.9.3.2"
44
description = "Modern C++ build & package management tool"
55
license = "Apache-2.0"
66
authors = ["mcpp-community"]

modules/manifest/src/toml.cppm

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,20 @@ struct XlingsEntry {
212212
if (version.empty()) return {};
213213
return ns.empty() ? version : ns + ":" + version;
214214
}
215+
// The RECOMMENDED authored spelling, which is not the same thing as the
216+
// materialised one. A manifest names a package and then says which version
217+
// of it, so the namespace belongs to the package and rides the key:
218+
//
219+
// "xim:qemu-riscv" = "9.2.4-1"
220+
//
221+
// The other position is accepted and is what the file itself carries,
222+
// because a `.xlings.json` key is an xvm target and the scope there
223+
// qualifies the version. Two vocabularies, one entry; mcpp suggests the
224+
// one an author writes.
225+
std::string authored_line() const {
226+
auto key = ns.empty() ? target : std::format("\"{}:{}\"", ns, target);
227+
return std::format("{} = \"{}\"", key, version);
228+
}
215229
};
216230

217231
// The inverse: `[<ns>:]<target>[@<version>]` back into its parts. Used by the
@@ -1561,8 +1575,7 @@ std::expected<Manifest, ManifestError> parse_string(std::string_view content,
15611575
// The same statement in both tables. Not an error and not two
15621576
// entries: appending it again would ask xlings to install one
15631577
// package twice, so only the advisory below is produced.
1564-
replacement += std::format("\n {} = \"{}\"",
1565-
entry.target, entry.pin());
1578+
replacement += "\n " + entry.authored_line();
15661579
continue;
15671580
} else if (pinned != m.xlings.workspace.end()) {
15681581
auto say = [](const std::string& p) {
@@ -1575,9 +1588,8 @@ std::expected<Manifest, ManifestError> parse_string(std::string_view content,
15751588
entry.target, say(entry.pin()), say(pinned->second))));
15761589
}
15771590
m.xlings.deps.push_back(**r);
1578-
// Show the author the line to write, not merely that one exists.
1579-
replacement += std::format("\n {} = \"{}\"",
1580-
entry.target, entry.pin());
1591+
// Show the author the line to write, in the recommended spelling.
1592+
replacement += "\n " + entry.authored_line();
15811593
}
15821594
if (!replacement.empty())
15831595
m.schemaWarnings.push_back(std::format(

modules/versioning/src/version.cppm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ import std;
3131

3232
export namespace mcpp {
3333

34-
inline constexpr std::string_view MCPP_VERSION = "2026.9.3.1";
34+
inline constexpr std::string_view MCPP_VERSION = "2026.9.3.2";
3535

3636
} // namespace mcpp

0 commit comments

Comments
 (0)