| |
| |
| |
|
|
| use tauri_build::WindowsAttributes; |
|
|
| fn main() { |
| tauri_build::try_build( |
| tauri_build::Attributes::new() |
| .codegen(tauri_build::CodegenContext::new()) |
| .windows_attributes(WindowsAttributes::new_without_app_manifest()) |
| .plugin( |
| "app-menu", |
| tauri_build::InlinedPlugin::new().commands(&["toggle", "popup"]), |
| ) |
| .app_manifest(tauri_build::AppManifest::new().commands(&[ |
| "log_operation", |
| "perform_request", |
| "echo", |
| "spam", |
| ])), |
| ) |
| .expect("failed to run tauri-build"); |
|
|
| #[cfg(windows)] |
| { |
| |
| |
| let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); |
| let target_env = std::env::var("CARGO_CFG_TARGET_ENV"); |
| let is_tauri_workspace = std::env::var("__TAURI_WORKSPACE__").is_ok_and(|v| v == "true"); |
| if is_tauri_workspace && target_os == "windows" && Ok("msvc") == target_env.as_deref() { |
| embed_manifest_for_tests(); |
| } |
| } |
| } |
|
|
| #[cfg(windows)] |
| fn embed_manifest_for_tests() { |
| static WINDOWS_MANIFEST_FILE: &str = "windows-app-manifest.xml"; |
|
|
| let manifest = std::env::current_dir() |
| .unwrap() |
| .join("../../../crates/tauri-build/src") |
| .join(WINDOWS_MANIFEST_FILE); |
|
|
| println!("cargo:rerun-if-changed={}", manifest.display()); |
| |
| println!("cargo:rustc-link-arg=/MANIFEST:EMBED"); |
| println!( |
| "cargo:rustc-link-arg=/MANIFESTINPUT:{}", |
| manifest.to_str().unwrap() |
| ); |
| |
| println!("cargo:rustc-link-arg=/WX"); |
| } |
|
|