chore: 三个包归到正确的命名空间(grpc:grpc / grpc:grpc-plugin / mcpplibs:grpcgen) - #2
Merged
Conversation
gRPC 运行时与 codegen 插件都是上游代码(`plugin/src/compiler/*` 逐个文件都是
`Copyright 2015 gRPC authors`),却发布在 `mcpplibs` 下 —— 而 `mcpplibs` 是 mcpp
的默认命名空间,不是"上游是谁"的答案。索引里 `nlohmann.json`、`fmtlib.fmt`、
`chriskohlhoff.asio`、`godotengine.godot-cpp-m` 早就是按上游 org 命名的;
`godotengine.godot-cpp-m` 尤其说明问题:它的 tarball 也归 mcpplibs 所有,形态与
`mcpplibs.imgui` 完全相同,命名空间却相反 —— 这条规则从来没有被定下来过。
于是:
grpc:grpc 上游 grpc/grpc gRPC 运行时
grpc:grpc-plugin 上游 src/compiler/* grpc_cpp_plugin
mcpplibs:grpcgen 本仓库自己写的 163 行 构建规则(host module)
版本号保持 1.83.0 不变 —— 它本来就与上游 gRPC 对齐,而这正是同一条规范要求的。
代价已核实并写进文档:`dep_spec.cppm` 的裸名梯级写死为
`(mcpplibs, X) → (compat, X) → (∅, X)`,`kDefaultNamespace = "mcpplibs"`,所以
搬出去之后裸名够不到,运行时与插件必须写限定形式。`grpcgen` 留在默认命名空间,
仍可裸写。这不算损失:限定名把「这是谁的库」写进了依赖声明本身。
改动面是 README(两份)、模板的 mcpp.toml.in 与设计文档。examples 用的是 path
依赖,不涉及命名空间,因此不动;`template-matches-example` 只比对 build.mcpp,
本次未触及。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
判据
命名空间说的是这个库是谁的,不是谁打的包。
grpcsrc/+include/grpcgrpc-pluginsrc/compiler/*Copyright 2015 gRPC authors,Apache-2.0grpcgrpcgenrules/src/grpcgen.cppm,163 行,上游没有对应物mcpplibsmcpplibs是 mcpp 的默认命名空间(kDefaultNamespace = "mcpplibs"),不是"上游是谁"的答案。索引里nlohmann.json、fmtlib.fmt、chriskohlhoff.asio、godotengine.godot-cpp-m早就按上游 org 命名。最能说明问题的是
godotengine.godot-cpp-m:它的 tarball 同样归 mcpplibs 所有、同样是上游之上的 module 层 —— 形态与mcpplibs.imgui完全相同,命名空间却相反。这条规则从来没有被定下来过,是逐 PR 决定的。版本号不动
1.83.0本来就与上游 gRPC 对齐,而这正是同一条规范的另一半要求。索引里其余几个包(imgui@0.0.6包的是 ImGui 1.92.8、opencv@0.0.10包的是 OpenCV 5.0.0)才是需要修的,另行处理。已核实的代价
src/pm/dep_spec.cppm:裸名梯级是
(mcpplibs, X) → (compat, X) → (∅, X),其他命名空间裸名一律够不到。所以:我考虑过给 mcpp 加一条可配置的裸名搜索路径(
dep_spec.cppm的注释确实指向这个方向),结论是不加:用户既然都要声明命名空间了,grpc.grpc = "1.83.0"比"声明一条搜索路径 + 再写裸名"更短,而且把「这是谁的库」写进了依赖声明本身。改动面
README(两份)、
templates/greeter/mcpp.toml.in、设计文档。examples/用的是path依赖,不涉及命名空间;template-matches-example只比对build.mcpp,本次未触及。索引侧的三个描述符在 mcpp-index 另开 PR,需要本 PR 合入后的新 tag(已发布的
v1.83.0归档里没有plugin/与rules/,而索引对它的 sha256 已生效,移动 tag 会废掉它)。