build.rs 1.0 KB

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