refactor: remove permission description from runtime (#12994)

* Remove description from runtime

* Just use none instead

* global_scope_schema and add comments about it

* Tweak wording

* remove comments [skip ci]

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
Tony
2025-03-16 18:33:41 +08:00
committed by GitHub
parent 0d1446857c
commit 72df2e4a04
4 changed files with 15 additions and 10 deletions

View File

@@ -21,7 +21,7 @@
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.\n Tauri internal convention is to use <h4> headings in markdown content\n for Tauri documentation generation purposes.",
"description": "Human-readable description of what the permission does.\n Tauri internal convention is to use `<h4>` headings in markdown content\n for Tauri documentation generation purposes.",
"type": [
"string",
"null"

View File

@@ -21,7 +21,7 @@ pub struct DefaultPermission {
pub version: Option<NonZeroU64>,
/// Human-readable description of what the permission does.
/// Tauri convention is to use <h4> headings in markdown content
/// Tauri convention is to use `<h4>` headings in markdown content
/// for Tauri documentation generation purposes.
pub description: Option<String>,
@@ -141,7 +141,8 @@ mod build {
let v = v.get();
quote!(::core::num::NonZeroU64::new(#v).unwrap())
}));
let description = opt_str_lit(self.description.as_ref());
// Only used in build script and macros, so don't include them in runtime
let description = quote! { ::core::option::Option::None };
let permissions = vec_lit(&self.permissions, str_lit);
literal_struct!(
tokens,
@@ -171,8 +172,10 @@ mod build {
identity,
);
let global_scope_schema =
opt_lit_owned(self.global_scope_schema.as_ref().map(json_value_lit));
// Only used in build script and macros, so don't include them in runtime
// let global_scope_schema =
// opt_lit_owned(self.global_scope_schema.as_ref().map(json_value_lit));
let global_scope_schema = quote! { ::core::option::Option::None };
literal_struct!(
tokens,

View File

@@ -230,7 +230,7 @@ pub struct Permission {
pub identifier: String,
/// Human-readable description of what the permission does.
/// Tauri internal convention is to use <h4> headings in markdown content
/// Tauri internal convention is to use `<h4>` headings in markdown content
/// for Tauri documentation generation purposes.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
@@ -519,7 +519,8 @@ mod build_ {
quote!(::core::num::NonZeroU64::new(#v).unwrap())
}));
let identifier = str_lit(&self.identifier);
let description = opt_str_lit(self.description.as_ref());
// Only used in build script and macros, so don't include them in runtime
let description = quote! { ::core::option::Option::None };
let commands = &self.commands;
let scope = &self.scope;
let platforms = opt_vec_lit(self.platforms.as_ref(), identity);
@@ -540,7 +541,8 @@ mod build_ {
impl ToTokens for PermissionSet {
fn to_tokens(&self, tokens: &mut TokenStream) {
let identifier = str_lit(&self.identifier);
let description = str_lit(&self.description);
// Only used in build script and macros, so don't include them in runtime
let description = quote! { "".to_string() };
let permissions = vec_lit(&self.permissions, str_lit);
literal_struct!(
tokens,

View File

@@ -49,7 +49,7 @@
"minimum": 1.0
},
"description": {
"description": "Human-readable description of what the permission does.\n Tauri convention is to use <h4> headings in markdown content\n for Tauri documentation generation purposes.",
"description": "Human-readable description of what the permission does.\n Tauri convention is to use `<h4>` headings in markdown content\n for Tauri documentation generation purposes.",
"type": [
"string",
"null"
@@ -111,7 +111,7 @@
"type": "string"
},
"description": {
"description": "Human-readable description of what the permission does.\n Tauri internal convention is to use <h4> headings in markdown content\n for Tauri documentation generation purposes.",
"description": "Human-readable description of what the permission does.\n Tauri internal convention is to use `<h4>` headings in markdown content\n for Tauri documentation generation purposes.",
"type": [
"string",
"null"