fix(build): check if permissions dir exists before adding cargo:rerun-if-changed (#9471)

closes #9062
This commit is contained in:
Amr Bashir 2024-04-21 16:04:46 +02:00 committed by GitHub
parent daf018e4f5
commit 88c0ad9cf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 8 deletions

View File

@ -0,0 +1,6 @@
---
"tauri-build": "patch:bug"
---
Fix tauri always rebuilding even if source code didn't change.

View File

@ -360,10 +360,12 @@ pub fn inline_plugins(
)?); )?);
} else { } else {
let default_permissions_path = Path::new("permissions").join(name); let default_permissions_path = Path::new("permissions").join(name);
println!( if default_permissions_path.exists() {
"cargo:rerun-if-changed={}", println!(
default_permissions_path.display() "cargo:rerun-if-changed={}",
); default_permissions_path.display()
);
}
permission_files.extend(tauri_utils::acl::build::define_permissions( permission_files.extend(tauri_utils::acl::build::define_permissions(
&default_permissions_path &default_permissions_path
.join("**") .join("**")
@ -418,10 +420,12 @@ pub fn app_manifest_permissions(
)?); )?);
} else { } else {
let default_permissions_path = Path::new("permissions"); let default_permissions_path = Path::new("permissions");
println!( if default_permissions_path.exists() {
"cargo:rerun-if-changed={}", println!(
default_permissions_path.display() "cargo:rerun-if-changed={}",
); default_permissions_path.display()
);
}
let permissions_root = current_dir()?.join("permissions"); let permissions_root = current_dir()?.join("permissions");
let inlined_plugins_permissions: Vec<_> = inlined_plugins let inlined_plugins_permissions: Vec<_> = inlined_plugins