From 89a5bb8a3756fd4172713a87757e1a45982a64f3 Mon Sep 17 00:00:00 2001 From: Kayshen-X Date: Tue, 5 May 2026 12:32:03 +0800 Subject: [PATCH] fix(shell-native): enable winit Linux backends + LF line endings for cross-OS CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two unrelated CI failures on the P0 probe gate matrix, fixed together because both gate the same workflow: 1. ubuntu-latest: winit 0.30 with `default-features = false` triggers `compile_error!("The platform you're compiling for is not supported by winit")` because no Linux backend (`x11` / `wayland`) is enabled. Adds explicit `["x11", "wayland", "wayland-csd-adwaita", "rwh_06"]` features so the prod skeleton dep compiles on every desktop OS. macOS / Windows backends auto-activate via `cfg(target_os)`, so they don't need explicit features. 2. windows-latest: `cargo fmt --check` failed with `Incorrect newline style` — actions/checkout normalized .rs files to CRLF on the Windows runner, but rustfmt.toml pins `newline_style = "Unix"`. Adds `.gitattributes` enforcing `eol=lf` on all text (and explicit `*.rs` / `*.toml`) so checkouts stay LF on every platform. Both fixes are minimal and scoped to the P0 probe gate. The transient dev-dep block (skia-safe / glutin / glow / etc.) is unchanged. --- .gitattributes | 22 ++++++++++++++++++++++ crates/openpencil-shell-native/Cargo.toml | 9 ++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..180c83fe3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Force LF on all text files when checking out (so cross-OS rustfmt +# `newline_style = "Unix"` stays green on Windows runners). Without this +# Windows checkout normalizes to CRLF, breaking `cargo fmt --all -- --check`. +* text=auto eol=lf + +# Rust sources must remain LF — explicit override. +*.rs text eol=lf +*.toml text eol=lf + +# Binary files Git should not touch. +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.webp binary +*.ico binary +*.icns binary +*.pdf binary +*.zip binary +*.gz binary +*.tar binary +*.bin binary diff --git a/crates/openpencil-shell-native/Cargo.toml b/crates/openpencil-shell-native/Cargo.toml index a3c60950c..da18b8e08 100644 --- a/crates/openpencil-shell-native/Cargo.toml +++ b/crates/openpencil-shell-native/Cargo.toml @@ -22,8 +22,15 @@ openpencil-shell-core = { path = "../openpencil-shell-core", version = "0.1.0" } # 原因:Rust 1.80 toolchain (rust-toolchain.toml) 对 home/hashbrown 等 crate 当前 # 版本的 edition2024 / MSRV 1.81+ 需求不兼容,加完整依赖会导致下载阶段失败。 # 详见提交说明 + Phase 1 Gate codex review。 +# +# winit features 说明:on Linux 必须显式开 `x11` 和/或 `wayland`,否则 +# `platform_impl/mod.rs` 触发 `compile_error!("The platform you're compiling for is +# not supported by winit")`. macOS / Windows 各自的 backend 通过 cfg(target_os) +# 默认启用,不需要 feature flag。Step 1a 只在三大桌面 OS 跑 CI,所以同时打开 +# x11 + wayland 两个 Linux backend 就够。Stage F 真正接 RenderBackend 时会 +# 重新审视(可能加 `serde` / `rwh_06` 等)。 [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -winit = { version = "0.30", default-features = false } +winit = { version = "0.30", default-features = false, features = ["x11", "wayland", "wayland-csd-adwaita", "rwh_06"] } # TRANSIENT (Step 1a P0 CI gate only — reverted after notes commit, before Task 1 starts). # These deps power `examples/p0_probe.rs` + `tests/p0_probe.rs` (gated `#[ignore = "P0_PROBE_GATE"]`).