From 7bff64e47776585f648cc598980a7c47ecb0a453 Mon Sep 17 00:00:00 2001 From: JoeAllen <2494136784@qq.com> Date: Wed, 30 Sep 2026 13:09:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(build):=20build.rs=20=E7=94=A8=20cfg=20?= =?UTF-8?q?=E9=97=A8=E6=8E=A7=20embed=5Fresource=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20Linux=20=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit embed_resource 只声明在 Windows 的 build-dependencies,Linux 编译 build script 时模块路径无法解析(CI Test job 首跑即暴露:旧 Gitea runner 从未真正跑过流水线,此问题一直潜伏)。运行时 env 判断无效, 改用 #[cfg(target_os = "windows")] 编译期门控。 --- gpui-app/build.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gpui-app/build.rs b/gpui-app/build.rs index 08c33ee..7395937 100644 --- a/gpui-app/build.rs +++ b/gpui-app/build.rs @@ -5,7 +5,10 @@ //! 缺失时任务栏与资源管理器显示系统默认图标。 fn main() { - if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") { + // embed_resource 仅声明在 Windows 的 build-dependencies:必须用 cfg 门控, + // 否则 Linux/macOS 编译 build script 时该路径无法解析(运行时 env 判断救不了编译期) + #[cfg(target_os = "windows")] + { println!("cargo:rerun-if-changed=resources/app.rc"); println!("cargo:rerun-if-changed=resources/icon.ico"); embed_resource::compile("resources/app.rc", embed_resource::NONE)