-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(tauri): support patch context at runtime #13553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
CC @Legend-Master. In |
Package Changes Through 8a56ea7There are 8 changes which include tauri-bundler with minor, tauri with minor, tauri-cli with minor, tauri-codegen with minor, tauri-utils with minor, @tauri-apps/api with minor, @tauri-apps/cli with minor, tauri-runtime-wry with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
So basically, this is duplicating the code from To be honest, this is just moving the responsibility of maintaining it from pytauri to tauri, and I don't think anyone on the team really wants to do it... I don't know how feasible is it, but I think it might be better/easier to move out |
I would argue that if Tauri wants to support bindings for other languages, it must provide a way to configure at runtime. Otherwise: Each user has their own configuration → their own Moreover, both Qt and CEF provide runtime configuration, allowing them to be compiled as dynamic libraries. If Tauri doesn't make changes, it can only be used as an executable. |
I do really want to support using another language binding without the rust compiler, and that's why I suggested that we change the codegen to generate the |
In fact, I think the Ideally, we should split static embedded_assets: {
icon_bytes: &[u8],
plugin_global_api_scripts: &[u8],
// ...
} = generate_embedded_assets!();
let context: Context = serde::from_str(include_str!("tauri.runtime-conf.json"));
Builder::default()
.embedded_assets(Some(embedded_assets))
.runtime_context(context) You should specify in the impl Builder {
fn init(self) {
if self.runtime_context.use_embedded_assets {
app.set_icon(Image::from_bytes(embedded_assets.icon_bytes));
} else {
self.set_icon(Image::from_path(self.runtime_context.icon_path));
}
}
} |
I like the idea of splitting them up so it's clear which one is used in build and which one is used at runtime
The method that I suggested is just basically moving this to And if you would like to consume it not through |
I believe this is only for your currently implementation of pytauri, if we have the For example, currently you do:
What we can do if that's a function:
And there's no need for
|
Sorry, I don't quite understand. Could you provide some pseudocode to describe how users/downstream consumers would use this new API? |
So currently, we have tauri/crates/tauri-codegen/src/context.rs Line 134 in a472d51
And we change it to |
Discussed at #13033 (comment)
This allows simulating the behavior of
generate_context!
at runtime and dynamically loading theContext
.