Compare commits

..

8 Commits

Author SHA1 Message Date
github-actions[bot]
f86e2387c9 apply version updates (#12183)
Co-authored-by: FabianLars <30730186+FabianLars@users.noreply.github.com>
2025-01-04 01:17:49 +01:00
Fabian-Lars
26fc9558fe fix(cli): Re-add TriggeredKill in dev watcher logic (#12178) 2025-01-04 00:39:07 +01:00
renovate[bot]
90dc7b19fc chore(deps): update rust crate which to v7 (dev) (#12144)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-03 23:28:10 +01:00
renovate[bot]
c681d835d5 chore(deps): update dependency vite to v6 (dev) (#12133)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2025-01-03 23:05:29 +01:00
Fabian-Lars
208d8968ce ci(deps): Update repository-dispatch to v3 (#12169) 2025-01-03 22:34:55 +01:00
Fabian-Lars
aaa7d9bb13 ci: Switch to upstream create-pull-request (#12123)
* ci: Switch to upstream create-pull-request

* what the actual f

* fix version comment

---------

Co-authored-by: Tillmann <28728469+tweidinger@users.noreply.github.com>
2025-01-03 22:48:50 +02:00
github-actions[bot]
d150a40b09 Apply Version Updates From Current Changes (#12165)
Co-authored-by: FabianLars <FabianLars@users.noreply.github.com>
2025-01-03 15:34:54 +01:00
Fabian-Lars
881729448c fix(cli): Ignore file access events (#12164) 2025-01-03 15:00:31 +01:00
25 changed files with 661 additions and 336 deletions

View File

@@ -111,7 +111,7 @@ jobs:
- name: Create Pull Request With Versions Bumped
if: steps.covector.outputs.commandRan == 'version'
uses: tauri-apps/create-pull-request@v3
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # 7.0.6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: release/version-updates
@@ -124,7 +124,7 @@ jobs:
if: |
steps.covector.outputs.successfulPublish == 'true' &&
steps.covector.outputs.packagesPublished != ''
uses: peter-evans/repository-dispatch@v1
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # 3.0.0
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri-docs

54
Cargo.lock generated
View File

@@ -2785,6 +2785,12 @@ dependencies = [
"regex",
]
[[package]]
name = "env_home"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe"
[[package]]
name = "env_logger"
version = "0.8.4"
@@ -2954,6 +2960,15 @@ dependencies = [
"version_check",
]
[[package]]
name = "file-id"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bc904b9bbefcadbd8e3a9fb0d464a9b979de6324c03b3c663e8994f46a5be36"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "filetime"
version = "0.2.25"
@@ -5384,15 +5399,16 @@ dependencies = [
]
[[package]]
name = "notify-debouncer-mini"
version = "0.5.0"
name = "notify-debouncer-full"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aaa5a66d07ed97dce782be94dcf5ab4d1b457f4243f7566c7557f15cabc8c799"
checksum = "9dcf855483228259b2353f89e99df35fc639b2b2510d1166e4858e3f67ec1afb"
dependencies = [
"file-id",
"log",
"notify",
"notify-types",
"tempfile",
"walkdir",
]
[[package]]
@@ -9189,7 +9205,7 @@ dependencies = [
[[package]]
name = "tauri-cli"
version = "2.2.0"
version = "2.2.2"
dependencies = [
"anyhow",
"ar",
@@ -9230,7 +9246,7 @@ dependencies = [
"memchr",
"minisign",
"notify",
"notify-debouncer-mini",
"notify-debouncer-full",
"object 0.36.5",
"os_info",
"os_pipe",
@@ -9317,7 +9333,7 @@ dependencies = [
"signal-hook",
"signal-hook-tokio",
"tokio",
"which 4.4.2",
"which 7.0.1",
]
[[package]]
@@ -10833,18 +10849,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
"home",
"once_cell",
"rustix 0.38.42",
]
[[package]]
name = "which"
version = "6.0.3"
@@ -10857,6 +10861,18 @@ dependencies = [
"winsafe",
]
[[package]]
name = "which"
version = "7.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb4a9e33648339dc1642b0e36e21b3385e6148e289226f657c809dee59df5028"
dependencies = [
"either",
"env_home",
"rustix 0.38.42",
"winsafe",
]
[[package]]
name = "widestring"
version = "1.1.0"

View File

@@ -18,7 +18,7 @@ async fn read_file<R: Runtime>(app: AppHandle<R>) -> Result<Response, String> {
.path()
.resolve(".tauri_3mb.json", BaseDirectory::Home)
.map_err(|e| e.to_string())?;
let contents = read(&path).map_err(|e| e.to_string())?;
let contents = read(path).map_err(|e| e.to_string())?;
Ok(Response::new(contents))
}

View File

@@ -56,7 +56,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
let product_name = settings.product_name();
let mut settings = settings.clone();
if main_binary.name().contains(" ") {
if main_binary.name().contains(' ') {
let main_binary_path = settings.binary_path(main_binary);
let project_out_directory = settings.project_out_directory();
@@ -108,7 +108,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
// Using create_dir_all for a single dir so we don't get errors if the path already exists
fs::create_dir_all(&app_dir_usr_bin)?;
fs::create_dir_all(&app_dir_usr_lib)?;
fs::create_dir_all(app_dir_usr_lib)?;
// Copy bins and libs that linuxdeploy doesn't know about
@@ -258,7 +258,7 @@ fn prepare_tools(tools_path: &Path, arch: &str) -> crate::Result<PathBuf> {
fn write_and_make_executable(path: &Path, data: Vec<u8>) -> std::io::Result<()> {
use std::os::unix::fs::PermissionsExt;
fs::write(path, &data)?;
fs::write(path, data)?;
fs::set_permissions(path, fs::Permissions::from_mode(0o770))?;
Ok(())

View File

@@ -153,7 +153,7 @@ pub fn generate_desktop_file(
let mime_type = (!mime_type.is_empty()).then_some(mime_type.join(";"));
let bin_name_exec = if bin_name.contains(" ") {
let bin_name_exec = if bin_name.contains(' ') {
format!("\"{bin_name}\"")
} else {
bin_name.to_string()

View File

@@ -1,5 +1,17 @@
# Changelog
## \[2.2.2]
### Bug Fixes
- [`26fc9558f`](https://www.github.com/tauri-apps/tauri/commit/26fc9558fe7b2fe649f61926da88f36110dd5707) ([#12178](https://www.github.com/tauri-apps/tauri/pull/12178) by [@FabianLars](https://www.github.com/tauri-apps/tauri/../../FabianLars)) Fixed an issue that caused the `tauri dev` file watcher to exit after detecting file changes.
## \[2.2.1]
### Bug Fixes
- [`881729448`](https://www.github.com/tauri-apps/tauri/commit/881729448c9abd0d0c7941a8a31c94119ce827af) ([#12164](https://www.github.com/tauri-apps/tauri/pull/12164) by [@FabianLars](https://www.github.com/tauri-apps/tauri/../../FabianLars)) Fixed an issue that caused `tauri dev` to crash before showing the app on Linux.
## \[2.2.0]
### New Features

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-cli"
version = "2.2.0"
version = "2.2.2"
authors = ["Tauri Programme within The Commons Conservancy"]
edition = "2021"
rust-version = "1.77.2"
@@ -52,7 +52,7 @@ colored = "2"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order"] }
notify = "7"
notify-debouncer-mini = "0.5"
notify-debouncer-full = "0.4"
shared_child = "1"
duct = "0.13"
toml_edit = { version = "0.22", features = ["serde"] }

View File

@@ -1,6 +1,6 @@
{
"cli.js": {
"version": "2.2.0",
"version": "2.2.2",
"node": ">= 10.0.0"
},
"tauri": "2.2.0",

View File

@@ -87,7 +87,7 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> {
let bin_path = interface.build(interface_options)?;
log::info!(action ="Built"; "application at: {}", tauri_utils::display_path(&bin_path));
log::info!(action ="Built"; "application at: {}", tauri_utils::display_path(bin_path));
let app_settings = interface.app_settings();

View File

@@ -339,7 +339,10 @@ pub fn setup(interface: &AppInterface, options: &mut Options, config: ConfigHand
}
pub fn on_app_exit(code: Option<i32>, reason: ExitReason, exit_on_panic: bool, no_watch: bool) {
if no_watch || exit_on_panic || matches!(reason, ExitReason::NormalExit) {
if no_watch
|| (!matches!(reason, ExitReason::TriggeredKill)
&& (exit_on_panic || matches!(reason, ExitReason::NormalExit)))
{
kill_before_dev_process();
exit(code.unwrap_or(0));
}

View File

@@ -162,11 +162,10 @@ fn watch<F: Fn() + Send + 'static>(dir: PathBuf, handler: F) {
thread::spawn(move || {
let (tx, rx) = std::sync::mpsc::channel();
let mut watcher = notify_debouncer_mini::new_debouncer(Duration::from_secs(1), tx)
let mut watcher = notify_debouncer_full::new_debouncer(Duration::from_secs(1), None, tx)
.expect("failed to start builtin server fs watcher");
watcher
.watcher()
.watch(&dir, notify::RecursiveMode::Recursive)
.expect("builtin server failed to watch dir");

View File

@@ -87,7 +87,7 @@ pub trait AppSettings {
#[derive(Debug)]
pub enum ExitReason {
/// Killed manually.
// TriggeredKill,
TriggeredKill,
/// App compilation failed.
CompilationFailed,
/// Regular exit.

View File

@@ -18,7 +18,7 @@ use anyhow::Context;
use glob::glob;
use ignore::gitignore::{Gitignore, GitignoreBuilder};
use notify::RecursiveMode;
use notify_debouncer_mini::new_debouncer;
use notify_debouncer_full::new_debouncer;
use serde::{Deserialize, Deserializer};
use tauri_bundler::{
AppCategory, AppImageSettings, BundleBinary, BundleSettings, DebianSettings, DmgSettings,
@@ -124,15 +124,13 @@ impl Interface for Rust {
fn new(config: &Config, target: Option<String>) -> crate::Result<Self> {
let manifest = {
let (tx, rx) = sync_channel(1);
let mut watcher = new_debouncer(Duration::from_secs(1), move |r| {
let mut watcher = new_debouncer(Duration::from_secs(1), None, move |r| {
if let Ok(events) = r {
let _ = tx.send(events);
}
})
.unwrap();
watcher
.watcher()
.watch(&tauri_dir().join("Cargo.toml"), RecursiveMode::Recursive)?;
watcher.watch(tauri_dir().join("Cargo.toml"), RecursiveMode::Recursive)?;
let (manifest, _modified) = rewrite_manifest(config)?;
let now = Instant::now();
let timeout = Duration::from_secs(2);
@@ -527,7 +525,7 @@ impl Rust {
.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| {
let mut watcher = new_debouncer(Duration::from_secs(1), None, move |r| {
if let Ok(events) = r {
tx.send(events).unwrap()
}
@@ -539,7 +537,7 @@ impl Rust {
lookup(&path, |file_type, p| {
if p != path {
log::debug!("Watching {} for changes...", display_path(&p));
let _ = watcher.watcher().watch(
let _ = watcher.watch(
&p,
if file_type.is_dir() {
RecursiveMode::Recursive
@@ -555,42 +553,42 @@ impl Rust {
loop {
if let Ok(events) = rx.recv() {
for event in events {
let event_path = event.path;
if event.kind.is_access() {
continue;
}
if !ignore_matcher.is_ignore(&event_path, event_path.is_dir()) {
if is_configuration_file(self.app_settings.target, &event_path) {
if let Ok(config) = reload_config(config.as_ref()) {
let (manifest, modified) =
rewrite_manifest(config.lock().unwrap().as_ref().unwrap())?;
if modified {
*self.app_settings.manifest.lock().unwrap() = manifest;
// no need to run the watcher logic, the manifest was modified
// and it will trigger the watcher again
continue;
if let Some(event_path) = event.paths.first() {
if !ignore_matcher.is_ignore(event_path, event_path.is_dir()) {
if is_configuration_file(self.app_settings.target, event_path) {
if let Ok(config) = reload_config(config.as_ref()) {
let (manifest, modified) =
rewrite_manifest(config.lock().unwrap().as_ref().unwrap())?;
if modified {
*self.app_settings.manifest.lock().unwrap() = manifest;
// no need to run the watcher logic, the manifest was modified
// and it will trigger the watcher again
continue;
}
}
}
}
log::info!(
"File {} changed. Rebuilding application...",
display_path(
event_path
.strip_prefix(frontend_path)
.unwrap_or(&event_path)
)
);
log::info!(
"File {} changed. Rebuilding application...",
display_path(event_path.strip_prefix(frontend_path).unwrap_or(event_path))
);
let mut p = process.lock().unwrap();
p.kill().with_context(|| "failed to kill app process")?;
let mut p = process.lock().unwrap();
p.kill().with_context(|| "failed to kill app process")?;
// wait for the process to exit
// note that on mobile, kill() already waits for the process to exit (duct implementation)
loop {
if !matches!(p.try_wait(), Ok(None)) {
break;
// wait for the process to exit
// note that on mobile, kill() already waits for the process to exit (duct implementation)
loop {
if !matches!(p.try_wait(), Ok(None)) {
break;
}
}
*p = run(self)?;
}
*p = run(self)?;
}
}
}

View File

@@ -78,6 +78,9 @@ pub fn run_dev<F: Fn(Option<i32>, ExitReason) + Send + Sync + 'static>(
dev_cmd.arg("--");
dev_cmd.args(run_args);
let manually_killed_app = Arc::new(AtomicBool::default());
let manually_killed_app_ = manually_killed_app.clone();
let dev_child = match SharedChild::spawn(&mut dev_cmd) {
Ok(c) => Ok(c),
Err(e) if e.kind() == ErrorKind::NotFound => Err(anyhow::anyhow!(
@@ -128,6 +131,8 @@ pub fn run_dev<F: Fn(Option<i32>, ExitReason) + Send + Sync + 'static>(
status.code(),
if status.code() == Some(101) && is_cargo_compile_error {
ExitReason::CompilationFailed
} else if manually_killed_app_.load(Ordering::Relaxed) {
ExitReason::TriggeredKill
} else {
ExitReason::NormalExit
},
@@ -135,9 +140,6 @@ pub fn run_dev<F: Fn(Option<i32>, ExitReason) + Send + Sync + 'static>(
}
});
// TODO: remove this and DevChild (requires refactor for code shared between mobile and desktop)
let manually_killed_app = Arc::new(AtomicBool::default());
Ok(DevChild {
manually_killed_app,
dev_child,

View File

@@ -10,13 +10,13 @@
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^2.0.0-alpha.11",
"@tauri-apps/api": "^2.0.0",
"tauri-plugin-{{ plugin_name }}-api": "file:../../"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.0.1",
"svelte": "^3.49.0",
"vite": "^3.0.2",
"@tauri-apps/cli": "^2.0.0-alpha.17"
"@sveltejs/vite-plugin-svelte": "^5.0.0",
"svelte": "^5.0.0",
"vite": "^6.0.0",
"@tauri-apps/cli": "^2.0.0"
}
}

View File

@@ -27,7 +27,7 @@ pico-args = "0.5"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["macros"] }
which = "4"
which = "7"
[target."cfg(unix)".dependencies]
signal-hook = "0.3"

View File

@@ -478,7 +478,7 @@ fn rustc_version() -> (u32, u32) {
.split(' ')
.nth(1)
.unwrap_or_default()
.split(".")
.split('.')
.take(2)
.flat_map(|p| p.parse::<u32>().ok())
.collect::<Vec<_>>();

View File

@@ -2682,7 +2682,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
pending,
)?;
#[allow(clippy::manual_inspect)]
#[allow(unknown_lints, clippy::manual_inspect)]
self
.context
.main_thread
@@ -3311,7 +3311,7 @@ fn handle_user_message<T: UserEvent>(
let _ = webview.print();
}
WebviewMessage::Close => {
#[allow(clippy::manual_inspect)]
#[allow(unknown_lints, clippy::manual_inspect)]
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);
@@ -3535,7 +3535,7 @@ fn handle_user_message<T: UserEvent>(
if let Some(window) = window {
match handler(&window) {
Ok(webview) => {
#[allow(clippy::manual_inspect)]
#[allow(unknown_lints, clippy::manual_inspect)]
windows.0.borrow_mut().get_mut(&window_id).map(|w| {
w.webviews.push(webview);
w.has_children.store(true, Ordering::Relaxed);

View File

@@ -396,6 +396,7 @@ mod tests {
assert_eq!(resource_dir, path.parent().unwrap());
let path = PathBuf::from("/path/to/target/unknown-profile/app");
#[allow(clippy::needless_borrows_for_generic_args)]
let resource_dir = super::resource_dir_from(&path, &package_info, &env);
#[cfg(target_os = "macos")]
assert!(resource_dir.is_err());

View File

@@ -428,7 +428,7 @@ permissions = [{}]
.join(",")
);
write_if_changed(&default_toml, toml_content)
write_if_changed(default_toml, toml_content)
.unwrap_or_else(|_| panic!("unable to autogenerate core:default set"));
let _ = tauri_utils::acl::build::define_permissions(

View File

@@ -13,12 +13,12 @@
"@tauri-apps/api": "../../packages/api/dist"
},
"devDependencies": {
"@iconify-json/codicon": "^1.2.6",
"@iconify-json/ph": "^1.2.1",
"@sveltejs/vite-plugin-svelte": "5.0.1",
"@unocss/extractor-svelte": "0.65.1",
"svelte": "5.10.1",
"unocss": "0.65.1",
"vite": "6.0.3"
"@iconify-json/codicon": "^1.2.8",
"@iconify-json/ph": "^1.2.2",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@unocss/extractor-svelte": "^0.65.3",
"svelte": "^5.16.1",
"unocss": "^0.65.3",
"vite": "^6.0.7"
}
}

View File

@@ -35,7 +35,7 @@ fn handle_file_associations(app: AppHandle, files: Vec<PathBuf>) {
let files = files
.into_iter()
.map(|f| {
let file = f.to_string_lossy().replace("\\", "\\\\"); // escape backslash
let file = f.to_string_lossy().replace('\\', "\\\\"); // escape backslash
format!("\"{file}\"",) // wrap in quotes for JS array
})
.collect::<Vec<_>>()
@@ -59,7 +59,7 @@ fn main() {
// files may aslo be passed as `file://path/to/file`
for maybe_file in std::env::args().skip(1) {
// skip flags like -f or --flag
if maybe_file.starts_with("-") {
if maybe_file.starts_with('-') {
continue;
}

View File

@@ -1,5 +1,25 @@
# Changelog
## \[2.2.2]
### Bug Fixes
- [`26fc9558f`](https://www.github.com/tauri-apps/tauri/commit/26fc9558fe7b2fe649f61926da88f36110dd5707) ([#12178](https://www.github.com/tauri-apps/tauri/pull/12178) by [@FabianLars](https://www.github.com/tauri-apps/tauri/../../FabianLars)) Fixed an issue that caused the `tauri dev` file watcher to exit after detecting file changes.
### Dependencies
- Upgraded to `tauri-cli@2.2.2`
## \[2.2.1]
### Bug Fixes
- [`881729448`](https://www.github.com/tauri-apps/tauri/commit/881729448c9abd0d0c7941a8a31c94119ce827af) ([#12164](https://www.github.com/tauri-apps/tauri/pull/12164) by [@FabianLars](https://www.github.com/tauri-apps/tauri/../../FabianLars)) Fixed an issue that caused `tauri dev` to crash before showing the app on Linux.
### Dependencies
- Upgraded to `tauri-cli@2.2.1`
## \[2.2.0]
### New Features

View File

@@ -1,6 +1,6 @@
{
"name": "@tauri-apps/cli",
"version": "2.2.0",
"version": "2.2.2",
"description": "Command line interface for building Tauri apps",
"funding": {
"type": "opencollective",

760
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff