Skip to content

Commit 856a292

Browse files
committed
feat: e2e 99 msvc native build, 95 gate-flip, mingw polish, 0.0.90 version/docs
- e2e 99 (requires: msvc): default msvc → modules build/run → import std → incremental; 95's build-gate assertion flips to a real build+run; the ci-windows MSVC step now drives 99. - mingw: windows-only guard with a clear message (was 'invalid xpkg target xim:mingw-gcc@'); e2e 97 objdump path unhardcoded; doctor gains Windows SDK + mingw sections. - release.yml publish-ecosystem timeout 20→30 (backstop for the fixed mirror script's worst case). - version 0.0.90 + CHANGELOG + docs/03 MSVC build section.
1 parent c40f0d7 commit 856a292

11 files changed

Lines changed: 162 additions & 26 deletions

File tree

.github/workflows/ci-windows.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,11 @@ jobs:
254254
"$MCPP_SELF" self doctor 2>&1 | tee doctor.txt || true
255255
grep -qi "msvc" doctor.txt
256256
257-
# native cl.exe builds are gated with one owned message
258-
"$MCPP_SELF" new hello_msvc && cd hello_msvc
259-
set +e
260-
bout=$("$MCPP_SELF" build 2>&1); brc=$?
261-
set -e
262-
echo "$bout"
263-
test $brc -ne 0
264-
grep -q "not yet supported" <<<"$bout"
257+
# native cl.exe build: full e2e (modules, import std, incremental)
258+
cd "$GITHUB_WORKSPACE"
259+
MCPP="$MCPP_SELF" bash tests/e2e/99_msvc_native_build.sh
265260
266261
# restore the LLVM default for the remaining steps
267-
cd "$GITHUB_WORKSPACE"
268262
"$MCPP_SELF" toolchain default llvm@20.1.7
269263
270264
- name: "Toolchain: LLVM — build mcpp (self-host)"

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,10 @@ jobs:
708708
needs: [build-release, build-linux-aarch64, build-macos, build-windows]
709709
runs-on: ubuntu-latest
710710
# A4 hardening: a single stuck upload once held this job >1h (6h default
711-
# ceiling). The mirror script now has per-file timeouts, so 20min is ample.
712-
timeout-minutes: 20
711+
# ceiling). The mirror script has per-file timeouts and (post-0.0.89)
712+
# batch-upload + ranged-GET verification — normal runs are minutes; 30
713+
# is the generous backstop (20 was hit by the old per-asset verify loop).
714+
timeout-minutes: 30
713715
env:
714716
XLINGS_RES_TOKEN: ${{ secrets.XLINGS_RES_TOKEN }}
715717
GITCODE_TOKEN: ${{ secrets.GITCODE_TOKEN }}

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,42 @@
33
> 本文件追踪 `mcpp-community/mcpp` 公开仓的版本演进。
44
> 格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)
55
6+
## [0.0.90] — 2026-07-13
7+
8+
### 新增
9+
10+
- **MSVC 原生构建后端(cl.exe)落地,0.0.88 的构建门移除**。选定 `msvc@system`
11+
`mcpp build/run` 直接用系统 MSVC 编译链接:
12+
- 环境模型:`find_windows_sdk()` + 从检测到的 VC tools/SDK 直接合成
13+
INCLUDE/LIB/PATH(+`VSLANG=1033`),不跑 vcvarsall;SDK 缺失时检测/选择仍可用,
14+
构建报带指引的明确错误;doctor 新增 SDK 与 mingw 检查行。
15+
- 模块管线:std/std.compat.ixx 单命令 staging(`/ifcOutput` → ifc.cache),
16+
命名模块 `.cppm``/interface /TP` 编译、`/ifcSearchDir` 消费;
17+
`/scanDependencies` 作为第三个编译器内建 P1689 扫描驱动接入 dyndep。
18+
- 链接:link.exe/lib.exe(SeparateLinker)+ 响应文件(绕 cmd 8191 限制),
19+
DLL=`/DLL /IMPLIB:`;`deps=msvc`(/showIncludes)头文件依赖;`/MD|/MT` CRT
20+
随 linkage;`/std:c++20|c++latest` 映射;`.obj` 扩展名全链路。
21+
- fast-path 增量:构建缓存 env 槽新增 `@env` 多变量编码,增量构建重建
22+
INCLUDE/LIB 环境。e2e 99(模块/import std/增量)+ 95 改造为真实构建断言。
23+
- **`[build] dialect_cxxflags` + 方言旗标全图化(issue #210 修复)**
24+
`-freflection` 等"改变标准库头声明集"的 flag 现随 `-std=` 的通道到达:
25+
全局 cxxflags(项目+依赖所有 TU)、std/std.compat BMI 预构建命令、P1689 扫描。
26+
known-list 自动提升(reflection/contracts/char8_t/`_GLIBCXX_USE_CXX11_ABI`)+
27+
显式 `dialect_cxxflags` 逃生舱;指纹早已包含这些 flag,修的是命令构造。
28+
实证:#210 的最小复现(gcc16 + `import std;` + `std::meta`)输出 `x 2/y 3`;
29+
e2e 98 含依赖模块变体。
30+
31+
### 修复与优化
32+
33+
- mingw 在非 Windows 主机的 `toolchain install/default` 现在明确报
34+
windows-only(此前是 `invalid xpkg target 'xim:mingw-gcc@'`)。
35+
- std 模块 staging 命令在 Windows 用 `cd /d`(跨盘;工作区 D: + 缓存 C: 的
36+
真实 CI 布局)。
37+
- release 的 publish-ecosystem:镜像脚本改为批量上传+带耐心的 ranged-GET 验证、
38+
**验证超时不再删除资产**(0.0.89 因逐资产"18s 即删重传"+全量 GET 探测触顶
39+
20min 被杀);timeout 兜底 20→30。
40+
- stdmod 执行层支持工具链声明环境(capture_with_env);shell 引用平台化。
41+
642
## [0.0.89] — 2026-07-13
743

844
### 新增

docs/03-toolchains.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,14 @@ windows = "msvc@system"
132132
newest installed VC tools, but errors if the detected version doesn't match
133133
the prefix.
134134

135-
> [!NOTE]
136-
> Selection and detection are supported today; **building with native MSVC
137-
> (cl.exe) is not yet supported**`mcpp build` fails with a clear message
138-
> naming the detected version. For building on Windows use the MSVC-ABI Clang
139-
> toolchain: `mcpp toolchain default llvm@20.1.7` (it borrows the MSVC STL
140-
> from the same detected installation).
135+
Since 0.0.90, **native cl.exe builds work**: mcpp synthesizes the
136+
INCLUDE/LIB environment from the detected VC tools + Windows SDK (no
137+
`vcvarsall` involved), stages `std.ixx`/`std.compat.ixx` as `.ifc` BMIs,
138+
compiles `.cppm` module units via `/interface /TP /ifcOutput`, scans with
139+
`/scanDependencies`, and links with `link.exe`/`lib.exe` through response
140+
files. `[build] linkage = "static"` selects the `/MT` CRT. A missing Windows
141+
SDK fails the build with installation guidance (`mcpp self doctor` reports
142+
SDK status).
141143

142144
## Project-Level Version Pinning
143145

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

src/doctor.cppm

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,34 @@ export int doctor_report() {
120120
warn("msvc not detected — run `mcpp toolchain default msvc` for "
121121
"setup guidance (mcpp does not install MSVC)");
122122
}
123+
// Windows SDK (native cl.exe builds need its UCRT/um headers).
124+
if (auto sdk = mcpp::toolchain::msvc::find_windows_sdk()) {
125+
ok(std::format("Windows SDK {} at {}", sdk->version,
126+
sdk->root.string()));
127+
} else {
128+
warn("no Windows SDK found — native msvc builds will fail "
129+
"(install the 'Windows 11 SDK' VS component)");
130+
}
131+
132+
mcpp::ui::status("Checking", "mingw (xim:mingw-gcc)");
133+
{
134+
auto pkgs = std::filesystem::path(
135+
std::getenv("MCPP_HOME") ? std::getenv("MCPP_HOME")
136+
: (std::string(std::getenv("USERPROFILE")
137+
? std::getenv("USERPROFILE") : "") + "\\.mcpp"))
138+
/ "registry" / "data" / "xpkgs" / "xim-x-mingw-gcc";
139+
std::error_code ec;
140+
bool any = false;
141+
if (std::filesystem::exists(pkgs, ec)) {
142+
for (auto& v : std::filesystem::directory_iterator(pkgs, ec)) {
143+
if (!v.is_directory(ec)) continue;
144+
ok(std::format("mingw {} installed", v.path().filename().string()));
145+
any = true;
146+
}
147+
}
148+
if (!any)
149+
ok("mingw not installed (optional — `mcpp toolchain install mingw 16.1.0`)");
150+
}
123151
}
124152

125153
mcpp::ui::status("Checking", "std module");

src/toolchain/fingerprint.cppm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import mcpp.toolchain.detect;
1818

1919
export namespace mcpp::toolchain {
2020

21-
inline constexpr std::string_view MCPP_VERSION = "0.0.89";
21+
inline constexpr std::string_view MCPP_VERSION = "0.0.90";
2222

2323
struct FingerprintInputs {
2424
Toolchain toolchain;

src/toolchain/lifecycle.cppm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,18 @@ int msvc_wrong_host() {
183183
return 1;
184184
}
185185

186+
// MinGW is a Windows-native toolchain package; on other hosts fail with a
187+
// clear message instead of the confusing empty-version xim error
188+
// (`invalid xpkg target 'xim:mingw-gcc@'`).
189+
bool mingw_wrong_host(const mcpp::toolchain::XimToolchainPackage& pkg) {
190+
if (pkg.ximName == "mingw-gcc" && !mcpp::platform::is_windows) {
191+
mcpp::ui::error("mingw is a Windows-only toolchain (MinGW-w64 GCC); "
192+
"on this host use gcc/llvm instead");
193+
return true;
194+
}
195+
return false;
196+
}
197+
186198
void msvc_print_detected(const mcpp::toolchain::msvc::MsvcInstallation& inst) {
187199
mcpp::ui::status("Detected", std::format(
188200
"msvc {}{} (VC tools {})",
@@ -370,6 +382,7 @@ export int toolchain_install(const mcpp::config::GlobalConfig& cfg,
370382
}
371383

372384
auto pkg = mcpp::toolchain::to_xim_package(*spec);
385+
if (mingw_wrong_host(pkg)) return 1;
373386

374387
// Partial-version resolution: `gcc 15` → highest available 15.x.y in
375388
// the synced index. Empty version → latest of any major.
@@ -490,6 +503,7 @@ export int toolchain_set_default(const mcpp::config::GlobalConfig& cfg,
490503
}
491504

492505
auto pkg = mcpp::toolchain::to_xim_package(*spec);
506+
if (mingw_wrong_host(pkg)) return 1;
493507

494508
// Partial-version resolution against installed payloads.
495509
if (auto picked = resolve_version_match(

tests/e2e/95_msvc_system_toolchain.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ out=$("$MCPP" toolchain install msvc 2>&1) \
5858
[[ "$out" == *"already installed"* ]] \
5959
|| { echo "FAIL: install msvc message: $out"; exit 1; }
6060

61-
# 5) native cl.exe builds are gated with one owned message
61+
# 5) native cl.exe builds WORK (0.0.90; the 0.0.88 gate is gone) — the full
62+
# modules/import-std flow is covered by 99_msvc_native_build.sh; here we
63+
# assert the basic hello builds and runs under msvc@system.
6264
"$MCPP" new hello_msvc >/dev/null 2>&1
6365
cd hello_msvc
64-
rc=0; out=$("$MCPP" build 2>&1) || rc=$?
65-
[[ $rc -ne 0 ]] || { echo "FAIL: build should be gated"; exit 1; }
66-
[[ "$out" == *"not yet supported"* ]] || { echo "FAIL: gate message: $out"; exit 1; }
67-
[[ "$out" == *"llvm@20.1.7"* ]] || { echo "FAIL: no alternative hint: $out"; exit 1; }
66+
out=$("$MCPP" run 2>&1) || { echo "FAIL: msvc hello build/run: $out"; exit 1; }
67+
[[ "$out" == *"Hello"* || "$out" == *"hello"* ]] \
68+
|| { echo "FAIL: hello output: $out"; exit 1; }
6869

69-
echo "PASS: msvc@system detection, selection, guidance, and build gate"
70+
echo "PASS: msvc@system detection, selection, guidance, and native build"

tests/e2e/97_mingw_toolchain.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ run_out=$("$MCPP" run 2>&1) || { echo "FAIL: run: $run_out"; exit 1; }
6464
# it must run from a clean dir without the toolchain bin on PATH.
6565
EXE=$(find target -name "hello_mingw.exe" -path "*/bin/*" | head -1)
6666
[[ -n "$EXE" ]] || { echo "FAIL: no exe produced"; exit 1; }
67-
OBJDUMP="${MCPP_HOME:-$HOME/.mcpp}/registry/data/xpkgs/xim-x-mingw-gcc/16.1.0/bin/objdump.exe"
67+
OBJDUMP=$(ls "${MCPP_HOME:-$HOME/.mcpp}"/registry/data/xpkgs/xim-x-mingw-gcc/*/bin/objdump.exe 2>/dev/null | head -1)
6868
imports=""
6969
if [[ -x "$OBJDUMP" ]]; then
7070
imports=$("$OBJDUMP" -p "$EXE" 2>/dev/null | grep -i "DLL Name" || true)

0 commit comments

Comments
 (0)