mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-21 09:41:34 +03:00
b32295de18
* hash codegen image cache output * remove left over dbg! statement * prevent info.plist from workspace rebuilds * prevent schema generation from workspace rebuilds * use new `Cached` struct in `CachedIcon` * fmt * use full import for cached plist * use `to_vec()` for raw icons
35 lines
837 B
Rust
35 lines
837 B
Rust
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
use std::{error::Error, path::PathBuf};
|
|
|
|
use schemars::schema_for;
|
|
use tauri_utils::{
|
|
acl::capability::Capability,
|
|
acl::{Permission, Scopes},
|
|
write_if_changed,
|
|
};
|
|
|
|
macro_rules! schema {
|
|
($name:literal, $path:ty) => {
|
|
(concat!($name, "-schema.json"), schema_for!($path))
|
|
};
|
|
}
|
|
|
|
pub fn main() -> Result<(), Box<dyn Error>> {
|
|
let schemas = [
|
|
schema!("capability", Capability),
|
|
schema!("permission", Permission),
|
|
schema!("scope", Scopes),
|
|
];
|
|
|
|
let out = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR")?);
|
|
for (filename, schema) in schemas {
|
|
let schema = serde_json::to_string_pretty(&schema)?;
|
|
write_if_changed(out.join(filename), schema)?;
|
|
}
|
|
|
|
Ok(())
|
|
}
|