mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-11 10:43:31 +02:00
Compare commits
27 Commits
@tauri-app
...
feat/pipel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45fd181727 | ||
|
|
7d079de9e1 | ||
|
|
3ad59d27b8 | ||
|
|
88dce4429f | ||
|
|
ba61754cfe | ||
|
|
84b2dcfe3c | ||
|
|
a3c22e9216 | ||
|
|
eee7252bef | ||
|
|
21d2ef3d9c | ||
|
|
4cd1faf5c8 | ||
|
|
0fba85a1ee | ||
|
|
4061d1c878 | ||
|
|
f85362b2fe | ||
|
|
87b5c54deb | ||
|
|
8e32c14b26 | ||
|
|
425795cd33 | ||
|
|
0ff7832f19 | ||
|
|
0c38bc9805 | ||
|
|
ec00d0437e | ||
|
|
fc96771172 | ||
|
|
0fc28118b7 | ||
|
|
d8fbdf489a | ||
|
|
d557bcf1c4 | ||
|
|
19e60447d3 | ||
|
|
6a6ec7c48f | ||
|
|
d7c017f6ab | ||
|
|
b7f5d80d83 |
@@ -1,2 +0,0 @@
|
||||
[env]
|
||||
__TAURI_WORKSPACE__ = "true"
|
||||
15
Cargo.toml
15
Cargo.toml
@@ -12,10 +12,23 @@ members = [
|
||||
|
||||
# integration tests
|
||||
"core/tests/restart",
|
||||
"core/tests/tauri-codegen-test",
|
||||
|
||||
# examples that only require Cargo
|
||||
"examples/commands",
|
||||
"examples/helloworld",
|
||||
"examples/isolation",
|
||||
"examples/multiwindow",
|
||||
"examples/navigation",
|
||||
"examples/parent-window",
|
||||
"examples/splashscreen",
|
||||
"examples/state",
|
||||
"examples/streaming",
|
||||
#"examples/tauri-dynamic-lib",
|
||||
]
|
||||
|
||||
exclude = [
|
||||
# examples that can be compiled with the tauri CLI
|
||||
# examples that require NodeJS and/or NPM
|
||||
"examples/api/src-tauri",
|
||||
"examples/resources/src-tauri",
|
||||
"examples/sidecar/src-tauri",
|
||||
|
||||
@@ -18,8 +18,8 @@ rustdoc-args = [ "--cfg", "doc_cfg" ]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
quote = { version = "1", optional = true }
|
||||
tauri-codegen = { version = "2.0.0-alpha.5", path = "../tauri-codegen", optional = true }
|
||||
quote = "1"
|
||||
tauri-codegen = { version = "2.0.0-alpha.5", path = "../tauri-codegen" }
|
||||
tauri-utils = { version = "2.0.0-alpha.5", path = "../tauri-utils", features = [ "build", "resources" ] }
|
||||
cargo_toml = "0.15"
|
||||
serde = "1"
|
||||
@@ -29,12 +29,13 @@ json-patch = "1.0"
|
||||
walkdir = "2"
|
||||
tauri-winres = "0.1"
|
||||
semver = "1"
|
||||
syn = "2"
|
||||
prettyplease = "0.2"
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies]
|
||||
swift-rs = { version = "1.0.4", features = [ "build" ] }
|
||||
|
||||
[features]
|
||||
codegen = [ "tauri-codegen", "quote" ]
|
||||
isolation = [ "tauri-codegen/isolation", "tauri-utils/isolation" ]
|
||||
config-json5 = [ "tauri-utils/config-json5" ]
|
||||
config-toml = [ "tauri-utils/config-toml" ]
|
||||
|
||||
@@ -14,7 +14,6 @@ use tauri_utils::config::{AppUrl, WindowUrl};
|
||||
|
||||
// TODO docs
|
||||
/// A builder for generating a Tauri application context during compile time.
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "codegen")))]
|
||||
#[derive(Debug)]
|
||||
pub struct CodegenContext {
|
||||
dev: bool,
|
||||
@@ -38,34 +37,6 @@ impl CodegenContext {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// Set the path to the `tauri.conf.json` (relative to the package's directory).
|
||||
///
|
||||
/// This defaults to a file called `tauri.conf.json` inside of the current working directory of
|
||||
/// the package compiling; does not need to be set manually if that config file is in the same
|
||||
/// directory as your `Cargo.toml`.
|
||||
#[must_use]
|
||||
pub fn config_path(mut self, config_path: impl Into<PathBuf>) -> Self {
|
||||
self.config_path = config_path.into();
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the output file's path.
|
||||
///
|
||||
/// **Note:** This path should be relative to the `OUT_DIR`.
|
||||
///
|
||||
/// Don't set this if you are using [`tauri::tauri_build_context!`] as that helper macro
|
||||
/// expects the default value. This option can be useful if you are not using the helper and
|
||||
/// instead using [`std::include!`] on the generated code yourself.
|
||||
///
|
||||
/// Defaults to `tauri-build-context.rs`.
|
||||
///
|
||||
/// [`tauri::tauri_build_context!`]: https://docs.rs/tauri/latest/tauri/macro.tauri_build_context.html
|
||||
#[must_use]
|
||||
pub fn out_file(mut self, filename: PathBuf) -> Self {
|
||||
self.out_file = filename;
|
||||
self
|
||||
}
|
||||
|
||||
/// Run the codegen in a `dev` context, meaning that Tauri is using a dev server or local file for development purposes,
|
||||
/// usually with the `tauri dev` CLI command.
|
||||
#[must_use]
|
||||
@@ -128,10 +99,12 @@ impl CodegenContext {
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
println!(
|
||||
"cargo:rerun-if-changed={}",
|
||||
config_parent.join("Info.plist").display()
|
||||
);
|
||||
{
|
||||
let plist = config_parent.join("Info.plist");
|
||||
if plist.exists() {
|
||||
println!("cargo:rerun-if-changed={}", plist.display());
|
||||
}
|
||||
}
|
||||
|
||||
let code = context_codegen(ContextData {
|
||||
dev: self.dev,
|
||||
|
||||
@@ -19,15 +19,12 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
#[cfg(feature = "codegen")]
|
||||
mod codegen;
|
||||
/// Mobile build functions.
|
||||
pub mod mobile;
|
||||
mod static_vcruntime;
|
||||
|
||||
#[cfg(feature = "codegen")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "codegen")))]
|
||||
pub use codegen::context::CodegenContext;
|
||||
use codegen::context::CodegenContext;
|
||||
|
||||
fn copy_file(from: impl AsRef<Path>, to: impl AsRef<Path>) -> Result<()> {
|
||||
let from = from.as_ref();
|
||||
@@ -441,6 +438,14 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
let mut codegen = CodegenContext::new();
|
||||
|
||||
if !has_feature("custom-protocol") {
|
||||
codegen = codegen.dev();
|
||||
}
|
||||
|
||||
codegen.build();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -371,14 +371,12 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
|
||||
.expect("failed to write Info.plist");
|
||||
|
||||
let info_plist_path = out_path.display().to_string();
|
||||
quote!({
|
||||
tauri::embed_plist::embed_info_plist!(#info_plist_path);
|
||||
})
|
||||
quote!(::tauri::utils::embed_plist::embed_info_plist!(#info_plist_path);)
|
||||
} else {
|
||||
quote!(())
|
||||
TokenStream::new()
|
||||
};
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let info_plist = quote!(());
|
||||
let info_plist = TokenStream::new();
|
||||
|
||||
let pattern = match &options.pattern {
|
||||
PatternKind::Brownfield => quote!(#root::Pattern::Brownfield(std::marker::PhantomData)),
|
||||
@@ -422,6 +420,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
|
||||
};
|
||||
|
||||
Ok(quote!({
|
||||
#info_plist
|
||||
#[allow(unused_mut, clippy::let_and_return)]
|
||||
let mut context = #root::Context::new(
|
||||
#config,
|
||||
@@ -429,7 +428,6 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
|
||||
#default_window_icon,
|
||||
#app_icon,
|
||||
#package_info,
|
||||
#info_plist,
|
||||
#pattern,
|
||||
);
|
||||
#with_system_tray_icon_code
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use proc_macro2::{Ident, Span, TokenStream};
|
||||
use quote::{quote, ToTokens};
|
||||
use std::{env::VarError, path::PathBuf};
|
||||
use syn::{
|
||||
parse::{Parse, ParseBuffer},
|
||||
punctuated::Punctuated,
|
||||
LitStr, PathArguments, PathSegment, Token,
|
||||
};
|
||||
use tauri_codegen::{context_codegen, get_config, ContextData};
|
||||
use tauri_utils::config::parse::does_supported_file_name_exist;
|
||||
|
||||
pub(crate) struct ContextItems {
|
||||
config_file: PathBuf,
|
||||
root: syn::Path,
|
||||
}
|
||||
|
||||
impl Parse for ContextItems {
|
||||
fn parse(input: &ParseBuffer<'_>) -> syn::parse::Result<Self> {
|
||||
let config_file = if input.is_empty() {
|
||||
std::env::var("CARGO_MANIFEST_DIR").map(|m| PathBuf::from(m).join("tauri.conf.json"))
|
||||
} else {
|
||||
let raw: LitStr = input.parse()?;
|
||||
let path = PathBuf::from(raw.value());
|
||||
if path.is_relative() {
|
||||
std::env::var("CARGO_MANIFEST_DIR").map(|m| PathBuf::from(m).join(path))
|
||||
} else {
|
||||
Ok(path)
|
||||
}
|
||||
}
|
||||
.map_err(|error| match error {
|
||||
VarError::NotPresent => "no CARGO_MANIFEST_DIR env var, this should be set by cargo".into(),
|
||||
VarError::NotUnicode(_) => "CARGO_MANIFEST_DIR env var contained invalid utf8".into(),
|
||||
})
|
||||
.and_then(|path| {
|
||||
if does_supported_file_name_exist(&path) {
|
||||
Ok(path)
|
||||
} else {
|
||||
Err(format!(
|
||||
"no file at path {} exists, expected tauri config file",
|
||||
path.display()
|
||||
))
|
||||
}
|
||||
})
|
||||
.map_err(|e| input.error(e))?;
|
||||
|
||||
let context_path = if input.is_empty() {
|
||||
let mut segments = Punctuated::new();
|
||||
segments.push(PathSegment {
|
||||
ident: Ident::new("tauri", Span::call_site()),
|
||||
arguments: PathArguments::None,
|
||||
});
|
||||
syn::Path {
|
||||
leading_colon: Some(Token)),
|
||||
segments,
|
||||
}
|
||||
} else {
|
||||
let _: Token![,] = input.parse()?;
|
||||
input.call(syn::Path::parse_mod_style)?
|
||||
};
|
||||
|
||||
Ok(Self {
|
||||
config_file,
|
||||
root: context_path,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn generate_context(context: ContextItems) -> TokenStream {
|
||||
let context = get_config(&context.config_file)
|
||||
.map_err(|e| e.to_string())
|
||||
.map(|(config, config_parent)| ContextData {
|
||||
dev: cfg!(not(feature = "custom-protocol")),
|
||||
config,
|
||||
config_parent,
|
||||
root: context.root.to_token_stream(),
|
||||
})
|
||||
.and_then(|data| context_codegen(data).map_err(|e| e.to_string()));
|
||||
|
||||
match context {
|
||||
Ok(code) => code,
|
||||
Err(error) => quote!(compile_error!(#error)),
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use crate::context::ContextItems;
|
||||
use proc_macro::TokenStream;
|
||||
use syn::{parse_macro_input, DeriveInput};
|
||||
|
||||
@@ -10,9 +9,6 @@ mod command;
|
||||
mod mobile;
|
||||
mod runtime;
|
||||
|
||||
#[macro_use]
|
||||
mod context;
|
||||
|
||||
/// Mark a function as a command handler. It creates a wrapper function with the necessary glue code.
|
||||
///
|
||||
/// # Stability
|
||||
@@ -55,19 +51,6 @@ pub fn generate_handler(item: TokenStream) -> TokenStream {
|
||||
parse_macro_input!(item as command::Handler).into()
|
||||
}
|
||||
|
||||
/// Reads a Tauri config file and generates a `::tauri::Context` based on the content.
|
||||
///
|
||||
/// # Stability
|
||||
/// The output of this macro is managed internally by Tauri,
|
||||
/// and should not be accessed directly on normal applications.
|
||||
/// It may have breaking changes in the future.
|
||||
#[proc_macro]
|
||||
pub fn generate_context(items: TokenStream) -> TokenStream {
|
||||
// this macro is exported from the context module
|
||||
let path = parse_macro_input!(items as ContextItems);
|
||||
context::generate_context(path).into()
|
||||
}
|
||||
|
||||
/// Adds the default type for the last parameter (assumed to be runtime) for a specific feature.
|
||||
///
|
||||
/// e.g. To default the runtime generic to type `crate::Wry` when the `wry` feature is enabled, the
|
||||
|
||||
@@ -35,6 +35,8 @@ use crate::http::{
|
||||
InvalidUri,
|
||||
};
|
||||
|
||||
pub use tauri_utils::RawIcon as Icon;
|
||||
|
||||
#[cfg(all(desktop, feature = "system-tray"))]
|
||||
use std::fmt;
|
||||
|
||||
@@ -267,17 +269,6 @@ pub enum Error {
|
||||
/// Result type.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Window icon.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Icon {
|
||||
/// RGBA bytes of the icon.
|
||||
pub rgba: Vec<u8>,
|
||||
/// Icon width.
|
||||
pub width: u32,
|
||||
/// Icon height.
|
||||
pub height: u32,
|
||||
}
|
||||
|
||||
/// A type that can be used as an user event.
|
||||
pub trait UserEvent: Debug + Clone + Send + 'static {}
|
||||
|
||||
|
||||
@@ -35,11 +35,16 @@ glob = { version = "0.3", optional = true }
|
||||
walkdir = { version = "2", optional = true }
|
||||
memchr = "2"
|
||||
semver = "1"
|
||||
infer = "0.12"
|
||||
infer = "0.13"
|
||||
png = { version = "0.17", optional = true }
|
||||
ico = { version = "0.2.0", optional = true }
|
||||
|
||||
[target."cfg(target_os = \"linux\")".dependencies]
|
||||
heck = "0.4"
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies]
|
||||
embed_plist = "1.2"
|
||||
|
||||
[target."cfg(windows)".dependencies.windows]
|
||||
version = "0.44.0"
|
||||
features = [
|
||||
@@ -51,6 +56,7 @@ features = [
|
||||
]
|
||||
|
||||
[features]
|
||||
default = ["icon-ico", "icon-png"]
|
||||
build = [ "proc-macro2", "quote" ]
|
||||
compression = [ "brotli" ]
|
||||
schema = [ "schemars" ]
|
||||
@@ -59,3 +65,6 @@ process-relaunch-dangerous-allow-symlink-macos = [ ]
|
||||
config-json5 = [ "json5" ]
|
||||
config-toml = [ "toml" ]
|
||||
resources = [ "glob", "walkdir" ]
|
||||
icon-ico = [ "ico" ]
|
||||
icon-png = [ "png" ]
|
||||
|
||||
|
||||
@@ -7,10 +7,14 @@
|
||||
#![allow(clippy::deprecated_semver)]
|
||||
|
||||
use std::{
|
||||
fmt::Display,
|
||||
fmt::{self, Display},
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use assets::Assets;
|
||||
use config::Config;
|
||||
use pattern::Pattern;
|
||||
use semver::Version;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
@@ -27,6 +31,10 @@ pub mod resources;
|
||||
/// Application pattern.
|
||||
pub mod pattern;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[doc(hidden)]
|
||||
pub use embed_plist;
|
||||
|
||||
/// `tauri::App` package information.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PackageInfo {
|
||||
@@ -398,3 +406,251 @@ pub fn display_path<P: AsRef<Path>>(p: P) -> String {
|
||||
.display()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
/// Window icon.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RawIcon {
|
||||
/// RGBA bytes of the icon.
|
||||
pub rgba: Vec<u8>,
|
||||
/// Icon width.
|
||||
pub width: u32,
|
||||
/// Icon height.
|
||||
pub height: u32,
|
||||
}
|
||||
|
||||
/// A icon definition.
|
||||
#[derive(Debug, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub enum Icon {
|
||||
/// Icon from file path.
|
||||
#[cfg(any(feature = "icon-ico", feature = "icon-png"))]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(any(feature = "icon-ico", feature = "icon-png"))))]
|
||||
File(std::path::PathBuf),
|
||||
/// Icon from raw RGBA bytes. Width and height is parsed at runtime.
|
||||
#[cfg(any(feature = "icon-ico", feature = "icon-png"))]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(any(feature = "icon-ico", feature = "icon-png"))))]
|
||||
Raw(Vec<u8>),
|
||||
/// Icon from raw RGBA bytes.
|
||||
Rgba {
|
||||
/// RGBA bytes of the icon image.
|
||||
rgba: Vec<u8>,
|
||||
/// Icon width.
|
||||
width: u32,
|
||||
/// Icon height.
|
||||
height: u32,
|
||||
},
|
||||
}
|
||||
|
||||
/// Errors that can happen while loading an Icon.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum IconError {
|
||||
/// Any IO error.
|
||||
#[error(transparent)]
|
||||
Io(#[from] std::io::Error),
|
||||
|
||||
/// Invalid PNG.
|
||||
#[cfg(feature = "icon-png")]
|
||||
#[error(transparent)]
|
||||
Png(#[from] png::DecodingError),
|
||||
}
|
||||
|
||||
impl TryFrom<Icon> for RawIcon {
|
||||
type Error = IconError;
|
||||
|
||||
fn try_from(icon: Icon) -> ::std::result::Result<Self, Self::Error> {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
if let Icon::Rgba {
|
||||
rgba,
|
||||
width,
|
||||
height,
|
||||
} = icon
|
||||
{
|
||||
Ok(Self {
|
||||
rgba,
|
||||
width,
|
||||
height,
|
||||
})
|
||||
} else {
|
||||
#[cfg(not(any(feature = "icon-ico", feature = "icon-png")))]
|
||||
panic!("unexpected Icon variant");
|
||||
#[cfg(any(feature = "icon-ico", feature = "icon-png"))]
|
||||
{
|
||||
let bytes = match icon {
|
||||
Icon::File(p) => std::fs::read(p)?,
|
||||
Icon::Raw(r) => r,
|
||||
Icon::Rgba { .. } => unreachable!(),
|
||||
};
|
||||
let extension = infer::get(&bytes)
|
||||
.expect("could not determine icon extension")
|
||||
.extension();
|
||||
match extension {
|
||||
#[cfg(feature = "icon-ico")]
|
||||
"ico" => {
|
||||
let icon_dir = ico::IconDir::read(std::io::Cursor::new(bytes))?;
|
||||
let entry = &icon_dir.entries()[0];
|
||||
Ok(Self {
|
||||
rgba: entry.decode()?.rgba_data().to_vec(),
|
||||
width: entry.width(),
|
||||
height: entry.height(),
|
||||
})
|
||||
}
|
||||
#[cfg(feature = "icon-png")]
|
||||
"png" => {
|
||||
let decoder = png::Decoder::new(std::io::Cursor::new(bytes));
|
||||
let mut reader = decoder.read_info()?;
|
||||
let mut buffer = Vec::new();
|
||||
while let Ok(Some(row)) = reader.next_row() {
|
||||
buffer.extend(row.data());
|
||||
}
|
||||
Ok(Self {
|
||||
rgba: buffer,
|
||||
width: reader.info().width,
|
||||
height: reader.info().height,
|
||||
})
|
||||
}
|
||||
_ => panic!(
|
||||
"image `{extension}` extension not supported; please file a Tauri feature request. `png` or `ico` icons are supported with the `icon-png` and `icon-ico` feature flags"
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// User supplied data required inside of a Tauri application.
|
||||
///
|
||||
/// # Stability
|
||||
///
|
||||
/// This is the output of Tauri codegen, and is not considered part of the stable API.
|
||||
/// Unless you know what you are doing and are prepared for this type to have breaking changes, do not create it yourself.
|
||||
pub struct Context<A: Assets> {
|
||||
#[doc(hidden)]
|
||||
pub config: Config,
|
||||
|
||||
#[doc(hidden)]
|
||||
pub assets: Arc<A>,
|
||||
|
||||
#[doc(hidden)]
|
||||
pub default_window_icon: Option<Icon>,
|
||||
|
||||
#[doc(hidden)]
|
||||
pub app_icon: Option<Vec<u8>>,
|
||||
|
||||
#[doc(hidden)]
|
||||
pub system_tray_icon: Option<Icon>,
|
||||
|
||||
#[doc(hidden)]
|
||||
pub package_info: PackageInfo,
|
||||
|
||||
#[doc(hidden)]
|
||||
pub pattern: Pattern,
|
||||
}
|
||||
|
||||
impl<A: Assets> fmt::Debug for Context<A> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("Context")
|
||||
.field("config", &self.config)
|
||||
.field("default_window_icon", &self.default_window_icon)
|
||||
.field("app_icon", &self.app_icon)
|
||||
.field("package_info", &self.package_info)
|
||||
.field("pattern", &self.pattern)
|
||||
.field("system_tray_icon", &self.system_tray_icon)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Assets> Context<A> {
|
||||
/// The config the application was prepared with.
|
||||
#[inline(always)]
|
||||
pub fn config(&self) -> &Config {
|
||||
&self.config
|
||||
}
|
||||
|
||||
/// A mutable reference to the config the application was prepared with.
|
||||
#[inline(always)]
|
||||
pub fn config_mut(&mut self) -> &mut Config {
|
||||
&mut self.config
|
||||
}
|
||||
|
||||
/// The assets to be served directly by Tauri.
|
||||
#[inline(always)]
|
||||
pub fn assets(&self) -> Arc<A> {
|
||||
self.assets.clone()
|
||||
}
|
||||
|
||||
/// A mutable reference to the assets to be served directly by Tauri.
|
||||
#[inline(always)]
|
||||
pub fn assets_mut(&mut self) -> &mut Arc<A> {
|
||||
&mut self.assets
|
||||
}
|
||||
|
||||
/// The default window icon Tauri should use when creating windows.
|
||||
#[inline(always)]
|
||||
pub fn default_window_icon(&self) -> Option<&Icon> {
|
||||
self.default_window_icon.as_ref()
|
||||
}
|
||||
|
||||
/// A mutable reference to the default window icon Tauri should use when creating windows.
|
||||
#[inline(always)]
|
||||
pub fn default_window_icon_mut(&mut self) -> &mut Option<Icon> {
|
||||
&mut self.default_window_icon
|
||||
}
|
||||
|
||||
/// The icon to use on the system tray UI.
|
||||
#[inline(always)]
|
||||
pub fn system_tray_icon(&self) -> Option<&Icon> {
|
||||
self.system_tray_icon.as_ref()
|
||||
}
|
||||
|
||||
/// A mutable reference to the icon to use on the system tray UI.
|
||||
#[inline(always)]
|
||||
pub fn system_tray_icon_mut(&mut self) -> &mut Option<Icon> {
|
||||
&mut self.system_tray_icon
|
||||
}
|
||||
|
||||
/// Package information.
|
||||
#[inline(always)]
|
||||
pub fn package_info(&self) -> &PackageInfo {
|
||||
&self.package_info
|
||||
}
|
||||
|
||||
/// A mutable reference to the package information.
|
||||
#[inline(always)]
|
||||
pub fn package_info_mut(&mut self) -> &mut PackageInfo {
|
||||
&mut self.package_info
|
||||
}
|
||||
|
||||
/// The application pattern.
|
||||
#[inline(always)]
|
||||
pub fn pattern(&self) -> &Pattern {
|
||||
&self.pattern
|
||||
}
|
||||
|
||||
/// Create a new [`Context`] from the minimal required items.
|
||||
#[inline(always)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
config: Config,
|
||||
assets: Arc<A>,
|
||||
default_window_icon: Option<Icon>,
|
||||
app_icon: Option<Vec<u8>>,
|
||||
package_info: PackageInfo,
|
||||
pattern: Pattern,
|
||||
) -> Self {
|
||||
Self {
|
||||
config,
|
||||
assets,
|
||||
default_window_icon,
|
||||
app_icon,
|
||||
system_tray_icon: None,
|
||||
package_info,
|
||||
pattern,
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the app tray icon.
|
||||
#[inline(always)]
|
||||
pub fn set_system_tray_icon(&mut self, icon: Icon) {
|
||||
self.system_tray_icon.replace(icon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,54 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::assets::{Assets, EmbeddedAssets};
|
||||
|
||||
/// Handling the Tauri "Isolation" Pattern.
|
||||
#[cfg(feature = "isolation")]
|
||||
pub mod isolation;
|
||||
|
||||
/// An application pattern.
|
||||
#[derive(Debug)]
|
||||
pub enum Pattern<A: Assets = EmbeddedAssets> {
|
||||
/// The brownfield pattern.
|
||||
Brownfield(PhantomData<A>),
|
||||
/// Isolation pattern. Recommended for security purposes.
|
||||
#[cfg(feature = "isolation")]
|
||||
Isolation {
|
||||
/// The HTML served on `isolation://index.html`.
|
||||
assets: std::sync::Arc<A>,
|
||||
|
||||
/// The schema used for the isolation frames.
|
||||
schema: String,
|
||||
|
||||
/// A random string used to ensure that the message went through the isolation frame.
|
||||
///
|
||||
/// This should be regenerated at runtime.
|
||||
key: String,
|
||||
|
||||
/// Cryptographically secure keys
|
||||
crypto_keys: Box<self::isolation::Keys>,
|
||||
},
|
||||
}
|
||||
|
||||
impl<A: Assets> Clone for Pattern<A> {
|
||||
fn clone(&self) -> Self {
|
||||
match self {
|
||||
Self::Brownfield(a) => Self::Brownfield(*a),
|
||||
#[cfg(feature = "isolation")]
|
||||
Self::Isolation {
|
||||
assets,
|
||||
schema,
|
||||
key,
|
||||
crypto_keys,
|
||||
} => Self::Isolation {
|
||||
assets: assets.clone(),
|
||||
schema: schema.clone(),
|
||||
key: key.clone(),
|
||||
crypto_keys: crypto_keys.clone(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ tauri = { path = ".", default-features = false, features = [ "wry" ] }
|
||||
tokio = { version = "1", features = [ "full" ] }
|
||||
cargo_toml = "0.11"
|
||||
winnow = "=0.4.1"
|
||||
tauri-codegen-test = { path = "../tests/tauri-codegen-test" }
|
||||
|
||||
[features]
|
||||
default = [ "wry", "compression", "objc-exception" ]
|
||||
@@ -137,42 +138,5 @@ window-data-url = [ "data-url" ]
|
||||
protocol-asset = [ ]
|
||||
config-json5 = [ "tauri-macros/config-json5" ]
|
||||
config-toml = [ "tauri-macros/config-toml" ]
|
||||
icon-ico = [ "infer", "ico" ]
|
||||
icon-png = [ "infer", "png" ]
|
||||
|
||||
[[example]]
|
||||
name = "commands"
|
||||
path = "../../examples/commands/main.rs"
|
||||
|
||||
[[example]]
|
||||
name = "helloworld"
|
||||
path = "../../examples/helloworld/main.rs"
|
||||
|
||||
[[example]]
|
||||
name = "multiwindow"
|
||||
path = "../../examples/multiwindow/main.rs"
|
||||
|
||||
[[example]]
|
||||
name = "parent-window"
|
||||
path = "../../examples/parent-window/main.rs"
|
||||
|
||||
[[example]]
|
||||
name = "navigation"
|
||||
path = "../../examples/navigation/main.rs"
|
||||
|
||||
[[example]]
|
||||
name = "splashscreen"
|
||||
path = "../../examples/splashscreen/main.rs"
|
||||
|
||||
[[example]]
|
||||
name = "state"
|
||||
path = "../../examples/state/main.rs"
|
||||
|
||||
[[example]]
|
||||
name = "streaming"
|
||||
path = "../../examples/streaming/main.rs"
|
||||
|
||||
[[example]]
|
||||
name = "isolation"
|
||||
path = "../../examples/isolation/main.rs"
|
||||
required-features = [ "isolation" ]
|
||||
icon-ico = [ "infer", "ico", "tauri-utils/icon-ico" ]
|
||||
icon-png = [ "infer", "png", "tauri-utils/icon-png" ]
|
||||
|
||||
@@ -57,14 +57,6 @@ fn main() {
|
||||
)
|
||||
.expect("failed to write checked_features file");
|
||||
|
||||
// workaround needed to prevent `STATUS_ENTRYPOINT_NOT_FOUND` error
|
||||
// see https://github.com/tauri-apps/tauri/pull/4383#issuecomment-1212221864
|
||||
let target_env = std::env::var("CARGO_CFG_TARGET_ENV");
|
||||
let is_tauri_workspace = std::env::var("__TAURI_WORKSPACE__").map_or(false, |v| v == "true");
|
||||
if is_tauri_workspace && target_os == "windows" && Ok("msvc") == target_env.as_deref() {
|
||||
add_manifest();
|
||||
}
|
||||
|
||||
if target_os == "android" {
|
||||
if let Ok(kotlin_out_dir) = std::env::var("WRY_ANDROID_KOTLIN_FILES_OUT_DIR") {
|
||||
fn env_var(var: &str) -> String {
|
||||
@@ -132,22 +124,3 @@ fn main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn add_manifest() {
|
||||
static WINDOWS_MANIFEST_FILE: &str = "window-app-manifest.xml";
|
||||
|
||||
let manifest = std::env::current_dir()
|
||||
.unwrap()
|
||||
.join("../tauri-build/src")
|
||||
.join(WINDOWS_MANIFEST_FILE);
|
||||
|
||||
println!("cargo:rerun-if-changed={}", manifest.display());
|
||||
// Embed the Windows application manifest file.
|
||||
println!("cargo:rustc-link-arg=/MANIFEST:EMBED");
|
||||
println!(
|
||||
"cargo:rustc-link-arg=/MANIFESTINPUT:{}",
|
||||
manifest.to_str().unwrap()
|
||||
);
|
||||
// Turn linker warnings into errors.
|
||||
println!("cargo:rustc-link-arg=/WX");
|
||||
}
|
||||
|
||||
@@ -618,10 +618,16 @@ impl<R: Runtime> App<R> {
|
||||
/// Sets the activation policy for the application. It is set to `NSApplicationActivationPolicyRegular` by default.
|
||||
///
|
||||
/// # Examples
|
||||
/// ```,no_run
|
||||
///
|
||||
/// ```ignore
|
||||
/// let context = tauri::tauri_build_context!();
|
||||
/// ```
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// # let context = tauri_codegen_test::context();
|
||||
/// let mut app = tauri::Builder::default()
|
||||
/// // on an actual app, remove the string argument
|
||||
/// .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
|
||||
/// .build(context)
|
||||
/// .expect("error while building tauri application");
|
||||
/// #[cfg(target_os = "macos")]
|
||||
/// app.set_activation_policy(tauri::ActivationPolicy::Accessory);
|
||||
@@ -648,10 +654,16 @@ impl<R: Runtime> App<R> {
|
||||
/// - ** Linux / macOS / iOS / Android**: Unsupported.
|
||||
///
|
||||
/// # Examples
|
||||
/// ```,no_run
|
||||
///
|
||||
/// ```ignore
|
||||
/// let context = tauri::tauri_build_context!();
|
||||
/// ```
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// # let context = tauri_codegen_test::context();
|
||||
/// let mut app = tauri::Builder::default()
|
||||
/// // on an actual app, remove the string argument
|
||||
/// .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
|
||||
/// .build(context)
|
||||
/// .expect("error while building tauri application");
|
||||
/// app.set_device_event_filter(tauri::DeviceEventFilter::Always);
|
||||
/// app.run(|_app_handle, _event| {});
|
||||
@@ -669,10 +681,16 @@ impl<R: Runtime> App<R> {
|
||||
/// Runs the application.
|
||||
///
|
||||
/// # Examples
|
||||
/// ```,no_run
|
||||
///
|
||||
/// ```ignore
|
||||
/// let context = tauri::tauri_build_context!();
|
||||
/// ```
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// # let context = tauri_codegen_test::context();
|
||||
/// let app = tauri::Builder::default()
|
||||
/// // on an actual app, remove the string argument
|
||||
/// .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
|
||||
/// .build(context)
|
||||
/// .expect("error while building tauri application");
|
||||
/// app.run(|_app_handle, event| match event {
|
||||
/// tauri::RunEvent::ExitRequested { api, .. } => {
|
||||
@@ -718,10 +736,16 @@ impl<R: Runtime> App<R> {
|
||||
/// Additionally, the cleanup calls [AppHandle#remove_system_tray](`AppHandle#method.remove_system_tray`) (Windows only).
|
||||
///
|
||||
/// # Examples
|
||||
/// ```no_run
|
||||
///
|
||||
/// ```ignore
|
||||
/// let context = tauri::tauri_build_context!();
|
||||
/// ```
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// # let context = tauri_codegen_test::context();
|
||||
/// let mut app = tauri::Builder::default()
|
||||
/// // on an actual app, remove the string argument
|
||||
/// .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
|
||||
/// .build(context)
|
||||
/// .expect("error while building tauri application");
|
||||
/// loop {
|
||||
/// let iteration = app.run_iteration();
|
||||
@@ -748,10 +772,16 @@ impl<R: Runtime> App<R> {
|
||||
/// Builds a Tauri application.
|
||||
///
|
||||
/// # Examples
|
||||
/// ```,no_run
|
||||
///
|
||||
/// ```ignore
|
||||
/// let context = tauri::tauri_build_context!();
|
||||
/// ```
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// # let context = tauri_codegen_test::context();
|
||||
/// tauri::Builder::default()
|
||||
/// // on an actual app, remove the string argument
|
||||
/// .run(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
|
||||
/// .run(context)
|
||||
/// .expect("error while running tauri application");
|
||||
/// ```
|
||||
#[allow(clippy::type_complexity)]
|
||||
@@ -988,7 +1018,11 @@ impl<R: Runtime> Builder<R> {
|
||||
///
|
||||
/// Since the managed state is global and must be [`Send`] + [`Sync`], mutations can only happen through interior mutability:
|
||||
///
|
||||
/// ```,no_run
|
||||
/// ```ignore
|
||||
/// let context = tauri::tauri_build_context!();
|
||||
/// ```
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use std::{collections::HashMap, sync::Mutex};
|
||||
/// use tauri::State;
|
||||
/// // here we use Mutex to achieve interior mutability
|
||||
@@ -1012,18 +1046,23 @@ impl<R: Runtime> Builder<R> {
|
||||
/// storage.store.lock().unwrap().insert(key, value);
|
||||
/// }
|
||||
///
|
||||
/// # let context = tauri_codegen_test::context();
|
||||
/// tauri::Builder::default()
|
||||
/// .manage(Storage { store: Default::default() })
|
||||
/// .manage(DbConnection { db: Default::default() })
|
||||
/// .invoke_handler(tauri::generate_handler![connect, storage_insert])
|
||||
/// // on an actual app, remove the string argument
|
||||
/// .run(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
|
||||
/// .run(context)
|
||||
/// .expect("error while running tauri application");
|
||||
/// ```
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```,no_run
|
||||
/// ```ignore
|
||||
/// let context = tauri::tauri_build_context!();
|
||||
/// ```
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use tauri::State;
|
||||
///
|
||||
/// struct MyInt(isize);
|
||||
@@ -1039,12 +1078,13 @@ impl<R: Runtime> Builder<R> {
|
||||
/// println!("state: {}", state.inner().0);
|
||||
/// }
|
||||
///
|
||||
/// # let context = tauri_codegen_test::context();
|
||||
/// tauri::Builder::default()
|
||||
/// .manage(MyInt(10))
|
||||
/// .manage(MyString("Hello, managed state!".to_string()))
|
||||
/// .invoke_handler(tauri::generate_handler![int_command, string_command])
|
||||
/// // on an actual app, remove the string argument
|
||||
/// .run(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
|
||||
/// .run(context)
|
||||
/// .expect("error while running tauri application");
|
||||
/// ```
|
||||
#[must_use]
|
||||
|
||||
@@ -89,4 +89,7 @@ pub enum Error {
|
||||
#[cfg(target_os = "android")]
|
||||
#[error("jni error: {0}")]
|
||||
Jni(#[from] jni::errors::Error),
|
||||
/// An error happened while loading the Icon.
|
||||
#[error(transparent)]
|
||||
Icon(#[from] tauri_utils::IconError),
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use crate::{api::ipc::CallbackFn, command, Manager, Result, Runtime, Window};
|
||||
use serde::{Deserialize, Deserializer};
|
||||
use serde_json::Value as JsonValue;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use super::{Event, EventHandler};
|
||||
|
||||
use std::{
|
||||
|
||||
@@ -139,7 +139,7 @@ pub type Result<T> = std::result::Result<T, Error>;
|
||||
pub type SyncTask = Box<dyn FnOnce() + Send>;
|
||||
|
||||
use serde::Serialize;
|
||||
use std::{collections::HashMap, fmt, sync::Arc};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
// Export types likely to be used by the application.
|
||||
pub use runtime::http;
|
||||
@@ -239,269 +239,17 @@ pub trait Runtime: runtime::Runtime<EventLoopMessage> {}
|
||||
|
||||
impl<W: runtime::Runtime<EventLoopMessage>> Runtime for W {}
|
||||
|
||||
/// Reads the config file at compile time and generates a [`Context`] based on its content.
|
||||
///
|
||||
/// The default config file path is a `tauri.conf.json` file inside the Cargo manifest directory of
|
||||
/// the crate being built.
|
||||
///
|
||||
/// # Custom Config Path
|
||||
///
|
||||
/// You may pass a string literal to this macro to specify a custom path for the Tauri config file.
|
||||
/// If the path is relative, it will be search for relative to the Cargo manifest of the compiling
|
||||
/// crate.
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// This macro should not be called if you are using [`tauri-build`] to generate the context from
|
||||
/// inside your build script as it will just cause excess computations that will be discarded. Use
|
||||
/// either the [`tauri-build`] method or this macro - not both.
|
||||
///
|
||||
/// [`tauri-build`]: https://docs.rs/tauri-build
|
||||
pub use tauri_macros::generate_context;
|
||||
|
||||
/// Include a [`Context`] that was generated by [`tauri-build`] inside your build script.
|
||||
///
|
||||
/// You should either use [`tauri-build`] and this macro to include the compile time generated code,
|
||||
/// or [`generate_context!`]. Do not use both at the same time, as they generate the same code and
|
||||
/// will cause excess computations that will be discarded.
|
||||
///
|
||||
/// [`tauri-build`]: https://docs.rs/tauri-build
|
||||
#[macro_export]
|
||||
macro_rules! tauri_build_context {
|
||||
macro_rules! build_script_context {
|
||||
() => {
|
||||
include!(concat!(env!("OUT_DIR"), "/tauri-build-context.rs"))
|
||||
};
|
||||
}
|
||||
|
||||
pub use pattern::Pattern;
|
||||
|
||||
/// A icon definition.
|
||||
#[derive(Debug, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub enum Icon {
|
||||
/// Icon from file path.
|
||||
#[cfg(any(feature = "icon-ico", feature = "icon-png"))]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(any(feature = "icon-ico", feature = "icon-png"))))]
|
||||
File(std::path::PathBuf),
|
||||
/// Icon from raw RGBA bytes. Width and height is parsed at runtime.
|
||||
#[cfg(any(feature = "icon-ico", feature = "icon-png"))]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(any(feature = "icon-ico", feature = "icon-png"))))]
|
||||
Raw(Vec<u8>),
|
||||
/// Icon from raw RGBA bytes.
|
||||
Rgba {
|
||||
/// RGBA bytes of the icon image.
|
||||
rgba: Vec<u8>,
|
||||
/// Icon width.
|
||||
width: u32,
|
||||
/// Icon height.
|
||||
height: u32,
|
||||
},
|
||||
}
|
||||
|
||||
impl TryFrom<Icon> for runtime::Icon {
|
||||
type Error = Error;
|
||||
|
||||
fn try_from(icon: Icon) -> Result<Self> {
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
if let Icon::Rgba {
|
||||
rgba,
|
||||
width,
|
||||
height,
|
||||
} = icon
|
||||
{
|
||||
Ok(Self {
|
||||
rgba,
|
||||
width,
|
||||
height,
|
||||
})
|
||||
} else {
|
||||
#[cfg(not(any(feature = "icon-ico", feature = "icon-png")))]
|
||||
panic!("unexpected Icon variant");
|
||||
#[cfg(any(feature = "icon-ico", feature = "icon-png"))]
|
||||
{
|
||||
let bytes = match icon {
|
||||
Icon::File(p) => std::fs::read(p)?,
|
||||
Icon::Raw(r) => r,
|
||||
Icon::Rgba { .. } => unreachable!(),
|
||||
};
|
||||
let extension = infer::get(&bytes)
|
||||
.expect("could not determine icon extension")
|
||||
.extension();
|
||||
match extension {
|
||||
#[cfg(feature = "icon-ico")]
|
||||
"ico" => {
|
||||
let icon_dir = ico::IconDir::read(std::io::Cursor::new(bytes))?;
|
||||
let entry = &icon_dir.entries()[0];
|
||||
Ok(Self {
|
||||
rgba: entry.decode()?.rgba_data().to_vec(),
|
||||
width: entry.width(),
|
||||
height: entry.height(),
|
||||
})
|
||||
}
|
||||
#[cfg(feature = "icon-png")]
|
||||
"png" => {
|
||||
let decoder = png::Decoder::new(std::io::Cursor::new(bytes));
|
||||
let mut reader = decoder.read_info()?;
|
||||
let mut buffer = Vec::new();
|
||||
while let Ok(Some(row)) = reader.next_row() {
|
||||
buffer.extend(row.data());
|
||||
}
|
||||
Ok(Self {
|
||||
rgba: buffer,
|
||||
width: reader.info().width,
|
||||
height: reader.info().height,
|
||||
})
|
||||
}
|
||||
_ => panic!(
|
||||
"image `{extension}` extension not supported; please file a Tauri feature request. `png` or `ico` icons are supported with the `icon-png` and `icon-ico` feature flags"
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// User supplied data required inside of a Tauri application.
|
||||
///
|
||||
/// # Stability
|
||||
/// This is the output of the [`generate_context`] macro, and is not considered part of the stable API.
|
||||
/// Unless you know what you are doing and are prepared for this type to have breaking changes, do not create it yourself.
|
||||
pub struct Context<A: Assets> {
|
||||
pub(crate) config: Config,
|
||||
pub(crate) assets: Arc<A>,
|
||||
pub(crate) default_window_icon: Option<Icon>,
|
||||
pub(crate) app_icon: Option<Vec<u8>>,
|
||||
#[cfg(desktop)]
|
||||
pub(crate) system_tray_icon: Option<Icon>,
|
||||
pub(crate) package_info: PackageInfo,
|
||||
pub(crate) _info_plist: (),
|
||||
pub(crate) pattern: Pattern,
|
||||
}
|
||||
|
||||
impl<A: Assets> fmt::Debug for Context<A> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut d = f.debug_struct("Context");
|
||||
d.field("config", &self.config)
|
||||
.field("default_window_icon", &self.default_window_icon)
|
||||
.field("app_icon", &self.app_icon)
|
||||
.field("package_info", &self.package_info)
|
||||
.field("pattern", &self.pattern);
|
||||
|
||||
#[cfg(desktop)]
|
||||
d.field("system_tray_icon", &self.system_tray_icon);
|
||||
|
||||
d.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Assets> Context<A> {
|
||||
/// The config the application was prepared with.
|
||||
#[inline(always)]
|
||||
pub fn config(&self) -> &Config {
|
||||
&self.config
|
||||
}
|
||||
|
||||
/// A mutable reference to the config the application was prepared with.
|
||||
#[inline(always)]
|
||||
pub fn config_mut(&mut self) -> &mut Config {
|
||||
&mut self.config
|
||||
}
|
||||
|
||||
/// The assets to be served directly by Tauri.
|
||||
#[inline(always)]
|
||||
pub fn assets(&self) -> Arc<A> {
|
||||
self.assets.clone()
|
||||
}
|
||||
|
||||
/// A mutable reference to the assets to be served directly by Tauri.
|
||||
#[inline(always)]
|
||||
pub fn assets_mut(&mut self) -> &mut Arc<A> {
|
||||
&mut self.assets
|
||||
}
|
||||
|
||||
/// The default window icon Tauri should use when creating windows.
|
||||
#[inline(always)]
|
||||
pub fn default_window_icon(&self) -> Option<&Icon> {
|
||||
self.default_window_icon.as_ref()
|
||||
}
|
||||
|
||||
/// A mutable reference to the default window icon Tauri should use when creating windows.
|
||||
#[inline(always)]
|
||||
pub fn default_window_icon_mut(&mut self) -> &mut Option<Icon> {
|
||||
&mut self.default_window_icon
|
||||
}
|
||||
|
||||
/// The icon to use on the system tray UI.
|
||||
#[cfg(desktop)]
|
||||
#[inline(always)]
|
||||
pub fn system_tray_icon(&self) -> Option<&Icon> {
|
||||
self.system_tray_icon.as_ref()
|
||||
}
|
||||
|
||||
/// A mutable reference to the icon to use on the system tray UI.
|
||||
#[cfg(desktop)]
|
||||
#[inline(always)]
|
||||
pub fn system_tray_icon_mut(&mut self) -> &mut Option<Icon> {
|
||||
&mut self.system_tray_icon
|
||||
}
|
||||
|
||||
/// Package information.
|
||||
#[inline(always)]
|
||||
pub fn package_info(&self) -> &PackageInfo {
|
||||
&self.package_info
|
||||
}
|
||||
|
||||
/// A mutable reference to the package information.
|
||||
#[inline(always)]
|
||||
pub fn package_info_mut(&mut self) -> &mut PackageInfo {
|
||||
&mut self.package_info
|
||||
}
|
||||
|
||||
/// The application pattern.
|
||||
#[inline(always)]
|
||||
pub fn pattern(&self) -> &Pattern {
|
||||
&self.pattern
|
||||
}
|
||||
|
||||
/// Create a new [`Context`] from the minimal required items.
|
||||
#[inline(always)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
config: Config,
|
||||
assets: Arc<A>,
|
||||
default_window_icon: Option<Icon>,
|
||||
app_icon: Option<Vec<u8>>,
|
||||
package_info: PackageInfo,
|
||||
info_plist: (),
|
||||
pattern: Pattern,
|
||||
) -> Self {
|
||||
Self {
|
||||
config,
|
||||
assets,
|
||||
default_window_icon,
|
||||
app_icon,
|
||||
#[cfg(desktop)]
|
||||
system_tray_icon: None,
|
||||
package_info,
|
||||
_info_plist: info_plist,
|
||||
pattern,
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the app tray icon.
|
||||
#[cfg(desktop)]
|
||||
#[inline(always)]
|
||||
pub fn set_system_tray_icon(&mut self, icon: Icon) {
|
||||
self.system_tray_icon.replace(icon);
|
||||
}
|
||||
|
||||
/// Sets the app shell scope.
|
||||
#[cfg(shell_scope)]
|
||||
#[inline(always)]
|
||||
pub fn set_shell_scope(&mut self, scope: scope::ShellScopeConfig) {
|
||||
self.shell_scope = scope;
|
||||
}
|
||||
}
|
||||
pub use tauri_utils::{pattern::Pattern, Context, Icon};
|
||||
|
||||
// TODO: expand these docs
|
||||
/// Manages a running application.
|
||||
@@ -588,6 +336,10 @@ pub trait Manager<R: Runtime>: sealed::ManagerBase<R> {
|
||||
///
|
||||
/// Since the managed state is global and must be [`Send`] + [`Sync`], mutations can only happen through interior mutability:
|
||||
///
|
||||
/// ```ignore
|
||||
/// let context = tauri::tauri_build_context!();
|
||||
/// ```
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use std::{collections::HashMap, sync::Mutex};
|
||||
/// use tauri::State;
|
||||
@@ -612,17 +364,22 @@ pub trait Manager<R: Runtime>: sealed::ManagerBase<R> {
|
||||
/// storage.store.lock().unwrap().insert(key, value);
|
||||
/// }
|
||||
///
|
||||
/// # let context = tauri_codegen_test::context();
|
||||
/// tauri::Builder::default()
|
||||
/// .manage(Storage { store: Default::default() })
|
||||
/// .manage(DbConnection { db: Default::default() })
|
||||
/// .invoke_handler(tauri::generate_handler![connect, storage_insert])
|
||||
/// // on an actual app, remove the string argument
|
||||
/// .run(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
|
||||
/// .run(context)
|
||||
/// .expect("error while running tauri application");
|
||||
/// ```
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```ignore
|
||||
/// let context = tauri::tauri_build_context!();
|
||||
/// ```
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use tauri::{Manager, State};
|
||||
///
|
||||
@@ -639,6 +396,7 @@ pub trait Manager<R: Runtime>: sealed::ManagerBase<R> {
|
||||
/// println!("state: {}", state.inner().0);
|
||||
/// }
|
||||
///
|
||||
/// # let context = tauri_codegen_test::context();
|
||||
/// tauri::Builder::default()
|
||||
/// .setup(|app| {
|
||||
/// app.manage(MyInt(0));
|
||||
@@ -655,7 +413,7 @@ pub trait Manager<R: Runtime>: sealed::ManagerBase<R> {
|
||||
/// })
|
||||
/// .invoke_handler(tauri::generate_handler![int_command, string_command])
|
||||
/// // on an actual app, remove the string argument
|
||||
/// .run(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
|
||||
/// .run(context)
|
||||
/// .expect("error while running tauri application");
|
||||
/// ```
|
||||
fn manage<T>(&self, state: T) -> bool
|
||||
|
||||
@@ -1093,13 +1093,13 @@ impl<R: Runtime> WindowManager<R> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::{generate_context, plugin::PluginStore, StateManager, Wry};
|
||||
use crate::{plugin::PluginStore, StateManager, Wry};
|
||||
|
||||
use super::WindowManager;
|
||||
|
||||
#[test]
|
||||
fn check_get_url() {
|
||||
let context = generate_context!("test/fixture/src-tauri/tauri.conf.json", crate);
|
||||
let context = tauri_codegen_test::context();
|
||||
let manager: WindowManager<Wry> = WindowManager::with_handlers(
|
||||
context,
|
||||
PluginStore::default(),
|
||||
@@ -1277,6 +1277,7 @@ impl<R: Runtime> WindowManager<R> {
|
||||
app_handle.clone(),
|
||||
web_resource_request_handler,
|
||||
)?;
|
||||
|
||||
pending.ipc_handler = Some(self.prepare_ipc_handler());
|
||||
|
||||
// in `Windows`, we need to force a data_directory
|
||||
|
||||
@@ -2,62 +2,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use std::marker::PhantomData;
|
||||
#[cfg(feature = "isolation")]
|
||||
use std::sync::Arc;
|
||||
|
||||
use serde::Serialize;
|
||||
use serialize_to_javascript::{default_template, Template};
|
||||
|
||||
use tauri_utils::assets::{Assets, EmbeddedAssets};
|
||||
use tauri_utils::pattern::Pattern;
|
||||
|
||||
/// The domain of the isolation iframe source.
|
||||
pub const ISOLATION_IFRAME_SRC_DOMAIN: &str = "localhost";
|
||||
|
||||
/// An application pattern.
|
||||
#[derive(Debug)]
|
||||
pub enum Pattern<A: Assets = EmbeddedAssets> {
|
||||
/// The brownfield pattern.
|
||||
Brownfield(PhantomData<A>),
|
||||
/// Isolation pattern. Recommended for security purposes.
|
||||
#[cfg(feature = "isolation")]
|
||||
Isolation {
|
||||
/// The HTML served on `isolation://index.html`.
|
||||
assets: Arc<A>,
|
||||
|
||||
/// The schema used for the isolation frames.
|
||||
schema: String,
|
||||
|
||||
/// A random string used to ensure that the message went through the isolation frame.
|
||||
///
|
||||
/// This should be regenerated at runtime.
|
||||
key: String,
|
||||
|
||||
/// Cryptographically secure keys
|
||||
crypto_keys: Box<tauri_utils::pattern::isolation::Keys>,
|
||||
},
|
||||
}
|
||||
|
||||
impl<A: Assets> Clone for Pattern<A> {
|
||||
fn clone(&self) -> Self {
|
||||
match self {
|
||||
Self::Brownfield(a) => Self::Brownfield(*a),
|
||||
#[cfg(feature = "isolation")]
|
||||
Self::Isolation {
|
||||
assets,
|
||||
schema,
|
||||
key,
|
||||
crypto_keys,
|
||||
} => Self::Isolation {
|
||||
assets: assets.clone(),
|
||||
schema: schema.clone(),
|
||||
key: key.clone(),
|
||||
crypto_keys: crypto_keys.clone(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The shape of the JavaScript Pattern config
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "lowercase", tag = "pattern")]
|
||||
|
||||
@@ -63,7 +63,6 @@ pub fn mock_context<A: Assets>(assets: A) -> crate::Context<A> {
|
||||
description: "Tauri test",
|
||||
crate_name: "test",
|
||||
},
|
||||
_info_plist: (),
|
||||
pattern: Pattern::Brownfield(std::marker::PhantomData),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{ "devPath": "http://localhost" }
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 56 KiB |
11
core/tests/tauri-codegen-test/Cargo.toml
Normal file
11
core/tests/tauri-codegen-test/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "tauri-codegen-test"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
tauri = { path = "../../tauri", features = [ ] }
|
||||
tauri-utils = { path = "../../tauri-utils" }
|
||||
7
core/tests/tauri-codegen-test/build.rs
Normal file
7
core/tests/tauri-codegen-test/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
}
|
||||
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 974 B After Width: | Height: | Size: 974 B |
9
core/tests/tauri-codegen-test/src/lib.rs
Normal file
9
core/tests/tauri-codegen-test/src/lib.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pub use tauri_utils::{assets::EmbeddedAssets, Context};
|
||||
|
||||
pub fn context() -> Context<EmbeddedAssets> {
|
||||
tauri::build_script_context!()
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"$schema": "../../../../../core/tauri-config-schema/schema.json",
|
||||
"$schema": "../../tauri-config-schema/schema.json",
|
||||
"build": {
|
||||
"distDir": "../dist",
|
||||
"devPath": "http://localhost:4000"
|
||||
},
|
||||
"tauri": {
|
||||
"bundle": {
|
||||
"identifier": "studio.tauri.example",
|
||||
"identifier": "app.tauri.tauri-codegen-test",
|
||||
"active": true
|
||||
},
|
||||
"windows": [
|
||||
{
|
||||
"title": "Tauri App"
|
||||
"title": "Tauri Codegen Test"
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
53
examples/api/src-tauri/Cargo.lock
generated
53
examples/api/src-tauri/Cargo.lock
generated
@@ -651,7 +651,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"scratch",
|
||||
"syn 2.0.15",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -668,7 +668,7 @@ checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -692,7 +692,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn 2.0.15",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -703,7 +703,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -963,7 +963,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1522,9 +1522,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "infer"
|
||||
version = "0.12.0"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a898e4b7951673fce96614ce5751d13c40fc5674bc2d759288e46c3ab62598b3"
|
||||
checksum = "f551f8c3a39f68f986517db0d1759de85881894fdc7db798bd2a9df9cb04b7fc"
|
||||
dependencies = [
|
||||
"cfb",
|
||||
]
|
||||
@@ -2244,6 +2244,16 @@ version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b69d39aab54d069e7f2fe8cb970493e7834601ca2d8c65fd7bbd183578080d1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "1.3.1"
|
||||
@@ -2286,9 +2296,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.56"
|
||||
version = "1.0.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
|
||||
checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -2304,9 +2314,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.26"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
|
||||
checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -2609,7 +2619,7 @@ checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2631,7 +2641,7 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2680,7 +2690,7 @@ dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2877,9 +2887,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.15"
|
||||
version = "2.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822"
|
||||
checksum = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3022,11 +3032,13 @@ dependencies = [
|
||||
"cargo_toml",
|
||||
"heck",
|
||||
"json-patch",
|
||||
"prettyplease",
|
||||
"quote",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"swift-rs",
|
||||
"syn 2.0.17",
|
||||
"tauri-codegen",
|
||||
"tauri-utils",
|
||||
"tauri-winres",
|
||||
@@ -3158,15 +3170,18 @@ dependencies = [
|
||||
"aes-gcm",
|
||||
"brotli",
|
||||
"ctor",
|
||||
"embed_plist",
|
||||
"getrandom 0.2.9",
|
||||
"glob",
|
||||
"heck",
|
||||
"html5ever",
|
||||
"infer 0.12.0",
|
||||
"ico 0.2.0",
|
||||
"infer 0.13.0",
|
||||
"json-patch",
|
||||
"kuchiki",
|
||||
"memchr",
|
||||
"phf 0.10.1",
|
||||
"png",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"semver",
|
||||
@@ -3246,7 +3261,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3406,7 +3421,7 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
"syn 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -11,7 +11,7 @@ name = "api_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../../core/tauri-build", features = ["codegen", "isolation"] }
|
||||
tauri-build = { path = "../../../core/tauri-build", features = ["isolation"] }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -3,10 +3,5 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
let mut codegen = tauri_build::CodegenContext::new();
|
||||
if !cfg!(feature = "custom-protocol") {
|
||||
codegen = codegen.dev();
|
||||
}
|
||||
codegen.build();
|
||||
tauri_build::build();
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ pub fn run() {
|
||||
cmd::log_operation,
|
||||
cmd::perform_request,
|
||||
])
|
||||
.build(tauri::tauri_build_context!())
|
||||
.build(tauri::build_script_context!())
|
||||
.expect("error while building tauri application");
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
|
||||
12
examples/commands/Cargo.toml
Normal file
12
examples/commands/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "commands"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
tauri = { path = "../../core/tauri" }
|
||||
tauri-utils = { path = "../../core/tauri-utils" }
|
||||
7
examples/commands/build.rs
Normal file
7
examples/commands/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
}
|
||||
@@ -252,8 +252,6 @@ fn main() {
|
||||
future_simple_command_with_result,
|
||||
async_stateful_command_with_result,
|
||||
])
|
||||
.run(tauri::generate_context!(
|
||||
"../../examples/commands/tauri.conf.json"
|
||||
))
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
11
examples/helloworld/Cargo.toml
Normal file
11
examples/helloworld/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "helloworld"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
tauri = { path = "../../core/tauri" }
|
||||
tauri-utils = { path = "../../core/tauri-utils" }
|
||||
7
examples/helloworld/build.rs
Normal file
7
examples/helloworld/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
}
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.run(tauri::generate_context!(
|
||||
"../../examples/navigation/tauri.conf.json"
|
||||
))
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
11
examples/isolation/Cargo.toml
Normal file
11
examples/isolation/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "isolation"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../core/tauri-build", features = ["isolation"] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { path = "../../core/tauri", features = ["isolation"] }
|
||||
tauri-utils = { path = "../../core/tauri-utils" }
|
||||
7
examples/isolation/build.rs
Normal file
7
examples/isolation/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
}
|
||||
@@ -11,17 +11,9 @@ fn ping() {
|
||||
dbg!(format!("ping: {:?}", Instant::now()));
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "isolation"))]
|
||||
fn main() {
|
||||
compile_error!("Feature `isolation` is required to run this example");
|
||||
}
|
||||
|
||||
#[cfg(feature = "isolation")]
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![ping])
|
||||
.run(tauri::generate_context!(
|
||||
"../../examples/isolation/tauri.conf.json"
|
||||
))
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
11
examples/multiwindow/Cargo.toml
Normal file
11
examples/multiwindow/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "multiwindow"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
tauri = { path = "../../core/tauri", features = [ ] }
|
||||
tauri-utils = { path = "../../core/tauri-utils" }
|
||||
7
examples/multiwindow/build.rs
Normal file
7
examples/multiwindow/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
}
|
||||
@@ -2,11 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use tauri::WindowBuilder;
|
||||
|
||||
fn main() {
|
||||
pub fn main() {
|
||||
tauri::Builder::default()
|
||||
.on_page_load(|window, _payload| {
|
||||
let label = window.label().to_string();
|
||||
@@ -28,8 +26,6 @@ fn main() {
|
||||
let _window = builder.title("Tauri - Rust").build()?;
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!(
|
||||
"../../examples/multiwindow/tauri.conf.json"
|
||||
))
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("failed to run tauri application");
|
||||
}
|
||||
13
examples/multiwindow/src/main.rs
Normal file
13
examples/multiwindow/src/main.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
#[cfg(desktop)]
|
||||
mod desktop;
|
||||
|
||||
fn main() {
|
||||
#[cfg(desktop)]
|
||||
desktop::main();
|
||||
}
|
||||
11
examples/navigation/Cargo.toml
Normal file
11
examples/navigation/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "navigation"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
tauri = { path = "../../core/tauri", features = [ ] }
|
||||
tauri-utils = { path = "../../core/tauri-utils" }
|
||||
7
examples/navigation/build.rs
Normal file
7
examples/navigation/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
}
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.run(tauri::generate_context!(
|
||||
"../../examples/helloworld/tauri.conf.json"
|
||||
))
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
11
examples/parent-window/Cargo.toml
Normal file
11
examples/parent-window/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "parent-window"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
tauri = { path = "../../core/tauri" }
|
||||
tauri-utils = { path = "../../core/tauri-utils" }
|
||||
7
examples/parent-window/build.rs
Normal file
7
examples/parent-window/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
}
|
||||
@@ -2,8 +2,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use tauri::{command, window::WindowBuilder, Window, WindowUrl};
|
||||
|
||||
#[command]
|
||||
@@ -20,7 +18,7 @@ async fn create_child_window(id: String, window: Window) {
|
||||
child.build().unwrap();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
pub fn main() {
|
||||
tauri::Builder::default()
|
||||
.on_page_load(|window, _payload| {
|
||||
let label = window.label().to_string();
|
||||
@@ -36,8 +34,6 @@ fn main() {
|
||||
.build()?;
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!(
|
||||
"../../examples/parent-window/tauri.conf.json"
|
||||
))
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("failed to run tauri application");
|
||||
}
|
||||
13
examples/parent-window/src/main.rs
Normal file
13
examples/parent-window/src/main.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
#[cfg(desktop)]
|
||||
mod desktop;
|
||||
|
||||
fn main() {
|
||||
#[cfg(desktop)]
|
||||
desktop::main();
|
||||
}
|
||||
@@ -6,7 +6,7 @@ edition = "2021"
|
||||
rust-version = "1.65"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] }
|
||||
tauri-build = { path = "../../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -37,6 +37,6 @@ fn main() {
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
11
examples/splashscreen/Cargo.toml
Normal file
11
examples/splashscreen/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "splashscreen"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
tauri = { path = "../../core/tauri" }
|
||||
tauri-utils = { path = "../../core/tauri-utils" }
|
||||
7
examples/splashscreen/build.rs
Normal file
7
examples/splashscreen/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![cfg(desktop)]
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
// Application code for a splashscreen system that waits on a Rust initialization script
|
||||
@@ -83,10 +84,10 @@ mod ui {
|
||||
}
|
||||
|
||||
fn context() -> tauri::Context<tauri::utils::assets::EmbeddedAssets> {
|
||||
tauri::generate_context!("../../examples/splashscreen/tauri.conf.json")
|
||||
tauri::build_script_context!()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
pub fn main() {
|
||||
// toggle this flag to experiment with different splashscreen usages
|
||||
let ui = false;
|
||||
if ui {
|
||||
13
examples/splashscreen/src/main.rs
Normal file
13
examples/splashscreen/src/main.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
#[cfg(desktop)]
|
||||
mod desktop;
|
||||
|
||||
fn main() {
|
||||
#[cfg(desktop)]
|
||||
desktop::main();
|
||||
}
|
||||
11
examples/state/Cargo.toml
Normal file
11
examples/state/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "state"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
tauri = { path = "../../core/tauri" }
|
||||
tauri-utils = { path = "../../core/tauri-utils" }
|
||||
7
examples/state/build.rs
Normal file
7
examples/state/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
}
|
||||
@@ -78,8 +78,6 @@ fn main() {
|
||||
disconnect,
|
||||
connection_send
|
||||
])
|
||||
.run(tauri::generate_context!(
|
||||
"../../examples/state/tauri.conf.json"
|
||||
))
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
12
examples/streaming/Cargo.toml
Normal file
12
examples/streaming/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "streaming"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
percent-encoding = "2"
|
||||
tauri = { path = "../../core/tauri" }
|
||||
tauri-utils = { path = "../../core/tauri-utils" }
|
||||
7
examples/streaming/build.rs
Normal file
7
examples/streaming/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
}
|
||||
@@ -107,9 +107,7 @@ fn main() {
|
||||
|
||||
response.mimetype("video/mp4").status(status_code).body(buf)
|
||||
})
|
||||
.run(tauri::generate_context!(
|
||||
"../../examples/streaming/tauri.conf.json"
|
||||
))
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ rust-version = "1.65"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] }
|
||||
tauri-build = { path = "../../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
#[no_mangle]
|
||||
pub extern "C" fn run_tauri() {
|
||||
tauri::Builder::default()
|
||||
.run(tauri::generate_context!("./tauri.conf.json"))
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ fn greet(window: tauri::Window, name: String) {
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![greet])
|
||||
.run(tauri::generate_context!())
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
fn main() {
|
||||
core_api::run();
|
||||
tauri::Builder::default()
|
||||
.run(tauri::generate_context!())
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2021"
|
||||
rust-version = "1.65"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" ] }
|
||||
tauri-build = { path = "../../../../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -12,6 +12,6 @@ fn app_completed_successfully() {
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![app_completed_successfully])
|
||||
.run(tauri::generate_context!())
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2021"
|
||||
rust-version = "1.65"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" ] }
|
||||
tauri-build = { path = "../../../../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -12,6 +12,6 @@ fn app_should_close(exit_code: i32) {
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![app_should_close])
|
||||
.run(tauri::generate_context!())
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2021"
|
||||
rust-version = "1.65"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" ] }
|
||||
tauri-build = { path = "../../../../../core/tauri-build" }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -12,6 +12,6 @@ fn app_loaded_successfully() {
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![app_loaded_successfully])
|
||||
.run(tauri::generate_context!())
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
32
tooling/cli/Cargo.lock
generated
32
tooling/cli/Cargo.lock
generated
@@ -1020,6 +1020,12 @@ dependencies = [
|
||||
"winreg 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embed_plist"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
version = "0.3.6"
|
||||
@@ -1685,6 +1691,16 @@ dependencies = [
|
||||
"cxx-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ico"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "031530fe562d8c8d71c0635013d6d155bbfe8ba0aa4b4d2d24ce8af6b71047bd"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"png",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
version = "1.0.1"
|
||||
@@ -1776,6 +1792,15 @@ dependencies = [
|
||||
"cfb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "infer"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f551f8c3a39f68f986517db0d1759de85881894fdc7db798bd2a9df9cb04b7fc"
|
||||
dependencies = [
|
||||
"cfb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify"
|
||||
version = "0.9.6"
|
||||
@@ -3988,7 +4013,7 @@ dependencies = [
|
||||
"getrandom 0.2.9",
|
||||
"heck",
|
||||
"html5ever",
|
||||
"infer",
|
||||
"infer 0.12.0",
|
||||
"json-patch 1.0.0",
|
||||
"json5",
|
||||
"kuchiki",
|
||||
@@ -4012,16 +4037,19 @@ version = "2.0.0-alpha.5"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"ctor 0.1.26",
|
||||
"embed_plist",
|
||||
"getrandom 0.2.9",
|
||||
"glob",
|
||||
"heck",
|
||||
"html5ever",
|
||||
"infer",
|
||||
"ico",
|
||||
"infer 0.13.0",
|
||||
"json-patch 1.0.0",
|
||||
"json5",
|
||||
"kuchiki",
|
||||
"memchr",
|
||||
"phf 0.10.1",
|
||||
"png",
|
||||
"schemars",
|
||||
"semver",
|
||||
"serde",
|
||||
|
||||
@@ -19,6 +19,6 @@ fn main() {
|
||||
window.eval("window.onTauriInit()").unwrap();
|
||||
})
|
||||
.invoke_handler(tauri::generate_handler![exit])
|
||||
.run(tauri::generate_context!())
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error encountered while running tauri application");
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use super::{SectionItem, Status};
|
||||
|
||||
use colored::Colorize;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.run(tauri::generate_context!())
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![greet])
|
||||
.plugin(tauri_plugin_{{ plugin_name_snake_case }}::init())
|
||||
.run(tauri::generate_context!())
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_{{ plugin_name_snake_case }}::init())
|
||||
.run(tauri::generate_context!())
|
||||
.run(tauri::build_script_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user