mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-10-05 20:48:58 +03:00
fix(build): do not rewrite unchanged schema (#8757)
* fix(build): do not rewrite unchanged schema * typo
This commit is contained in:
parent
b43c423165
commit
0f2789cd67
5
.changes/fix-rewrite-schema.md
Normal file
5
.changes/fix-rewrite-schema.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-build": patch:bug
|
||||
---
|
||||
|
||||
Do not rewrite capability JSON schema if it did not change.
|
@ -4,8 +4,7 @@
|
||||
|
||||
use std::{
|
||||
collections::{BTreeMap, BTreeSet},
|
||||
fs::{copy, create_dir_all, read_to_string, File},
|
||||
io::{BufWriter, Write},
|
||||
fs::{copy, create_dir_all, read_to_string, write},
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
@ -181,20 +180,21 @@ pub fn generate_schema(
|
||||
create_dir_all(&out_dir).context("unable to create schema output directory")?;
|
||||
|
||||
let schema_path = out_dir.join(format!("{target}-{CAPABILITIES_SCHEMA_FILE_NAME}"));
|
||||
let mut schema_file = BufWriter::new(File::create(&schema_path)?);
|
||||
write!(schema_file, "{schema_str}")?;
|
||||
if schema_str != read_to_string(&schema_path).unwrap_or_default() {
|
||||
write(&schema_path, "{schema_str}")?;
|
||||
|
||||
copy(
|
||||
schema_path,
|
||||
out_dir.join(format!(
|
||||
"{}-{CAPABILITIES_SCHEMA_FILE_NAME}",
|
||||
if target.is_desktop() {
|
||||
"desktop"
|
||||
} else {
|
||||
"mobile"
|
||||
}
|
||||
)),
|
||||
)?;
|
||||
copy(
|
||||
schema_path,
|
||||
out_dir.join(format!(
|
||||
"{}-{CAPABILITIES_SCHEMA_FILE_NAME}",
|
||||
if target.is_desktop() {
|
||||
"desktop"
|
||||
} else {
|
||||
"mobile"
|
||||
}
|
||||
)),
|
||||
)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ pub struct Capability {
|
||||
pub description: String,
|
||||
/// Execution context of the capability.
|
||||
///
|
||||
/// At runtime, Tauri filters the IPC command together with the context to determine wheter it is allowed or not and its scope.
|
||||
/// At runtime, Tauri filters the IPC command together with the context to determine whether it is allowed or not and its scope.
|
||||
#[serde(default)]
|
||||
pub context: CapabilityContext,
|
||||
/// List of windows that uses this capability. Can be a glob pattern.
|
||||
|
2
examples/api/src-tauri/Cargo.lock
generated
2
examples/api/src-tauri/Cargo.lock
generated
@ -3677,7 +3677,7 @@ checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae"
|
||||
|
||||
[[package]]
|
||||
name = "tauri"
|
||||
version = "2.0.0-beta.0"
|
||||
version = "2.0.0-beta.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
|
Loading…
Reference in New Issue
Block a user