32 lines
1.3 KiB
Rust
32 lines
1.3 KiB
Rust
fn main() {
|
||
// `LD_FDPI_NO_ADMIN=1` builds an asInvoker variant for automated tests on
|
||
// machines where a UAC prompt cannot be accepted. The shipped build always
|
||
// embeds requireAdministrator.
|
||
println!("cargo:rerun-if-env-changed=LD_FDPI_NO_ADMIN");
|
||
println!("cargo:rerun-if-changed=windows-app-manifest.xml");
|
||
|
||
let manifest = include_str!("windows-app-manifest.xml");
|
||
let no_admin = std::env::var_os("LD_FDPI_NO_ADMIN").is_some();
|
||
let manifest = if no_admin {
|
||
manifest.replace("requireAdministrator", "asInvoker")
|
||
} else {
|
||
manifest.to_string()
|
||
};
|
||
|
||
// Changing this value changes the crate fingerprint, forcing a relink when
|
||
// switching between the test (asInvoker) and shipped (requireAdministrator) builds.
|
||
println!(
|
||
"cargo:rustc-env=LD_FDPI_MANIFEST_LEVEL={}",
|
||
if no_admin { "asInvoker" } else { "requireAdministrator" }
|
||
);
|
||
|
||
let windows = tauri_build::WindowsAttributes::new()
|
||
.app_manifest(manifest)
|
||
.window_icon_path("icons/icon.ico");
|
||
let attributes = tauri_build::Attributes::new().windows_attributes(windows);
|
||
|
||
if let Err(error) = tauri_build::try_build(attributes) {
|
||
eprintln!("tauri-build başarısız: {error}");
|
||
std::process::exit(1);
|
||
}
|
||
}
|