mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
* Restructure the repository * lock file * fmt * fix bench * fix cli template test * remove accidental file * fix mv command * clippy * upgrade paths-filter github action * fix cli migration tests * lockfile * license headers * clippy * scope test-core to tauri crate * license header * correct --manifest-path usage * lockfile * fix tauri-driver on macOS [skip ci] * build target ios * try downgrade env_logger * downgrade 0.1.7 * try to fix bench * bench overflow * revert overflow fix, fix tauri_root_path * revert env_logger downgrade * fmt * raise msrv to 1.71 * fmt * delete .cargo/config.toml [skip ci] --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
52 lines
1.7 KiB
Rust
52 lines
1.7 KiB
Rust
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
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",
|
|
])),
|
|
)
|
|
.expect("failed to run tauri-build");
|
|
|
|
// workaround needed to prevent `STATUS_ENTRYPOINT_NOT_FOUND` error in tests
|
|
// see https://github.com/tauri-apps/tauri/pull/4383#issuecomment-1212221864
|
|
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__").map_or(false, |v| v == "true");
|
|
if is_tauri_workspace && target_os == "windows" && Ok("msvc") == target_env.as_deref() {
|
|
embed_manifest_for_tests();
|
|
}
|
|
}
|
|
|
|
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());
|
|
// Embed the Windows application manifest file.
|
|
println!("cargo:rustc-link-arg=/MANIFEST:EMBED");
|
|
println!(
|
|
"cargo:rustc-link-arg=/MANIFESTINPUT:{}",
|
|
manifest.to_str().unwrap()
|
|
);
|
|
// Turn linker warnings into errors.
|
|
println!("cargo:rustc-link-arg=/WX");
|
|
}
|