88| ------| -------| -------| ---------| ------|
99| self-host | ✅ | ✅ | ✅ | — |
1010| ` mcpp test ` (unit) | ✅ | ✅ | ❌ | 缺 clang-scan-deps |
11- | E2E 覆盖 | 46/46 | 33/46 | 22/49 | 27 项 skip |
11+ | E2E 覆盖 | 46/46 | 33/46 | 22/48 | 26 项 skip |
1212| ` mcpp pack ` | ✅ (musl static) | ✅ (手动) | ❌ (CI 手写 zip) | pack 不支持 PE |
13- | release workflow | ✅ | ✅ | ❌ | 无 build-windows job |
13+ | release workflow | ✅ | ✅ | ✅ | build-windows job 已加 |
1414| MSVC 工具链 | N/A | N/A | 模型预留 | detect 不支持 |
1515| 默认工具链回退 | gcc@15.1.0-musl | llvm@20.1.7 | llvm@20.1.7 | ✅ 已修 |
1616
1717## 优化方案(按优先级)
1818
19- ### P0: 补齐 release workflow + 减少 E2E skip
19+ ### P0: 补齐 release workflow + 减少 E2E skip — DONE
2020
2121** 目标:** Windows 二进制进入正式 release 发布流程。
2222
23- #### 1. release.yml 加 build-windows job
23+ #### 1. release.yml 加 build-windows job — DONE
2424
25- 参照 ` build-macos ` 结构,在 ` release.yml ` 中增加 ` build-windows ` job:
26-
27- ``` yaml
28- build-windows :
29- name : build (Windows / x64)
30- runs-on : windows-latest
31- needs : build-release
32- # xlings install mcpp → mcpp build → package zip → upload
33- ```
34-
35- 产出 ` mcpp-<version>-windows-x86_64.zip ` + sha256,上传到 GitHub Release。
25+ ` release.yml ` 中已有 ` build-windows ` job,产出 ` mcpp-<version>-windows-x86_64.zip ` + sha256,上传到 GitHub Release。
3626
3727#### 2. 修复高价值 E2E skip 项
3828
@@ -50,63 +40,15 @@ build-windows:
5040
5141** 预计可把 E2E 从 22 passed 提升到 ~ 30 passed。**
5242
53- ### P1: PlatformTraits 抽象
43+ ### P1: PlatformTraits 抽象 — DONE (infrastructure)
5444
5545** 目标:** 减少散落的 ` #if defined(_WIN32) ` / ` #if defined(__APPLE__) ` 。
5646
57- 新建 ` src/platform.cppm ` ,集中平台差异:
58-
59- ``` cpp
60- export module mcpp.platform;
61- import std;
62-
63- export namespace mcpp ::platform {
64-
65- constexpr std::string_view exe_suffix =
66- #if defined(_ WIN32)
67- ".exe";
68- #else
69- "";
70- #endif
71-
72- constexpr std::string_view static_lib_ext =
73- #if defined(_ WIN32)
74- ".lib";
75- #else
76- ".a";
77- #endif
78-
79- constexpr std::string_view shared_lib_ext =
80- #if defined(_ WIN32)
81- ".dll";
82- #elif defined(__ APPLE__ )
83- ".dylib";
84- #else
85- ".so";
86- #endif
87-
88- constexpr std::string_view null_redirect =
89- #if defined(_ WIN32)
90- "2>nul";
91- #else
92- "2>/dev/null";
93- #endif
94-
95- constexpr std::string_view lib_prefix =
96- #if defined(_ WIN32)
97- "";
98- #else
99- "lib";
100- #endif
101-
102- std::string shell_quote(std::string_view s); // 取代散落的 shq
103-
104- } // namespace mcpp::platform
105- ```
47+ ` src/platform.cppm ` 已创建,集中平台差异(exe_suffix、lib_prefix、null_redirect、shell_quote 等)。
10648
107- **受益文件:** `plan.cppm`、`flags.cppm`、`ninja_backend.cppm`、`probe.cppm`、`clang.cppm`、`config.cppm`
49+ ** 受益文件:** ` plan.cppm ` 、` flags.cppm ` 、` ninja_backend.cppm ` 、` probe.cppm ` 、` clang.cppm ` 、` config.cppm ` (待各文件迁移到 ` mcpp::platform ` 命名空间)
10850
109- ### P2: ToolchainProvider 重构
51+ ### P2: ToolchainProvider 重构 — TODO (src/provider.cppm 待创建)
11052
11153** 目标:** 把工具链行为从散落的 ` if (isClang) ` / ` if (isGcc) ` 收敛到 provider 接口。
11254
@@ -139,39 +81,17 @@ ToolchainProvider (interface)
13981- ` link_flags() ` → 平台相关链接 flags
14082- ` bmi_traits() ` → .gcm/.pcm/.ifc
14183
142- ### P3: 跨平台 Process Runner
84+ > ** 注: ** ` src/provider.cppm ` 尚未创建;现有调用者(gcc.cppm、clang.cppm 等)待迁移。
14385
144- **目标:** 消除 shell 字符串拼接,统一子进程执行。
86+ ### P3: 跨平台 Process Runner — DONE (infrastructure, callers pending)
14587
146- 当前问题:
147- - `popen` + cmd.exe 字符串拼接(路径空格、引号转义脆弱)
148- - `shq()` 在 Windows 上有 cmd.exe 首 token 引号剥离问题
149- - `_putenv_s` 污染全局进程环境
150-
151- 建议新建 `src/process.cppm`:
152-
153- ```cpp
154- struct ProcessOptions {
155- std::vector<std::string> argv;
156- std::map<std::string, std::string> env; // 进程级环境变量
157- std::filesystem::path cwd;
158- bool capture_stdout = true;
159- bool capture_stderr = false;
160- };
161-
162- struct ProcessResult {
163- int exit_code;
164- std::string stdout_output;
165- std::string stderr_output;
166- };
167-
168- ProcessResult run(const ProcessOptions& opts);
169- ```
88+ ** 目标:** 消除 shell 字符串拼接,统一子进程执行。
17089
171- POSIX: ` fork/exec ` + ` pipe `
172- Windows: ` CreateProcessW ` + ` STARTUPINFOW `
90+ ` src/process.cppm ` 已创建,提供 ` ProcessOptions ` / ` ProcessResult ` / ` run() ` 接口:
91+ - POSIX: ` fork/exec ` + ` pipe `
92+ - Windows: ` CreateProcessW ` + ` STARTUPINFOW `
17393
174- ** 受益范围 :** ` probe.cppm ` 、` xlings.cppm ` 、` stdmod.cppm ` 、` ninja_backend.cppm ` 、` config.cppm `
94+ > ** 注 :** 现有调用点( ` probe.cppm ` 、` xlings.cppm ` 、` stdmod.cppm ` 、` ninja_backend.cppm ` 、` config.cppm ` )仍使用 ` popen ` ,待逐步迁移到 ` process::run() ` 。
17595
17696### P4: ` mcpp pack ` Windows 支持
17797
@@ -196,45 +116,50 @@ PackStrategy (interface)
196116 └── WindowsPePack — dumpbin + zip + .bat
197117```
198118
199- ### P5: E2E 能力标签化
119+ ### P5: E2E 能力标签化 — DONE (infrastructure)
200120
201121** 目标:** 从"平台 skip 列表"升级为"能力标签"。
202122
203- 在每个 E2E 脚本头部声明需求:
123+ 能力标签体系已全面落地:
124+ - 全部 48 个 E2E 脚本头部均已声明 ` # requires: ` 行
125+ - ` run_all.sh ` 自动检测平台能力(elf、gcc、musl、pack、symlink、scan-deps、import-std-libcxx、unix-shell、fresh-sandbox)并动态 skip
126+ - 不再维护平台 skip 列表
127+
128+ 支持的标签:
204129
205130``` bash
206131# requires: elf — 需要 ELF 工具链
207132# requires: gcc — 需要 GCC
208- # requires: symlink — 需要 ln -sf
133+ # requires: symlink — 需要 ln -sf(仅 Linux/macOS 或 Windows Developer Mode)
209134# requires: scan-deps — 需要 clang-scan-deps
210- # requires: import-std — 需要 import std (std.cppm/std.ixx )
135+ # requires: import-std-libcxx — 需要 import std (std.cppm via libc++ )
211136# requires: pack — 需要 mcpp pack
137+ # requires: unix-shell — 需要 bash 风格 shell(非 cmd.exe)
138+ # requires: fresh-sandbox — 需要隔离 MCPP_HOME
212139```
213140
214- ` run_all.sh ` 读取标签,根据当前平台的能力集决定 skip,不再维护平台 skip 列表。
215-
216141## 实施顺序
217142
218143```
219- P0 release + E2E 修复 ← 立即可做,产出最大
144+ P0 release + E2E 修复 ✅ DONE(release.yml build-windows job 已加)
220145 ↓
221- P1 PlatformTraits ← 减少 #if 散落,降低后续维护成本
146+ P1 PlatformTraits ✅ DONE(src/platform.cppm 已创建,待调用者迁移)
222147 ↓
223- P2 ToolchainProvider ← 为 MSVC 支持打基础
148+ P2 ToolchainProvider ← src/provider.cppm 待创建 + 调用者迁移
224149 ↓
225- P3 Process Runner ← 消除 shell 拼接风险
150+ P3 Process Runner ✅ DONE(src/process.cppm 已创建,待调用者迁移)
226151 ↓
227152P4 mcpp pack Windows ← 产品化打包
228153 ↓
229- P5 E2E 标签化 ← 测试治理
154+ P5 E2E 标签化 ✅ DONE(全部 48 个测试已标签化)
230155```
231156
232157## 预期里程碑
233158
234159| 阶段 | 目标 | Windows E2E 通过率 |
235160| ------| ------| -------------------|
236- | 当前 | self-host + 基础 E2E | 22/49 (45 %) |
237- | P0 完成 | release + 高价值 E2E | ~ 30/49 (61 %) |
238- | P1+P2 完成 | 平台抽象 + provider | ~ 35/49 (71 %) |
239- | P3+P4 完成 | process runner + pack | ~ 40/49 (82 %) |
161+ | 当前 | self-host + 基础 E2E | 22/48 (46 %) |
162+ | P0 完成 | release + 高价值 E2E | ~ 30/48 (63 %) |
163+ | P1+P2 完成 | 平台抽象 + provider | ~ 35/48 (73 %) |
164+ | P3+P4 完成 | process runner + pack | ~ 40/48 (83 %) |
240165| P5 完成 | 能力标签 | 动态评估 |
0 commit comments