fn main() { // 设置环境变量,告诉Playwright使用系统浏览器而不是下载bundled browsers println!("cargo:rustc-env=PLAYWRIGHT_BROWSERS_PATH=0"); // 跳过Chromium下载,直接使用系统Chrome println!("cargo:warning=Using system Chrome browser instead of bundled Chromium"); // 告诉Cargo重新运行这个构建脚本如果这些文件改变 println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=PLAYWRIGHT_BROWSERS_PATH"); // Invoke tauri-build to ensure Windows resources (icons, etc.) are embedded into the binary // This will read `tauri.conf.json` and process `bundle.icon` entries. // If tauri-build is unavailable this will fail at build time with a helpful message. if let Err(e) = std::panic::catch_unwind(|| { tauri_build::build() }) { // Emit a warning instead of failing hard so existing CI/output is easier to debug. println!("cargo:warning=tauri_build::build() panicked: {:?}", e); } }