Skip to content

feat(build): support plugins that are defined in app crate - #8781

Merged
lucasfernog merged 2 commits into
devfrom
feat/inlined-plugins
Feb 16, 2024
Merged

feat(build): support plugins that are defined in app crate#8781
lucasfernog merged 2 commits into
devfrom
feat/inlined-plugins

Conversation

@lucasfernog

Copy link
Copy Markdown
Member

Since the plugin permission management is done at the build script, to support inlined plugins we need to change tauri-build to expose such API. This PR adds a new tauri_build::Attributes::plugin function, where you can use tauri_build::InlinedPlugin to define metadata of the inlined plugin.

Ref tauri-apps/plugins-workspace#928

@lucasfernog
lucasfernog requested a review from a team as a code owner February 5, 2024 16:43
@amrbashir

Copy link
Copy Markdown
Member

Its DX is weird, but manageable.

Do you think we can make the runtime Plugin builder allow passing its ACL instead of on the build script?

@lucasfernog

Copy link
Copy Markdown
Member Author

that would be the ideal approach but currently we validate permissions on the build script and resolve the allowed commands during codegen. so there's no runtime cost and no way to set the permissions at runtime

@lucasfernog

Copy link
Copy Markdown
Member Author

this PR tries it best to match the behavior between inlined plugins and actual plugin crates. I think it's fine as long as the documentation is good on the website, though I wish the tauri-build entry point was better than tauri_build::build(Attributes::new()).

@amrbashir

amrbashir commented Feb 5, 2024

Copy link
Copy Markdown
Member

yeah, it is not horrible, we can ship this

@lucasfernog
lucasfernog merged commit edb11c1 into dev Feb 16, 2024
@lucasfernog
lucasfernog deleted the feat/inlined-plugins branch February 16, 2024 11:24
@songjiachao

Copy link
Copy Markdown

When can I use this feature?

@Quietly-20201113

Copy link
Copy Markdown

Two months have passed, when can I use this feature?

@FabianLars

Copy link
Copy Markdown
Member

This feature was released on Februrary 19 in tauri-build beta.2 (3 days after this pr was merged).

@stickmy

stickmy commented Jul 31, 2024

Copy link
Copy Markdown

Some tips here:
If the command's name uses snake-case style, such as get_app_setting, you'll get error like ACL: SetPermissionNotFound when you try to put the permissions fields in inline plugin's permission configuration file like below:

[default]
description = """
permissions = ["allow-get_app_setting"]

The correct way is to use kebab-case style in permission configuration file, just like this

[default]
description = """
permissions = ["allow-get-app-setting"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants