Skip to content

Commit 1686296

Browse files
refactor: put dynamic acl to a feature (#13418)
* refactor: put dynamic acl to a feature * Add change file * Tweak remove_unused_commands's docs * License header * Document the feature * Merge remote-tracking branch 'upstream/dev' into dynamic-acl-feature * Use a inner non generic fn for add_capability * Clippy and macro stability notice * Merge remote-tracking branch 'upstream/dev' into dynamic-acl-feature * Format
1 parent 85baacd commit 1686296

File tree

17 files changed

+274
-253
lines changed

17 files changed

+274
-253
lines changed

.changes/dynamic-acl-feature.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"tauri": 'minor:changes'
3+
"tauri-codegen": 'minor:changes'
4+
"tauri-utils": 'minor:changes'
5+
---
6+
7+
Put dynamic ACL into a feature `dynamic-acl`, this is currently enabled by default to align with the previous behaviors, you can disable it through `default-features = false` to reduce the final binary size by not including the ACL references

Cargo.lock

Lines changed: 14 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tauri-cli/config.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,7 @@
18731873
}
18741874
},
18751875
"removeUnusedCommands": {
1876-
"description": "Try to remove unused commands registered from plugins base on the ACL list during `tauri build`,\n the way it works is that tauri-cli will read this and set the environment variables for the build script and macros,\n and they'll try to get all the allowed commands and remove the rest\n\n Note:\n - This won't be accounting for dynamically added ACLs so make sure to check it when using this\n - This feature requires tauri-plugin 2.1 and tauri 2.4",
1876+
"description": "Try to remove unused commands registered from plugins base on the ACL list during `tauri build`,\n the way it works is that tauri-cli will read this and set the environment variables for the build script and macros,\n and they'll try to get all the allowed commands and remove the rest\n\n Note:\n - This won't be accounting for dynamically added ACLs when you use features from the `dynamic-acl` (currently enabled by default) feature flag, so make sure to check it when using this\n - This feature requires tauri-plugin 2.1 and tauri 2.4",
18771877
"default": false,
18781878
"type": "boolean"
18791879
}

crates/tauri-cli/src/icon.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub struct Options {
6060
ios_color: String,
6161
}
6262

63+
#[allow(clippy::large_enum_variant)]
6364
enum Source {
6465
Svg(resvg::usvg::Tree),
6566
DynamicImage(DynamicImage),

crates/tauri-cli/src/interface/rust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ impl RustAppSettings {
11031103
.to_string()
11041104
})
11051105
});
1106-
let target = TargetPlatform::from_triple(&target_triple);
1106+
let target_platform = TargetPlatform::from_triple(&target_triple);
11071107

11081108
Ok(Self {
11091109
manifest: Mutex::new(manifest),
@@ -1113,7 +1113,7 @@ impl RustAppSettings {
11131113
package_settings,
11141114
cargo_config,
11151115
target_triple,
1116-
target_platform: target,
1116+
target_platform,
11171117
})
11181118
}
11191119

crates/tauri-codegen/src/context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ pub fn context_codegen(data: ContextData) -> EmbeddedAssetsResult<TokenStream> {
409409
identity,
410410
);
411411

412-
let runtime_authority = quote!(#root::ipc::RuntimeAuthority::new(#acl_tokens, #resolved));
412+
let runtime_authority =
413+
quote!(#root::runtime_acl!(#root::ipc::RuntimeAuthority::new, #acl_tokens, #resolved));
413414

414415
let plugin_global_api_scripts = if config.app.with_global_tauri {
415416
if let Some(scripts) = tauri_utils::plugin::read_global_api_scripts(&out_dir) {

crates/tauri-macos-sign/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,7 @@ fn assert_command(
263263
let status =
264264
response.map_err(|e| std::io::Error::new(e.kind(), format!("{error_message}: {e}")))?;
265265
if !status.success() {
266-
Err(std::io::Error::new(
267-
std::io::ErrorKind::Other,
268-
error_message,
269-
))
266+
Err(std::io::Error::other(error_message))
270267
} else {
271268
Ok(())
272269
}

crates/tauri-macros/src/command/wrapper.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use syn::{
1818
};
1919
use tauri_utils::acl::REMOVE_UNUSED_COMMANDS_ENV_VAR;
2020

21+
#[allow(clippy::large_enum_variant)]
2122
enum WrapperAttributeKind {
2223
Meta(Meta),
2324
Async,

crates/tauri-runtime-wry/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,6 @@ impl WindowBuilder for WindowBuilderWrapper {
972972
/// ## Platform-specific
973973
///
974974
/// - **iOS / Android:** Unsupported.
975-
#[must_use]
976975
fn prevent_overflow(mut self) -> Self {
977976
self
978977
.prevent_overflow
@@ -986,7 +985,6 @@ impl WindowBuilder for WindowBuilderWrapper {
986985
/// ## Platform-specific
987986
///
988987
/// - **iOS / Android:** Unsupported.
989-
#[must_use]
990988
fn prevent_overflow_with_margin(mut self, margin: Size) -> Self {
991989
self.prevent_overflow.replace(margin);
992990
self

crates/tauri-schema-generator/schemas/config.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,7 @@
18731873
}
18741874
},
18751875
"removeUnusedCommands": {
1876-
"description": "Try to remove unused commands registered from plugins base on the ACL list during `tauri build`,\n the way it works is that tauri-cli will read this and set the environment variables for the build script and macros,\n and they'll try to get all the allowed commands and remove the rest\n\n Note:\n - This won't be accounting for dynamically added ACLs so make sure to check it when using this\n - This feature requires tauri-plugin 2.1 and tauri 2.4",
1876+
"description": "Try to remove unused commands registered from plugins base on the ACL list during `tauri build`,\n the way it works is that tauri-cli will read this and set the environment variables for the build script and macros,\n and they'll try to get all the allowed commands and remove the rest\n\n Note:\n - This won't be accounting for dynamically added ACLs when you use features from the `dynamic-acl` (currently enabled by default) feature flag, so make sure to check it when using this\n - This feature requires tauri-plugin 2.1 and tauri 2.4",
18771877
"default": false,
18781878
"type": "boolean"
18791879
}

0 commit comments

Comments
 (0)