merge from 1.x

This commit is contained in:
Lucas Nogueira 2024-02-19 08:03:05 -03:00
commit c426c0dca2
No known key found for this signature in database
GPG Key ID: FFEA6C72E73482F1
44 changed files with 6887 additions and 932 deletions

2
.gitignore vendored
View File

@ -73,7 +73,7 @@ TODO.md
target
# lock for libs
/Cargo.lock
#/Cargo.lock Committed to prevent msrv checks from failing
/tooling/bench/tests/Cargo.lock
/yarn.lock

5599
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -174,6 +174,13 @@
- First mobile alpha release!
- [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08
## \[1.5.1]
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
- Upgraded to `tauri-codegen@1.4.2`
## \[1.5.0]
### What's Changed

View File

@ -135,6 +135,12 @@
- First mobile alpha release!
- [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08
## \[1.4.2]
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
## \[1.4.1]
### Dependencies

View File

@ -17,14 +17,16 @@ sha2 = "0.10"
base64 = "0.21"
proc-macro2 = "1"
quote = "1"
serde = { version = "1", features = [ "derive" ] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tauri-utils = { version = "2.0.0-beta.1", path = "../tauri-utils", features = [ "build" ] }
thiserror = "1"
walkdir = "2"
brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] }
brotli = { version = "3", optional = true, default-features = false, features = [
"std",
] }
regex = { version = "1", optional = true }
uuid = { version = "1", features = [ "v4" ] }
uuid = { version = "1", features = ["v4"] }
semver = "1"
ico = "0.3"
png = "0.17"
@ -33,7 +35,7 @@ url = "2"
[target."cfg(target_os = \"macos\")".dependencies]
plist = "1"
time = { version = "0.3", features = [ "parsing", "formatting" ] }
time = { version = "0.3", features = ["parsing", "formatting"] }
[features]
default = [ "compression" ]

View File

@ -2455,6 +2455,27 @@
"string",
"null"
]
},
"section": {
"description": "Define the section in Debian Control file. See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections",
"type": [
"string",
"null"
]
},
"priority": {
"description": "Change the priority of the Debian Package. By default, it is set to `optional`. Recognized Priorities as of now are : `required`, `important`, `standard`, `optional`, `extra`",
"type": [
"string",
"null"
]
},
"changelog": {
"description": "Path of the uncompressed Changelog file, to be stored at /usr/share/doc/package-name/changelog.gz. See https://www.debian.org/doc/debian-policy/ch-docs.html#changelog-files-and-release-notes",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false

View File

@ -141,6 +141,13 @@
- First mobile alpha release!
- [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08
## \[1.4.3]
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
- Upgraded to `tauri-codegen@1.4.2`
## \[1.4.2]
### Enhancements

View File

@ -16,7 +16,7 @@ rust-version = { workspace = true }
proc-macro = true
[dependencies]
proc-macro2 = { version = "1", features = [ "span-locations" ] }
proc-macro2 = { version = "1", features = ["span-locations"] }
quote = "1"
syn = { version = "2", features = [ "full" ] }
heck = "0.4"

View File

@ -47,10 +47,6 @@
- [`d621d343`](https://www.github.com/tauri-apps/tauri/commit/d621d3437ce3947175eecf345b2c6d1c4c7ce020)([#8607](https://www.github.com/tauri-apps/tauri/pull/8607)) Added tracing for window startup, plugins, `Window::eval`, events, IPC, updater and custom protocol request handlers behind the `tracing` feature flag.
### Bug Fixes
- [`0d0501cb`](https://www.github.com/tauri-apps/tauri/commit/0d0501cb7b5e767c51a3697a148acfe84211a7ad)([#8394](https://www.github.com/tauri-apps/tauri/pull/8394)) Use `arboard` instead of `tao` clipboard implementation to prevent a crash.
### What's Changed
- [`cb640c8e`](https://www.github.com/tauri-apps/tauri/commit/cb640c8e949a3d78d78162e2e61b51bf8afae983)([#8393](https://www.github.com/tauri-apps/tauri/pull/8393)) Fix `RunEvent::WindowEvent(event: WindowEvent::FileDrop(FileDropEvent))` never triggered and always prevent default OS behavior when `disable_file_drop_handler` is not used.
@ -220,6 +216,25 @@
- Support `with_webview` for Android platform alowing execution of JNI code in context.
- [8ea87e9c](https://www.github.com/tauri-apps/tauri/commit/8ea87e9c9ca8ba4c7017c8281f78aacd08f45785) feat(android): with_webview access for jni execution ([#5148](https://www.github.com/tauri-apps/tauri/pull/5148)) on 2022-09-08
## \[0.14.4]
### Bug Fixes
- [`24210735`](https://www.github.com/tauri-apps/tauri/commit/2421073576a6d45783176be57b0188668558aff7)([#8117](https://www.github.com/tauri-apps/tauri/pull/8117)) Fixes a crash on macOS when accessing the windows map.
- [`510b6226`](https://www.github.com/tauri-apps/tauri/commit/510b62261c70331ce3f5bfd24137dac1bc4a0bbe)([#8822](https://www.github.com/tauri-apps/tauri/pull/8822)) Add missing `arboard` feature flag to prevent panics in wayland session.
## \[0.14.3]
### Bug Fixes
- [`0d0501cb`](https://www.github.com/tauri-apps/tauri/commit/0d0501cb7b5e767c51a3697a148acfe84211a7ad)([#8394](https://www.github.com/tauri-apps/tauri/pull/8394)) Use `arboard` instead of `tao` clipboard implementation to prevent a crash.
- [`b2f83f03`](https://www.github.com/tauri-apps/tauri/commit/b2f83f03a872baa91e2b6bbb22a3e7a5cd975dc0)([#8402](https://www.github.com/tauri-apps/tauri/pull/8402)) Use `Arc` instead of `Rc` to prevent crashes on macOS.
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
- Upgraded to `tauri-runtime@0.14.2`
## \[0.14.2]
### Enhancements

View File

@ -45,7 +45,7 @@ devtools = [ "wry/devtools", "tauri-runtime/devtools" ]
macos-private-api = [
"wry/fullscreen",
"wry/transparent",
"tauri-runtime/macos-private-api"
"tauri-runtime/macos-private-api",
]
objc-exception = [ "wry/objc-exception" ]
linux-protocol-body = [ "wry/linux-body", "webkit2gtk/v2_40" ]

View File

@ -12,6 +12,7 @@
)]
use raw_window_handle::{DisplayHandle, HasDisplayHandle, HasWindowHandle};
use tauri_runtime::{
monitor::Monitor,
webview::{DetachedWebview, DownloadEvent, PendingWebview, WebviewIpcHandler},
@ -97,7 +98,7 @@ use std::{
cell::RefCell,
collections::{
hash_map::Entry::{Occupied, Vacant},
HashMap,
BTreeMap, HashMap,
},
fmt,
ops::Deref,
@ -357,11 +358,23 @@ pub enum ActiveTracingSpan {
},
}
#[derive(Debug)]
pub struct WindowsStore(RefCell<BTreeMap<WindowId, WindowWrapper>>);
// SAFETY: we ensure this type is only used on the main thread.
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for WindowsStore {}
// SAFETY: we ensure this type is only used on the main thread.
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Sync for WindowsStore {}
#[derive(Debug, Clone)]
pub struct DispatcherMainThreadContext<T: UserEvent> {
pub window_target: EventLoopWindowTarget<Message<T>>,
pub web_context: WebContextStore,
pub windows: Rc<RefCell<HashMap<WindowId, WindowWrapper>>>,
// changing this to an Rc will cause frequent app crashes.
pub windows: Arc<WindowsStore>,
#[cfg(feature = "tracing")]
pub active_tracing_spans: ActiveTraceSpanStore,
}
@ -2115,7 +2128,7 @@ impl<T: UserEvent> Wry<T> {
let main_thread_id = current_thread().id();
let web_context = WebContextStore::default();
let windows = Rc::new(RefCell::new(HashMap::default()));
let windows = Arc::new(WindowsStore(RefCell::new(BTreeMap::default())));
let window_id_map = WindowIdStore::default();
let context = Context {
@ -2216,6 +2229,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
.context
.main_thread
.windows
.0
.borrow_mut()
.insert(window_id, window);
@ -2247,6 +2261,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
.context
.main_thread
.windows
.0
.borrow()
.get(&window_id)
.and_then(|w| w.inner.clone());
@ -2266,6 +2281,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
.context
.main_thread
.windows
.0
.borrow_mut()
.get_mut(&window_id)
.map(|w| {
@ -2329,7 +2345,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
}
#[cfg(desktop)]
fn run_iteration<F: FnMut(RunEvent<T>)>(&mut self, mut callback: F) {
fn run_iteration<F: FnMut(RunEvent<T>) + 'static>(&mut self, mut callback: F) {
use tao::platform::run_return::EventLoopExtRunReturn;
let windows = self.context.main_thread.windows.clone();
let window_id_map = self.context.window_id_map.clone();
@ -2431,15 +2447,15 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
}
pub struct EventLoopIterationContext<'a, T: UserEvent> {
pub callback: &'a mut (dyn FnMut(RunEvent<T>)),
pub callback: &'a mut (dyn FnMut(RunEvent<T>) + 'static),
pub window_id_map: WindowIdStore,
pub windows: Rc<RefCell<HashMap<WindowId, WindowWrapper>>>,
pub windows: Arc<WindowsStore>,
#[cfg(feature = "tracing")]
pub active_tracing_spans: ActiveTraceSpanStore,
}
struct UserMessageContext {
windows: Rc<RefCell<HashMap<WindowId, WindowWrapper>>>,
windows: Arc<WindowsStore>,
window_id_map: WindowIdStore,
}
@ -2469,7 +2485,7 @@ fn handle_user_message<T: UserEvent>(
}
},
Message::Window(id, window_message) => {
let w = windows.borrow().get(&id).map(|w| {
let w = windows.0.borrow().get(&id).map(|w| {
(
w.inner.clone(),
w.webviews.clone(),
@ -2616,7 +2632,7 @@ fn handle_user_message<T: UserEvent>(
window.set_fullscreen(None)
}
#[cfg(windows)]
if let Some(w) = windows.borrow_mut().get_mut(&id) {
if let Some(w) = windows.0.borrow_mut().get_mut(&id) {
w.is_window_fullscreen = fullscreen;
}
}
@ -2672,7 +2688,7 @@ fn handle_user_message<T: UserEvent>(
}
Message::Webview(window_id, webview_id, webview_message) => {
let webview_handle = windows.borrow().get(&window_id).map(|w| {
let webview_handle = windows.0.borrow().get(&window_id).map(|w| {
(
w.inner.clone(),
w.webviews.iter().find(|w| w.id == webview_id).cloned(),
@ -2710,7 +2726,7 @@ fn handle_user_message<T: UserEvent>(
let _ = webview.print();
}
WebviewMessage::Close => {
windows.borrow_mut().get_mut(&window_id).map(|window| {
windows.0.borrow_mut().get_mut(&window_id).map(|window| {
if let Some(i) = window.webviews.iter().position(|w| w.id == webview.id) {
window.webviews.remove(i);
}
@ -2827,13 +2843,14 @@ fn handle_user_message<T: UserEvent>(
}
Message::CreateWebview(window_id, handler) => {
let window = windows
.0
.borrow()
.get(&window_id)
.and_then(|w| w.inner.clone());
if let Some(window) = window {
match handler(&window) {
Ok(webview) => {
windows.borrow_mut().get_mut(&window_id).map(|w| {
windows.0.borrow_mut().get_mut(&window_id).map(|w| {
w.webviews.push(webview);
w
});
@ -2846,7 +2863,7 @@ fn handle_user_message<T: UserEvent>(
}
Message::CreateWindow(window_id, handler) => match handler(event_loop) {
Ok(webview) => {
windows.borrow_mut().insert(window_id, webview);
windows.0.borrow_mut().insert(window_id, webview);
}
Err(e) => {
debug_eprintln!("{}", e);
@ -2881,7 +2898,7 @@ fn handle_user_message<T: UserEvent>(
None
};
windows.borrow_mut().insert(
windows.0.borrow_mut().insert(
window_id,
WindowWrapper {
label,
@ -2945,7 +2962,7 @@ fn handle_event_loop<T: UserEvent>(
Event::RedrawRequested(id) => {
#[cfg(windows)]
if let Some(window_id) = window_id_map.get(&id) {
let mut windows_ref = windows.borrow_mut();
let mut windows_ref = windows.0.borrow_mut();
if let Some(window) = windows_ref.get_mut(&window_id) {
if window.is_window_transparent {
if let Some(surface) = &mut window.surface {
@ -2966,7 +2983,7 @@ fn handle_event_loop<T: UserEvent>(
webview_id,
WebviewMessage::WebviewEvent(event),
)) => {
let windows_ref = windows.borrow();
let windows_ref = windows.0.borrow();
if let Some(window) = windows_ref.get(&window_id) {
if let Some(webview) = window.webviews.iter().find(|w| w.id == webview_id) {
let label = webview.label.clone();
@ -2993,7 +3010,7 @@ fn handle_event_loop<T: UserEvent>(
WebviewMessage::SynthesizedWindowEvent(event),
)) => {
if let Some(event) = WindowEventWrapper::from(event).0 {
let windows_ref = windows.borrow();
let windows_ref = windows.0.borrow();
let window = windows_ref.get(&window_id);
if let Some(window) = window {
let label = window.label.clone();
@ -3020,7 +3037,7 @@ fn handle_event_loop<T: UserEvent>(
} => {
if let Some(window_id) = window_id_map.get(&window_id) {
{
let windows_ref = windows.borrow();
let windows_ref = windows.0.borrow();
if let Some(window) = windows_ref.get(&window_id) {
if let Some(event) = WindowEventWrapper::parse(window, &event).0 {
let label = window.label.clone();
@ -3044,7 +3061,7 @@ fn handle_event_loop<T: UserEvent>(
match event {
#[cfg(windows)]
TaoWindowEvent::ThemeChanged(theme) => {
if let Some(window) = windows.borrow().get(&window_id) {
if let Some(window) = windows.0.borrow().get(&window_id) {
for webview in &window.webviews {
let theme = match theme {
TaoTheme::Dark => wry::Theme::Dark,
@ -3059,9 +3076,9 @@ fn handle_event_loop<T: UserEvent>(
on_close_requested(callback, window_id, windows.clone());
}
TaoWindowEvent::Destroyed => {
let removed = windows.borrow_mut().remove(&window_id).is_some();
let removed = windows.0.borrow_mut().remove(&window_id).is_some();
if removed {
let is_empty = windows.borrow().is_empty();
let is_empty = windows.0.borrow().is_empty();
if is_empty {
let (tx, rx) = channel();
callback(RunEvent::ExitRequested { code: None, tx });
@ -3076,7 +3093,12 @@ fn handle_event_loop<T: UserEvent>(
}
}
TaoWindowEvent::Resized(size) => {
if let Some(webviews) = windows.borrow().get(&window_id).map(|w| w.webviews.clone()) {
if let Some(webviews) = windows
.0
.borrow()
.get(&window_id)
.map(|w| w.webviews.clone())
{
for webview in webviews {
if let Some(bounds) = &webview.bounds {
let b = bounds.lock().unwrap();
@ -3135,13 +3157,13 @@ fn handle_event_loop<T: UserEvent>(
}
}
fn on_close_requested<T: UserEvent>(
callback: &mut (dyn FnMut(RunEvent<T>)),
fn on_close_requested<'a, T: UserEvent>(
callback: &'a mut (dyn FnMut(RunEvent<T>) + 'static),
window_id: WindowId,
windows: Rc<RefCell<HashMap<WindowId, WindowWrapper>>>,
windows: Arc<WindowsStore>,
) {
let (tx, rx) = channel();
let windows_ref = windows.borrow();
let windows_ref = windows.0.borrow();
if let Some(w) = windows_ref.get(&window_id) {
let label = w.label.clone();
let window_event_listeners = w.window_event_listeners.clone();
@ -3166,8 +3188,8 @@ fn on_close_requested<T: UserEvent>(
}
}
fn on_window_close(window_id: WindowId, windows: Rc<RefCell<HashMap<WindowId, WindowWrapper>>>) {
if let Some(window_wrapper) = windows.borrow_mut().get_mut(&window_id) {
fn on_window_close(window_id: WindowId, windows: Arc<WindowsStore>) {
if let Some(window_wrapper) = windows.0.borrow_mut().get_mut(&window_id) {
window_wrapper.inner = None;
#[cfg(windows)]
window_wrapper.surface.take();

View File

@ -157,7 +157,7 @@ mod windows {
request: &str,
) -> bool {
if let Some(args) = request.strip_prefix(MESSAGE_MOUSEMOVE) {
if let Some(window) = context.main_thread.windows.borrow().get(&window_id) {
if let Some(window) = context.main_thread.windows.0.borrow().get(&window_id) {
if let Some(w) = window.inner.as_ref() {
if !w.is_decorated()
&& w.is_resizable()
@ -178,7 +178,7 @@ mod windows {
return true;
}
if let Some(args) = request.strip_prefix(MESSAGE_MOUSEDOWN) {
if let Some(window) = context.main_thread.windows.borrow().get(&window_id) {
if let Some(window) = context.main_thread.windows.0.borrow().get(&window_id) {
if let Some(w) = window.inner.as_ref() {
if !w.is_decorated()
&& w.is_resizable()

View File

@ -186,6 +186,12 @@
- Bumped due to a bump in tauri-utils.
- [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08
## \[0.14.2]
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
## \[0.14.1]
### Enhancements

View File

@ -26,7 +26,7 @@ targets = [
]
[dependencies]
serde = { version = "1.0", features = [ "derive" ] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
tauri-utils = { version = "2.0.0-beta.1", path = "../tauri-utils" }

View File

@ -356,7 +356,7 @@ pub trait Runtime<T: UserEvent>: Debug + Sized + 'static {
/// Runs an iteration of the runtime event loop and returns control flow to the caller.
#[cfg(desktop)]
fn run_iteration<F: FnMut(RunEvent<T>)>(&mut self, callback: F);
fn run_iteration<F: FnMut(RunEvent<T>) + 'static>(&mut self, callback: F);
/// Run the webview runtime.
fn run<F: FnMut(RunEvent<T>) + 'static>(self, callback: F);

View File

@ -460,7 +460,7 @@ impl<T: UserEvent, R: Runtime<T>> PendingWindow<T, R> {
}
/// Identifier of a window.
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub struct WindowId(u32);
impl From<u32> for WindowId {

View File

@ -164,6 +164,18 @@
## \[1.5.3]
### New features
- [`7aa30dec`](https://www.github.com/tauri-apps/tauri/commit/7aa30dec85a17c3d3faaf3841b93e10991b991b0)([#8620](https://www.github.com/tauri-apps/tauri/pull/8620)) Add `priority`, `section` and `changelog` options in Debian config.
## \[1.5.2]
### Bug Fixes
- [`9b230de7`](https://www.github.com/tauri-apps/tauri/commit/9b230de7bc6690c2733f5324d50b999af1f7a6ef)([#8407](https://www.github.com/tauri-apps/tauri/pull/8407)) Fix compile error when parsing config that includes float values.
## \[1.5.3]
### New Features
- [`b3e53e72`](https://www.github.com/tauri-apps/tauri/commit/b3e53e7243311a2659b7569dddc20c56ac9f9d8e)([#8288](https://www.github.com/tauri-apps/tauri/pull/8288)) Added `Assets::iter` to iterate on all embedded assets.

View File

@ -314,6 +314,14 @@ pub struct DebConfig {
///
/// Available variables: `categories`, `comment` (optional), `exec`, `icon` and `name`.
pub desktop_template: Option<PathBuf>,
/// Define the section in Debian Control file. See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
pub section: Option<String>,
/// Change the priority of the Debian Package. By default, it is set to `optional`.
/// Recognized Priorities as of now are : `required`, `important`, `standard`, `optional`, `extra`
pub priority: Option<String>,
/// Path of the uncompressed Changelog file, to be stored at /usr/share/doc/package-name/changelog.gz. See
/// https://www.debian.org/doc/debian-policy/ch-docs.html#changelog-files-and-release-notes
pub changelog: Option<PathBuf>,
}
/// Configuration for Linux bundles.

View File

@ -104,10 +104,6 @@
- [`d621d343`](https://www.github.com/tauri-apps/tauri/commit/d621d3437ce3947175eecf345b2c6d1c4c7ce020)([#8607](https://www.github.com/tauri-apps/tauri/pull/8607)) Added tracing for window startup, plugins, `Window::eval`, events, IPC, updater and custom protocol request handlers behind the `tracing` feature flag.
### Bug Fixes
- [`50a3d170`](https://www.github.com/tauri-apps/tauri/commit/50a3d170f242178d41fe7e8a3adf964541f6fe9c)([#8408](https://www.github.com/tauri-apps/tauri/pull/8408)) On Windows, fix `open` dialog `defaultPath`, when invoked from JS, not working if the path uses forward slash (`/`)
### What's Changed
- [`cb640c8e`](https://www.github.com/tauri-apps/tauri/commit/cb640c8e949a3d78d78162e2e61b51bf8afae983)([#8393](https://www.github.com/tauri-apps/tauri/pull/8393)) Fix `RunEvent::WindowEvent(event: WindowEvent::FileDrop(FileDropEvent))` never triggered and always prevent default OS behavior when `disable_file_drop_handler` is not used.
@ -543,6 +539,44 @@
- Export types required by the `mobile_entry_point` macro.
- [98904863](https://www.github.com/tauri-apps/tauri/commit/9890486321c9c79ccfb7c547fafee85b5c3ffa71) feat(core): add `mobile_entry_point` macro ([#4983](https://www.github.com/tauri-apps/tauri/pull/4983)) on 2022-08-21
## \[1.6.0]
### New Features
- [`6e488378`](https://www.github.com/tauri-apps/tauri/commit/6e48837860203582d2ef8e59d4524f98511a14c0)([#8474](https://www.github.com/tauri-apps/tauri/pull/8474)) Re-export `Url` type.
### Enhancements
- [`8ce51cec`](https://www.github.com/tauri-apps/tauri/commit/8ce51cec3baf4ed88d80c59bf3bbe96fd369c7a0)([#7718](https://www.github.com/tauri-apps/tauri/pull/7718)) On Windows, retain command line args when relaunching the app after an update. Supports NSIS and WiX (without elevated update task).
### Bug Fixes
- [`cc3d8e77`](https://www.github.com/tauri-apps/tauri/commit/cc3d8e77313672f25520e278bbe8fae1b275a735)([#8539](https://www.github.com/tauri-apps/tauri/pull/8539)) Fixes a deadlock when reading a stdout or stderr line returns an error.
- [`b546b42d`](https://www.github.com/tauri-apps/tauri/commit/b546b42db7e75a59232367dd6212fe3b75bb4c6d)([#8577](https://www.github.com/tauri-apps/tauri/pull/8577)) Preserve the order of JS object/map keys in IPC calls. This also fixes issues with the JS `http` module when calling to servers that required a specific order of `FormBody` contents.
- [`8f8729d9`](https://www.github.com/tauri-apps/tauri/commit/8f8729d91843acd2bd2a24731db865d690dd9ab1)([#8312](https://www.github.com/tauri-apps/tauri/pull/8312)) On macOS, allow cancelling maximization when doubleclick happens on `data-tauri-drag-region` by simply keeping the left moust button pressed and then moving the mouse away of the starting position of the click, which is consistent with the native behavior of macOS.
### Dependencies
- Upgraded to `tauri-runtime-wry@0.14.4`
## \[1.5.4]
### Enhancements
- [`3c371aa8`](https://www.github.com/tauri-apps/tauri/commit/3c371aa8ee4032998f859b570702e81e26e77c6c)([#8228](https://www.github.com/tauri-apps/tauri/pull/8228)) Added `test::get_ipc_response`.
### Bug Fixes
- [`50a3d170`](https://www.github.com/tauri-apps/tauri/commit/50a3d170f242178d41fe7e8a3adf964541f6fe9c)([#8408](https://www.github.com/tauri-apps/tauri/pull/8408)) On Windows, fix `open` dialog `defaultPath`, when invoked from JS, not working if the path uses forward slash (`/`)
- [`645e1dcc`](https://www.github.com/tauri-apps/tauri/commit/645e1dcc6e113564e2ddaacf9cb8338aed1a0bd0)([#8404](https://www.github.com/tauri-apps/tauri/pull/8404)) Fix NSIS updater failing to launch when using `basicUi` mode.
### Dependencies
- Upgraded to `tauri-runtime-wry@0.14.3`
- Upgraded to `tauri-utils@1.5.2`
- Upgraded to `tauri-runtime@0.14.2`
- Upgraded to `tauri-macros@1.4.3`
## \[1.5.3]
### Enhancements

View File

@ -118,7 +118,7 @@ tauri-utils = { path = "../tauri-utils/", version = "2.0.0-beta.1", features = [
proptest = "1.4.0"
quickcheck = "1.0.3"
quickcheck_macros = "1.0.0"
serde = { version = "1.0", features = [ "derive" ] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tauri = { path = ".", default-features = false, features = [ "wry" ] }
tokio = { version = "1", features = [ "full" ] }
@ -150,7 +150,7 @@ devtools = [ "tauri-runtime/devtools", "tauri-runtime-wry/devtools" ]
process-relaunch-dangerous-allow-symlink-macos = [ "tauri-utils/process-relaunch-dangerous-allow-symlink-macos" ]
macos-private-api = [
"tauri-runtime/macos-private-api",
"tauri-runtime-wry/macos-private-api"
"tauri-runtime-wry/macos-private-api",
]
webview-data-url = [ "data-url" ]
protocol-asset = [ "http-range" ]

View File

@ -1002,7 +1002,7 @@ impl<R: Runtime> App<R> {
/// }
/// ```
#[cfg(desktop)]
pub fn run_iteration<F: FnMut(&AppHandle<R>, RunEvent)>(&mut self, mut callback: F) {
pub fn run_iteration<F: FnMut(&AppHandle<R>, RunEvent) + 'static>(&mut self, mut callback: F) {
let manager = self.manager.clone();
let app_handle = self.handle().clone();

View File

@ -77,6 +77,8 @@ pub use swift_rs;
pub use tauri_macros::mobile_entry_point;
pub use tauri_macros::{command, generate_handler};
pub use url::Url;
pub(crate) mod app;
pub mod async_runtime;
mod error;

View File

@ -3649,7 +3649,6 @@ dependencies = [
"once_cell",
"parking_lot",
"png",
"raw-window-handle 0.5.2",
"raw-window-handle 0.6.0",
"scopeguard",
"tao-macros",
@ -3705,7 +3704,7 @@ dependencies = [
"objc",
"percent-encoding",
"png",
"raw-window-handle 0.5.2",
"raw-window-handle 0.6.0",
"reqwest",
"serde",
"serde_json",
@ -3835,7 +3834,7 @@ dependencies = [
"gtk",
"http",
"jni",
"raw-window-handle 0.5.2",
"raw-window-handle 0.6.0",
"serde",
"serde_json",
"tauri-utils",
@ -3853,7 +3852,7 @@ dependencies = [
"http",
"jni",
"percent-encoding",
"raw-window-handle 0.5.2",
"raw-window-handle 0.6.0",
"softbuffer",
"tao",
"tauri-runtime",
@ -4665,13 +4664,13 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "window-vibrancy"
version = "0.4.3"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af6abc2b9c56bd95887825a1ce56cde49a2a97c07e28db465d541f5098a2656c"
checksum = "33082acd404763b315866e14a0d5193f3422c81086657583937a750cdd3ec340"
dependencies = [
"cocoa",
"objc",
"raw-window-handle 0.5.2",
"raw-window-handle 0.6.0",
"windows-sys 0.52.0",
"windows-version",
]

View File

@ -23,9 +23,6 @@
## \[2.0.0-alpha.14]
### Bug Fixes
- [`1c582a94`](https://www.github.com/tauri-apps/tauri/commit/1c582a942e345a066b65620e4db9f688ec142bb9)([#8392](https://www.github.com/tauri-apps/tauri/pull/8392)) Fix a regression where typescript could not find types when using `"moduleResolution": "node"`
- [`97e33412`](https://www.github.com/tauri-apps/tauri/commit/97e334129956159bbd60e1c531b6acd3bc6139a6)([#8534](https://www.github.com/tauri-apps/tauri/pull/8534)) `mockIPC` and `mockWindows` no longer crash if `window.__TAURI_INTERNALS__` is undefined.
## \[2.0.0-alpha.13]
@ -156,6 +153,12 @@
- First mobile alpha release!
- [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08
## \[1.5.3]
### Bug Fixes
- [`1c582a94`](https://www.github.com/tauri-apps/tauri/commit/1c582a942e345a066b65620e4db9f688ec142bb9)([#8392](https://www.github.com/tauri-apps/tauri/pull/8392)) Fix a regression where typescript could not find types when using `"moduleResolution": "node"`
## \[1.5.2]
### Bug Fixes

View File

@ -45,25 +45,25 @@
"devDependencies": {
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "11.1.5",
"@types/node": "20.9.0",
"@types/node": "20.10.5",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"eslint": "8.53.0",
"eslint": "8.56.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-n": "16.3.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-security": "2.1.0",
"fast-glob": "3.3.2",
"prettier": "3.0.3",
"prettier": "3.1.1",
"rollup": "4.3.0",
"tslib": "2.6.2",
"typescript": "5.2.2"
"typescript": "5.3.3"
},
"engines": {
"node": ">= 18",
"npm": ">= 6.6.0",
"yarn": ">= 1.19.1"
}
}
}

View File

@ -19,10 +19,10 @@
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63"
integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==
"@eslint/eslintrc@^2.1.3":
version "2.1.3"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.3.tgz#797470a75fe0fbd5a53350ee715e85e87baff22d"
integrity sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==
"@eslint/eslintrc@^2.1.4":
version "2.1.4"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad"
integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==
dependencies:
ajv "^6.12.4"
debug "^4.3.2"
@ -34,10 +34,10 @@
minimatch "^3.1.2"
strip-json-comments "^3.1.1"
"@eslint/js@8.53.0":
version "8.53.0"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.53.0.tgz#bea56f2ed2b5baea164348ff4d5a879f6f81f20d"
integrity sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==
"@eslint/js@8.56.0":
version "8.56.0"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b"
integrity sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==
"@humanwhocodes/config-array@^0.11.13":
version "0.11.13"
@ -220,10 +220,10 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
"@types/node@20.9.0":
version "20.9.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298"
integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==
"@types/node@20.10.5":
version "20.10.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.5.tgz#47ad460b514096b7ed63a1dae26fad0914ed3ab2"
integrity sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==
dependencies:
undici-types "~5.26.4"
@ -687,10 +687,10 @@ eslint-plugin-es@^3.0.0:
eslint-utils "^2.0.0"
regexpp "^3.0.0"
eslint-plugin-import@2.29.0:
version "2.29.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz#8133232e4329ee344f2f612885ac3073b0b7e155"
integrity sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==
eslint-plugin-import@2.29.1:
version "2.29.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz#d45b37b5ef5901d639c15270d74d46d161150643"
integrity sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==
dependencies:
array-includes "^3.1.7"
array.prototype.findlastindex "^1.2.3"
@ -708,7 +708,7 @@ eslint-plugin-import@2.29.0:
object.groupby "^1.0.1"
object.values "^1.1.7"
semver "^6.3.1"
tsconfig-paths "^3.14.2"
tsconfig-paths "^3.15.0"
eslint-plugin-n@16.3.0:
version "16.3.0"
@ -774,15 +774,15 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800"
integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==
eslint@8.53.0:
version "8.53.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.53.0.tgz#14f2c8244298fcae1f46945459577413ba2697ce"
integrity sha512-N4VuiPjXDUa4xVeV/GC/RV3hQW9Nw+Y463lkWaKKXKYMvmRiRDAtfpuPFLN+E1/6ZhyR8J2ig+eVREnYgUsiag==
eslint@8.56.0:
version "8.56.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.56.0.tgz#4957ce8da409dc0809f99ab07a1b94832ab74b15"
integrity sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==
dependencies:
"@eslint-community/eslint-utils" "^4.2.0"
"@eslint-community/regexpp" "^4.6.1"
"@eslint/eslintrc" "^2.1.3"
"@eslint/js" "8.53.0"
"@eslint/eslintrc" "^2.1.4"
"@eslint/js" "8.56.0"
"@humanwhocodes/config-array" "^0.11.13"
"@humanwhocodes/module-importer" "^1.0.1"
"@nodelib/fs.walk" "^1.2.8"
@ -1488,10 +1488,10 @@ prelude-ls@^1.2.1:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
prettier@3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"
integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==
prettier@3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.1.tgz#6ba9f23165d690b6cbdaa88cb0807278f7019848"
integrity sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==
punycode@^2.1.0:
version "2.3.1"
@ -1782,10 +1782,10 @@ ts-api-utils@^1.0.1:
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331"
integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==
tsconfig-paths@^3.14.2:
version "3.14.2"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088"
integrity sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==
tsconfig-paths@^3.15.0:
version "3.15.0"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4"
integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==
dependencies:
"@types/json5" "^0.0.29"
json5 "^1.0.2"
@ -1848,10 +1848,10 @@ typed-array-length@^1.0.4:
for-each "^0.3.3"
is-typed-array "^1.1.9"
typescript@5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
typescript@5.3.3:
version "5.3.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37"
integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==
unbox-primitive@^1.0.2:
version "1.0.2"

View File

@ -140,6 +140,36 @@
- First mobile alpha release!
- [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08
## \[1.5.0]
### New Features
- [`7aa30dec`](https://www.github.com/tauri-apps/tauri/commit/7aa30dec85a17c3d3faaf3841b93e10991b991b0)([#8620](https://www.github.com/tauri-apps/tauri/pull/8620)) Add `priority`, `section` and `changelog` options in Debian config.
- [`89911296`](https://www.github.com/tauri-apps/tauri/commit/89911296e475d5c36f3486b9b75232505846e767)([#8259](https://www.github.com/tauri-apps/tauri/pull/8259)) On macOS, support for signing nested .dylib, .app, .xpc and .framework under predefined directories inside the bundled frameworks ("MacOS", "Frameworks", "Plugins", "Helpers", "XPCServices" and "Libraries").
- [`8ce51cec`](https://www.github.com/tauri-apps/tauri/commit/8ce51cec3baf4ed88d80c59bf3bbe96fd369c7a0)([#7718](https://www.github.com/tauri-apps/tauri/pull/7718)) On Windows, NSIS installer now supports `/ARGS` flag to pass arguments to be used when launching the app after installation, only works if `/R` is used.
### Enhancements
- [`06890c70`](https://www.github.com/tauri-apps/tauri/commit/06890c70c643516b4e8037af87c8ee9103b977fa)([#8611](https://www.github.com/tauri-apps/tauri/pull/8611)) Support using socks proxy from environment when downloading files.
### Bug Fixes
- [`6bdba1f3`](https://www.github.com/tauri-apps/tauri/commit/6bdba1f330bedb5cdeda49eca1e295f281eb82eb)([#8585](https://www.github.com/tauri-apps/tauri/pull/8585)) Fix the `non-standard-file-perm` and `non-standard-dir-perm` issue in Debian packages
### Dependencies
- [`49266487`](https://www.github.com/tauri-apps/tauri/commit/4926648751ddbf764b8ffc46f3adc218afb2d472)([#8618](https://www.github.com/tauri-apps/tauri/pull/8618)) Replace `libflate` with `flate2` , this will help to provide additional functionalities and features.
## \[1.4.8]
### Enhancements
- [`b44e9c0f`](https://www.github.com/tauri-apps/tauri/commit/b44e9c0fcbb3f6994e38b8ef1ae18515db18ba7d)([#8431](https://www.github.com/tauri-apps/tauri/pull/8431)) Check if required files/tools for bundling are outdated or mis-hashed and redownload them.
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
## \[1.4.7]
### Bug Fixes

View File

@ -1,15 +1,15 @@
workspace = { }
workspace = {}
[package]
name = "tauri-bundler"
version = "2.0.0-beta.1"
authors = [
"George Burton <burtonageo@gmail.com>",
"Tauri Programme within The Commons Conservancy"
"Tauri Programme within The Commons Conservancy",
]
categories = [ "command-line-utilities", "development-tools::cargo-plugins" ]
categories = ["command-line-utilities", "development-tools::cargo-plugins"]
license = "Apache-2.0 OR MIT"
keywords = [ "bundle", "cargo", "tauri" ]
keywords = ["bundle", "cargo", "tauri"]
repository = "https://github.com/tauri-apps/tauri"
description = "Wrap rust executables in OS-specific app bundles for Tauri"
edition = "2021"
@ -19,20 +19,20 @@ exclude = [ "CHANGELOG.md", "/target", "rustfmt.toml" ]
[dependencies]
tauri-utils = { version = "2.0.0-beta.1", path = "../../core/tauri-utils", features = [ "resources" ] }
image = "0.24.7"
libflate = "2.0"
flate2 = "1.0"
anyhow = "1.0"
thiserror = "1.0"
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
serde = { version = "1.0", features = ["derive"] }
strsim = "0.10.0"
tar = "0.4.40"
walkdir = "2"
handlebars = "5.0"
tempfile = "3.8.1"
log = { version = "0.4.20", features = [ "kv_unstable" ] }
log = { version = "0.4.20", features = ["kv_unstable"] }
dirs-next = "2.0"
os_pipe = "1"
ureq = { version = "2.8", default-features = false, features = [ "socks-proxy" ] }
ureq = { version = "2.9.1", default-features = false, features = [ "socks-proxy" ] }
native-tls = { version = "0.2", optional = true }
hex = "0.4"
semver = "1"
@ -47,16 +47,13 @@ bitness = "0.4"
winreg = "0.51"
glob = "0.3"
[target."cfg(target_os = \"windows\")".dependencies.windows-sys]
version = "0.48"
features = [
"Win32_System_SystemInformation",
"Win32_System_Diagnostics_Debug"
]
[target."cfg(target_os = \"windows\")".dependencies.windows-sys]
version = "0.48"
features = ["Win32_System_SystemInformation", "Win32_System_Diagnostics_Debug"]
[target."cfg(target_os = \"macos\")".dependencies]
icns = { package = "tauri-icns", version = "0.1" }
time = { version = "0.3", features = [ "formatting" ] }
time = { version = "0.3", features = ["formatting"] }
plist = "1"
[target."cfg(any(target_os = \"macos\", target_os = \"windows\"))".dependencies]
@ -73,7 +70,7 @@ name = "tauri_bundler"
path = "src/lib.rs"
[features]
default = [ "rustls" ]
native-tls = [ "ureq/native-tls" ]
native-tls-vendored = [ "native-tls", "native-tls/vendored" ]
rustls = [ "ureq/tls" ]
default = ["rustls"]
native-tls = ["ureq/native-tls"]
native-tls-vendored = ["native-tls", "native-tls/vendored"]
rustls = ["ureq/tls"]

View File

@ -26,14 +26,16 @@
use super::{super::common, freedesktop};
use crate::Settings;
use anyhow::Context;
use flate2::{write::GzEncoder, Compression};
use heck::AsKebabCase;
use libflate::gzip;
use log::info;
use tar::HeaderMode;
use walkdir::WalkDir;
use std::{
fs::{self, File},
io::{self, Write},
os::unix::fs::MetadataExt,
path::{Path, PathBuf},
};
@ -121,10 +123,30 @@ pub fn generate_data(
.with_context(|| "Failed to create icon files")?;
freedesktop::generate_desktop_file(settings, &settings.deb().desktop_template, &data_dir)
.with_context(|| "Failed to create desktop file")?;
generate_changelog_file(settings, &data_dir)
.with_context(|| "Failed to create changelog.gz file")?;
Ok((data_dir, icons))
}
/// Generate the Changelog file by compressing, to be stored at /usr/share/doc/package-name/changelog.gz. See
/// https://www.debian.org/doc/debian-policy/ch-docs.html#changelog-files-and-release-notes
fn generate_changelog_file(settings: &Settings, data_dir: &Path) -> crate::Result<()> {
if let Some(changelog_src_path) = &settings.deb().changelog {
let mut src_file = File::open(changelog_src_path)?;
let bin_name = settings.main_binary_name();
let dest_path = data_dir.join(format!("usr/share/doc/{}/changelog.gz", bin_name));
let changelog_file = common::create_file(&dest_path)?;
let mut gzip_encoder = GzEncoder::new(changelog_file, Compression::new(9));
io::copy(&mut src_file, &mut gzip_encoder)?;
let mut changelog_file = gzip_encoder.finish()?;
changelog_file.flush()?;
}
Ok(())
}
/// Generates the debian control file and stores it under the `control_dir`.
fn generate_control_file(
settings: &Settings,
@ -142,7 +164,17 @@ fn generate_control_file(
// Installed-Size must be divided by 1024, see https://www.debian.org/doc/debian-policy/ch-controlfields.html#installed-size
writeln!(file, "Installed-Size: {}", total_dir_size(data_dir)? / 1024)?;
let authors = settings.authors_comma_separated().unwrap_or_default();
writeln!(file, "Maintainer: {authors}")?;
if let Some(section) = &settings.deb().section {
writeln!(file, "Section: {}", section)?;
}
if let Some(priority) = &settings.deb().priority {
writeln!(file, "Priority: {}", priority)?;
} else {
writeln!(file, "Priority: optional")?;
}
if !settings.homepage_url().is_empty() {
writeln!(file, "Homepage: {}", settings.homepage_url())?;
}
@ -167,7 +199,6 @@ fn generate_control_file(
writeln!(file, " {line}")?;
}
}
writeln!(file, "Priority: optional")?;
file.flush()?;
Ok(())
}
@ -236,20 +267,15 @@ fn create_tar_from_dir<P: AsRef<Path>, W: Write>(src_dir: P, dest_file: W) -> cr
continue;
}
let dest_path = src_path.strip_prefix(src_dir)?;
let stat = fs::metadata(src_path)?;
let mut header = tar::Header::new_gnu();
header.set_metadata_in_mode(&stat, HeaderMode::Deterministic);
header.set_mtime(stat.mtime() as u64);
if entry.file_type().is_dir() {
let stat = fs::metadata(src_path)?;
let mut header = tar::Header::new_gnu();
header.set_metadata(&stat);
header.set_uid(0);
header.set_gid(0);
tar_builder.append_data(&mut header, dest_path, &mut io::empty())?;
} else {
let mut src_file = fs::File::open(src_path)?;
let stat = src_file.metadata()?;
let mut header = tar::Header::new_gnu();
header.set_metadata(&stat);
header.set_uid(0);
header.set_gid(0);
tar_builder.append_data(&mut header, dest_path, &mut src_file)?;
}
}
@ -264,9 +290,9 @@ fn tar_and_gzip_dir<P: AsRef<Path>>(src_dir: P) -> crate::Result<PathBuf> {
let src_dir = src_dir.as_ref();
let dest_path = src_dir.with_extension("tar.gz");
let dest_file = common::create_file(&dest_path)?;
let gzip_encoder = gzip::Encoder::new(dest_file)?;
let gzip_encoder = GzEncoder::new(dest_file, Compression::default());
let gzip_encoder = create_tar_from_dir(src_dir, gzip_encoder)?;
let mut dest_file = gzip_encoder.finish().into_result()?;
let mut dest_file = gzip_encoder.finish()?;
dest_file.flush()?;
Ok(dest_path)
}

View File

@ -39,6 +39,15 @@ use std::{
process::Command,
};
const NESTED_CODE_FOLDER: [&str; 6] = [
"MacOS",
"Frameworks",
"Plugins",
"Helpers",
"XPCServices",
"Libraries",
];
/// Bundles the project.
/// Returns a vector of PathBuf that shows where the .app was created.
pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
@ -77,18 +86,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
let framework_paths = copy_frameworks_to_bundle(&bundle_directory, settings)
.with_context(|| "Failed to bundle frameworks")?;
sign_paths.extend(
framework_paths
.into_iter()
.filter(|p| {
let ext = p.extension();
ext == Some(OsStr::new("framework")) || ext == Some(OsStr::new("dylib"))
})
.map(|path| SignTarget {
path,
is_an_executable: false,
}),
);
sign_paths.extend(framework_paths);
settings.copy_resources(&resources_dir)?;
@ -143,7 +141,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
fn remove_extra_attr(app_bundle_path: &Path) -> crate::Result<()> {
Command::new("xattr")
.arg("-cr")
.arg("-crs")
.arg(app_bundle_path)
.output_ok()
.context("failed to remove extra attributes from app bundle")?;
@ -363,7 +361,7 @@ fn copy_framework_from(dest_dir: &Path, framework: &str, src_dir: &Path) -> crat
fn copy_frameworks_to_bundle(
bundle_directory: &Path,
settings: &Settings,
) -> crate::Result<Vec<PathBuf>> {
) -> crate::Result<Vec<SignTarget>> {
let mut paths = Vec::new();
let frameworks = settings
@ -386,7 +384,7 @@ fn copy_frameworks_to_bundle(
.expect("Couldn't get framework filename");
let dest_path = dest_dir.join(src_name);
common::copy_dir(&src_path, &dest_path)?;
paths.push(dest_path);
add_framework_sign_path(&src_path, &dest_path, &mut paths);
continue;
} else if framework.ends_with(".dylib") {
let src_path = PathBuf::from(framework);
@ -399,7 +397,10 @@ fn copy_frameworks_to_bundle(
let src_name = src_path.file_name().expect("Couldn't get library filename");
let dest_path = dest_dir.join(src_name);
common::copy_file(&src_path, &dest_path)?;
paths.push(dest_path);
paths.push(SignTarget {
path: dest_path,
is_an_executable: false,
});
continue;
} else if framework.contains('/') {
return Err(crate::Error::GenericError(format!(
@ -428,3 +429,90 @@ fn copy_frameworks_to_bundle(
}
Ok(paths)
}
/// Recursively add framework's sign paths.
/// If the framework has multiple versions, it will sign "Current" version by default.
fn add_framework_sign_path(
framework_root: &Path,
dest_path: &Path,
sign_paths: &mut Vec<SignTarget>,
) {
if framework_root.join("Versions/Current").exists() {
add_nested_code_sign_path(
&framework_root.join("Versions/Current"),
&dest_path.join("Versions/Current"),
sign_paths,
);
} else {
add_nested_code_sign_path(framework_root, dest_path, sign_paths);
}
sign_paths.push(SignTarget {
path: dest_path.into(),
is_an_executable: false,
});
}
/// Recursively add executable bundle's sign path (.xpc, .app).
fn add_executable_bundle_sign_path(
bundle_root: &Path,
dest_path: &Path,
sign_paths: &mut Vec<SignTarget>,
) {
if bundle_root.join("Contents").exists() {
add_nested_code_sign_path(
&bundle_root.join("Contents"),
&dest_path.join("Contents"),
sign_paths,
);
} else {
add_nested_code_sign_path(bundle_root, dest_path, sign_paths);
}
sign_paths.push(SignTarget {
path: dest_path.into(),
is_an_executable: true,
});
}
fn add_nested_code_sign_path(src_path: &Path, dest_path: &Path, sign_paths: &mut Vec<SignTarget>) {
for folder_name in NESTED_CODE_FOLDER.iter() {
let src_folder_path = src_path.join(folder_name);
let dest_folder_path = dest_path.join(folder_name);
if src_folder_path.exists() {
for entry in walkdir::WalkDir::new(src_folder_path)
.min_depth(1)
.max_depth(1)
.into_iter()
.filter_map(|e| e.ok())
{
if entry.path_is_symlink() || entry.file_name().to_string_lossy().starts_with('.') {
continue;
}
let dest_path = dest_folder_path.join(entry.file_name());
let ext = entry.path().extension();
if entry.path().is_dir() {
// Bundles, like .app, .framework, .xpc
if ext == Some(OsStr::new("framework")) {
add_framework_sign_path(&entry.clone().into_path(), &dest_path, sign_paths);
} else if ext == Some(OsStr::new("xpc")) || ext == Some(OsStr::new("app")) {
add_executable_bundle_sign_path(&entry.clone().into_path(), &dest_path, sign_paths);
}
} else if entry.path().is_file() {
// Binaries, like .dylib, Mach-O executables
if ext == Some(OsStr::new("dylib")) {
sign_paths.push(SignTarget {
path: dest_path,
is_an_executable: false,
});
} else if ext.is_none() {
sign_paths.push(SignTarget {
path: dest_path,
is_an_executable: true,
});
}
}
}
}
}
}

View File

@ -180,6 +180,14 @@ pub struct DebianSettings {
#[doc = include_str!("./linux/templates/main.desktop")]
/// ```
pub desktop_template: Option<PathBuf>,
/// Define the section in Debian Control file. See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
pub section: Option<String>,
/// Change the priority of the Debian Package. By default, it is set to `optional`.
/// Recognized Priorities as of now are : `required`, `important`, `standard`, `optional`, `extra`
pub priority: Option<String>,
/// Path of the uncompressed Changelog file, to be stored at /usr/share/doc/package-name/changelog.gz. See
/// https://www.debian.org/doc/debian-policy/ch-docs.html#changelog-files-and-release-notes
pub changelog: Option<PathBuf>,
}
/// The Linux AppImage bundle settings.

View File

@ -234,12 +234,14 @@ pub fn create_zip(src_file: &Path, dst_file: &Path) -> crate::Result<PathBuf> {
#[cfg(not(target_os = "windows"))]
fn create_tar(src_dir: &Path, dest_path: &Path) -> crate::Result<PathBuf> {
use flate2::{write::GzEncoder, Compression};
let dest_file = common::create_file(dest_path)?;
let gzip_encoder = libflate::gzip::Encoder::new(dest_file)?;
let gzip_encoder = GzEncoder::new(dest_file, Compression::default());
let gzip_encoder = create_tar_from_src(src_dir, gzip_encoder)?;
let mut dest_file = gzip_encoder.finish().into_result()?;
let mut dest_file = gzip_encoder.finish()?;
dest_file.flush()?;
Ok(dest_path.to_owned())
}

View File

@ -9,8 +9,8 @@ use crate::{
common::CommandExt,
windows::util::{
download, download_and_verify, download_webview2_bootstrapper,
download_webview2_offline_installer, extract_zip, HashAlgorithm, NSIS_OUTPUT_FOLDER_NAME,
NSIS_UPDATER_OUTPUT_FOLDER_NAME,
download_webview2_offline_installer, extract_zip, verify_file_hash, HashAlgorithm,
NSIS_OUTPUT_FOLDER_NAME, NSIS_UPDATER_OUTPUT_FOLDER_NAME,
},
},
Settings,
@ -36,7 +36,7 @@ const NSIS_URL: &str =
#[cfg(target_os = "windows")]
const NSIS_SHA1: &str = "057e83c7d82462ec394af76c87d06733605543d4";
const NSIS_APPLICATIONID_URL: &str = "https://github.com/tauri-apps/binary-releases/releases/download/nsis-plugins-v0/NSIS-ApplicationID.zip";
const NSIS_TAURI_UTILS: &str =
const NSIS_TAURI_UTILS_URL: &str =
"https://github.com/tauri-apps/nsis-tauri-utils/releases/download/nsis_tauri_utils-v0.2.2/nsis_tauri_utils.dll";
const NSIS_TAURI_UTILS_SHA1: &str = "16DF1D1A5B4D5DF3859447279C55BE36D4109DFB";
@ -60,6 +60,13 @@ const NSIS_REQUIRED_FILES: &[&str] = &[
"Plugins/x86-unicode/nsis_tauri_utils.dll",
];
const NSIS_REQUIRED_FILES_HASH: &[(&str, &str, &str, HashAlgorithm)] = &[(
"Plugins/x86-unicode/nsis_tauri_utils.dll",
NSIS_TAURI_UTILS_URL,
NSIS_TAURI_UTILS_SHA1,
HashAlgorithm::Sha1,
)];
/// Runs all of the commands to build the NSIS installer.
/// Returns a vector of PathBuf that shows where the NSIS installer was created.
pub fn bundle_project(settings: &Settings, updater: bool) -> crate::Result<Vec<PathBuf>> {
@ -75,6 +82,21 @@ pub fn bundle_project(settings: &Settings, updater: bool) -> crate::Result<Vec<P
warn!("NSIS directory is missing some files. Recreating it.");
std::fs::remove_dir_all(&nsis_toolset_path)?;
get_and_extract_nsis(&nsis_toolset_path, &tauri_tools_path)?;
} else {
let mismatched = NSIS_REQUIRED_FILES_HASH
.iter()
.filter(|(p, _, hash, hash_algorithm)| {
verify_file_hash(nsis_toolset_path.join(p), hash, *hash_algorithm).is_err()
})
.collect::<Vec<_>>();
if !mismatched.is_empty() {
warn!("NSIS directory contains mis-hashed files. Redownloading them.");
for (path, url, hash, hash_algorithim) in mismatched {
let data = download_and_verify(url, hash, *hash_algorithim)?;
write(nsis_toolset_path.join(path), data)?;
}
}
}
build_nsis_app_installer(settings, &nsis_toolset_path, &tauri_tools_path, updater)
@ -107,7 +129,11 @@ fn get_and_extract_nsis(nsis_toolset_path: &Path, _tauri_tools_path: &Path) -> c
nsis_plugins.join("x86-unicode").join("ApplicationID.dll"),
)?;
let data = download_and_verify(NSIS_TAURI_UTILS, NSIS_TAURI_UTILS_SHA1, HashAlgorithm::Sha1)?;
let data = download_and_verify(
NSIS_TAURI_UTILS_URL,
NSIS_TAURI_UTILS_SHA1,
HashAlgorithm::Sha1,
)?;
write(
nsis_plugins
.join("x86-unicode")

View File

@ -622,7 +622,8 @@ Function .onInstSuccess
check_r_flag:
${GetOptions} $CMDLINE "/R" $R0
IfErrors run_done 0
Exec '"$INSTDIR\${MAINBINARYNAME}.exe"'
${GetOptions} $CMDLINE "/ARGS" $R0
Exec '"$INSTDIR\${MAINBINARYNAME}.exe" $R0'
run_done:
FunctionEnd

View File

@ -78,6 +78,7 @@ pub fn download(url: &str) -> crate::Result<Vec<u8>> {
Ok(bytes)
}
#[derive(Clone, Copy)]
pub enum HashAlgorithm {
#[cfg(target_os = "windows")]
Sha256,
@ -92,23 +93,25 @@ pub fn download_and_verify(
) -> crate::Result<Vec<u8>> {
let data = download(url)?;
info!("validating hash");
verify_hash(&data, hash, hash_algorithm)?;
Ok(data)
}
pub fn verify_hash(data: &[u8], hash: &str, hash_algorithm: HashAlgorithm) -> crate::Result<()> {
match hash_algorithm {
#[cfg(target_os = "windows")]
HashAlgorithm::Sha256 => {
let hasher = sha2::Sha256::new();
verify(&data, hash, hasher)?;
verify_data_with_hasher(data, hash, hasher)
}
HashAlgorithm::Sha1 => {
let hasher = sha1::Sha1::new();
verify(&data, hash, hasher)?;
verify_data_with_hasher(data, hash, hasher)
}
}
Ok(data)
}
fn verify(data: &Vec<u8>, hash: &str, mut hasher: impl Digest) -> crate::Result<()> {
fn verify_data_with_hasher(data: &[u8], hash: &str, mut hasher: impl Digest) -> crate::Result<()> {
hasher.update(data);
let url_hash = hasher.finalize().to_vec();
@ -120,6 +123,15 @@ fn verify(data: &Vec<u8>, hash: &str, mut hasher: impl Digest) -> crate::Result<
}
}
pub fn verify_file_hash<P: AsRef<Path>>(
path: P,
hash: &str,
hash_algorithm: HashAlgorithm,
) -> crate::Result<()> {
let data = std::fs::read(path)?;
verify_hash(&data, hash, hash_algorithm)
}
/// Extracts the zips from memory into a useable path.
pub fn extract_zip(data: &[u8], path: &Path) -> crate::Result<()> {
let cursor = Cursor::new(data);

View File

@ -386,6 +386,33 @@
- First mobile alpha release!
- [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08
## \[1.5.10]
### New Features
- [`89911296`](https://www.github.com/tauri-apps/tauri/commit/89911296e475d5c36f3486b9b75232505846e767)([#8259](https://www.github.com/tauri-apps/tauri/pull/8259)) On macOS, support for signing nested .dylib, .app, .xpc and .framework under predefined directories inside the bundled frameworks ("MacOS", "Frameworks", "Plugins", "Helpers", "XPCServices" and "Libraries").
### Bug Fixes
- [`b0f27814`](https://www.github.com/tauri-apps/tauri/commit/b0f27814b90ded2f1ed44b7852080eedbff0d9e4)([#8776](https://www.github.com/tauri-apps/tauri/pull/8776)) Fix `fail to rename app` when using `--profile dev`.
- [`0bff8c32`](https://www.github.com/tauri-apps/tauri/commit/0bff8c325d004fdead2023f58e0f5fd73a9c22ba)([#8697](https://www.github.com/tauri-apps/tauri/pull/8697)) Fix the built-in dev server failing to serve files when URL had queries `?` and other url components.
- [`67d7877f`](https://www.github.com/tauri-apps/tauri/commit/67d7877f27f265c133a70d48a46c83ffff31d571)([#8520](https://www.github.com/tauri-apps/tauri/pull/8520)) The cli now also watches cargo workspace members if the tauri folder is the workspace root.
### Dependencies
- Upgraded to `tauri-bundler@1.5.0`
## \[1.5.9]
### Bug Fixes
- [`0a2175ea`](https://www.github.com/tauri-apps/tauri/commit/0a2175eabb736b2a4cd01ab682e08be0b5ebb2b9)([#8439](https://www.github.com/tauri-apps/tauri/pull/8439)) Expand glob patterns in workspace member paths so the CLI would watch all matching pathhs.
### Dependencies
- Upgraded to `tauri-bundler@1.4.8`
- Upgraded to `tauri-utils@1.5.2`
## \[1.5.8]
### Dependencies

1350
tooling/cli/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
[workspace]
members = [ "node" ]
members = ["node"]
[package]
name = "tauri-cli"
@ -20,7 +20,7 @@ include = [
"*.rs",
"tauri.gitignore",
"tauri-dev-watcher.gitignore",
"LICENSE*"
"LICENSE*",
]
[package.metadata.binstall]
@ -67,35 +67,42 @@ handlebars = "5.0"
include_dir = "0.7"
minisign = "=0.7.3"
base64 = "0.21.5"
ureq = { version = "2.8", default-features = false, features = [ "gzip" ] }
ureq = { version = "2.9.1", default-features = false, features = ["gzip"] }
os_info = "3"
semver = "1.0"
regex = "1.10.2"
unicode-width = "0.1"
zeroize = "1.6"
heck = { version = "0.4", features = [ "unicode" ] }
heck = { version = "0.4", features = ["unicode"] }
dialoguer = "0.11"
url = { version = "2.4", features = [ "serde" ] }
url = { version = "2.4", features = ["serde"] }
os_pipe = "1"
ignore = "0.4"
ctrlc = "3.4"
log = { version = "0.4.20", features = [ "kv_unstable", "kv_unstable_std" ] }
log = { version = "0.4.20", features = ["kv_unstable", "kv_unstable_std"] }
env_logger = "0.10.0"
icns = { package = "tauri-icns", version = "0.1" }
image = { version = "0.24", default-features = false, features = [ "ico" ] }
axum = { version = "0.6.20", features = [ "ws" ] }
image = { version = "0.24", default-features = false, features = ["ico"] }
axum = { version = "0.6.20", features = ["ws"] }
html5ever = "0.26"
kuchiki = { package = "kuchikiki", version = "0.8" }
tokio = { version = "1", features = [ "macros", "sync" ] }
tokio = { version = "1", features = ["macros", "sync"] }
common-path = "1"
serde-value = "0.7.0"
itertools = "0.11"
local-ip-address = "0.5"
css-color = "0.2"
resvg = "0.36.0"
glob = "0.3"
[target."cfg(windows)".dependencies]
winapi = { version = "0.3", features = [ "handleapi", "processenv", "winbase", "wincon", "winnt" ] }
winapi = { version = "0.3", features = [
"handleapi",
"processenv",
"winbase",
"wincon",
"winnt",
] }
cc = "1"
[target."cfg(unix)".dependencies]

View File

@ -1,8 +1,8 @@
{
"cli.js": {
"version": "1.5.8",
"version": "1.5.10",
"node": ">= 10.0.0"
},
"tauri": "1.5.3",
"tauri-build": "1.5.0"
"tauri": "1.6.0",
"tauri-build": "1.5.1"
}

View File

@ -366,6 +366,28 @@
- First mobile alpha release!
- [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08
## \[1.5.10]
### Bug Fixes
- [`b0f27814`](https://www.github.com/tauri-apps/tauri/commit/b0f27814b90ded2f1ed44b7852080eedbff0d9e4)([#8776](https://www.github.com/tauri-apps/tauri/pull/8776)) Fix `fail to rename app` when using `--profile dev`.
- [`0bff8c32`](https://www.github.com/tauri-apps/tauri/commit/0bff8c325d004fdead2023f58e0f5fd73a9c22ba)([#8697](https://www.github.com/tauri-apps/tauri/pull/8697)) Fix the built-in dev server failing to serve files when URL had queries `?` and other url components.
- [`67d7877f`](https://www.github.com/tauri-apps/tauri/commit/67d7877f27f265c133a70d48a46c83ffff31d571)([#8520](https://www.github.com/tauri-apps/tauri/pull/8520)) The cli now also watches cargo workspace members if the tauri folder is the workspace root.
### Dependencies
- Upgraded to `tauri-cli@1.5.10`
## \[1.5.9]
### Bug Fixes
- [`0a2175ea`](https://www.github.com/tauri-apps/tauri/commit/0a2175eabb736b2a4cd01ab682e08be0b5ebb2b9)([#8439](https://www.github.com/tauri-apps/tauri/pull/8439)) Expand glob patterns in workspace member paths so the CLI would watch all matching pathhs.
### Dependencies
- Upgraded to `tauri-cli@1.5.9`
## \[1.5.8]
### Dependencies

View File

@ -2455,6 +2455,27 @@
"string",
"null"
]
},
"section": {
"description": "Define the section in Debian Control file. See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections",
"type": [
"string",
"null"
]
},
"priority": {
"description": "Change the priority of the Debian Package. By default, it is set to `optional`. Recognized Priorities as of now are : `required`, `important`, `standard`, `optional`, `extra`",
"type": [
"string",
"null"
]
},
"changelog": {
"description": "Path of the uncompressed Changelog file, to be stored at /usr/share/doc/package-name/changelog.gz. See https://www.debian.org/doc/debian-policy/ch-docs.html#changelog-files-and-release-notes",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false

View File

@ -123,11 +123,13 @@ pub fn start<P: AsRef<Path>>(path: P, ip: IpAddr, port: Option<u16>) -> crate::R
}
async fn handler(uri: Uri, state: Arc<State>) -> impl IntoResponse {
let uri = uri.to_string();
// Frontend files should not contain query parameters. This seems to be how vite handles it.
let uri = uri.path();
let uri = if uri == "/" {
&uri
uri
} else {
uri.strip_prefix('/').unwrap_or(&uri)
uri.strip_prefix('/').unwrap_or(uri)
};
let file = std::fs::read(state.serve_dir.join(uri))

View File

@ -15,6 +15,7 @@ use std::{
};
use anyhow::Context;
use glob::glob;
use heck::ToKebabCase;
use ignore::gitignore::{Gitignore, GitignoreBuilder};
use log::{debug, error, info};
@ -408,6 +409,52 @@ fn dev_options(
}
}
// Copied from https://github.com/rust-lang/cargo/blob/69255bb10de7f74511b5cef900a9d102247b6029/src/cargo/core/workspace.rs#L665
fn expand_member_path(path: &Path) -> crate::Result<Vec<PathBuf>> {
let Some(path) = path.to_str() else {
return Err(anyhow::anyhow!("path is not UTF-8 compatible"));
};
let res = glob(path).with_context(|| format!("could not parse pattern `{}`", &path))?;
let res = res
.map(|p| p.with_context(|| format!("unable to match path to pattern `{}`", &path)))
.collect::<Result<Vec<_>, _>>()?;
Ok(res)
}
fn get_watch_folders() -> crate::Result<Vec<PathBuf>> {
let tauri_path = tauri_dir();
let workspace_path = get_workspace_dir()?;
// We always want to watch the main tauri folder.
let mut watch_folders = vec![tauri_path.to_path_buf()];
// We also try to watch workspace members, no matter if the tauri cargo project is the workspace root or a workspace member
let cargo_settings = CargoSettings::load(&workspace_path)?;
if let Some(members) = cargo_settings.workspace.and_then(|w| w.members) {
for p in members {
let p = workspace_path.join(p);
match expand_member_path(&p) {
// Sometimes expand_member_path returns an empty vec, for example if the path contains `[]` as in `C:/[abc]/project/`.
// Cargo won't complain unless theres a workspace.members config with glob patterns so we should support it too.
Ok(expanded_paths) => {
if expanded_paths.is_empty() {
watch_folders.push(p);
} else {
watch_folders.extend(expanded_paths);
}
}
Err(err) => {
// If this fails cargo itself should fail too. But we still try to keep going with the unexpanded path.
error!("Error watching {}: {}", p.display(), err.to_string());
watch_folders.push(p);
}
};
}
}
Ok(watch_folders)
}
impl Rust {
pub fn build_options(
&self,
@ -449,29 +496,11 @@ impl Rust {
let process = Arc::new(Mutex::new(child));
let (tx, rx) = sync_channel(1);
let app_path = app_dir();
let tauri_path = tauri_dir();
let workspace_path = get_workspace_dir()?;
let watch_folders = if tauri_path == workspace_path {
vec![tauri_path]
} else {
let cargo_settings = CargoSettings::load(&workspace_path)?;
cargo_settings
.workspace
.as_ref()
.map(|w| {
w.members
.clone()
.unwrap_or_default()
.into_iter()
.map(|p| workspace_path.join(p))
.collect()
})
.unwrap_or_else(|| vec![tauri_path])
};
let watch_folders = get_watch_folders()?;
let watch_folders = watch_folders.iter().map(Path::new).collect::<Vec<_>>();
let common_ancestor = common_path::common_path_all(watch_folders.clone()).unwrap();
let common_ancestor = common_path::common_path_all(watch_folders.iter().map(Path::new))
.expect("watch_folders should not be empty");
let ignore_matcher = build_ignore_matcher(&common_ancestor);
let mut watcher = new_debouncer(Duration::from_secs(1), move |r| {
@ -481,9 +510,9 @@ impl Rust {
})
.unwrap();
for path in watch_folders {
if !ignore_matcher.is_ignore(path, true) {
info!("Watching {} for changes...", display_path(path));
lookup(path, |file_type, p| {
if !ignore_matcher.is_ignore(&path, true) {
info!("Watching {} for changes...", display_path(&path));
lookup(&path, |file_type, p| {
if p != path {
debug!("Watching {} for changes...", display_path(&p));
let _ = watcher.watcher().watch(
@ -814,7 +843,7 @@ impl AppSettings for RustAppSettings {
.expect("Cargo manifest must have the `package.name` field");
let out_dir = self
.out_dir(options.target.clone(), get_profile(options))
.out_dir(options.target.clone(), get_profile_dir(options).to_string())
.with_context(|| "failed to get project out directory")?;
let binary_extension: String = if self.target_triple.contains("windows") {
@ -1135,13 +1164,20 @@ pub fn get_workspace_dir() -> crate::Result<PathBuf> {
)
}
pub fn get_profile(options: &Options) -> String {
pub fn get_profile(options: &Options) -> &str {
options
.args
.iter()
.position(|a| a == "--profile")
.map(|i| options.args[i + 1].clone())
.unwrap_or_else(|| if options.debug { "debug" } else { "release" }.into())
.map(|i| options.args[i + 1].as_str())
.unwrap_or_else(|| if options.debug { "debug" } else { "release" })
}
pub fn get_profile_dir(options: &Options) -> &str {
match get_profile(options) {
"dev" => "debug",
profile => profile,
}
}
#[allow(unused_variables)]
@ -1301,6 +1337,9 @@ fn tauri_config_to_bundle_settings(
},
files: config.linux.deb.files,
desktop_template: config.linux.deb.desktop_template,
section: config.linux.deb.section,
priority: config.linux.deb.priority,
changelog: config.linux.deb.changelog,
},
appimage: AppImageSettings {
files: config.linux.appimage.files,

View File

@ -3,7 +3,7 @@
// SPDX-License-Identifier: MIT
use super::{
get_profile, AppSettings, DevProcess, ExitReason, Options, RustAppSettings, RustupTarget,
get_profile_dir, AppSettings, DevProcess, ExitReason, Options, RustAppSettings, RustupTarget,
};
use crate::CommandExt;
use tauri_utils::display_path;
@ -169,7 +169,7 @@ pub fn build(
options.target.replace(triple.into());
let triple_out_dir = app_settings
.out_dir(Some(triple.into()), get_profile(&options))
.out_dir(Some(triple.into()), get_profile_dir(&options).to_string())
.with_context(|| format!("failed to get {triple} out dir"))?;
build_production_app(options, available_targets, config_features.clone())