From eb5d88427a7dcb347fb0feae9e816db05b101844 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Tue, 3 Feb 2026 11:01:12 -0300 Subject: [PATCH 1/3] fix(codegen): Context generation with custom assets (#14883) when custom assets are provided (`tauri::generate_context!(assets = my_assets)`) we can't use the fn inner logic directly and capture variables - we must pass them as arguments --- .changes/codegen-custom-context-assets-fix.md | 5 +++++ crates/tauri-codegen/src/context.rs | 20 +++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 .changes/codegen-custom-context-assets-fix.md diff --git a/.changes/codegen-custom-context-assets-fix.md b/.changes/codegen-custom-context-assets-fix.md new file mode 100644 index 000000000000..09363e9eb18b --- /dev/null +++ b/.changes/codegen-custom-context-assets-fix.md @@ -0,0 +1,5 @@ +--- +"tauri-codegen": patch:bug +--- + +Fix `tauri::Context` code generation failing with `can't capture dynamic environment in a fn item` when custom assets are provided. diff --git a/crates/tauri-codegen/src/context.rs b/crates/tauri-codegen/src/context.rs index b60d2b9fd4a1..bc889bd8d4fc 100644 --- a/crates/tauri-codegen/src/context.rs +++ b/crates/tauri-codegen/src/context.rs @@ -453,7 +453,7 @@ pub fn context_codegen(data: ContextData) -> EmbeddedAssetsResult { #[allow(unused_mut, clippy::let_and_return)] let mut context = #root::Context::new( #config, - ::std::boxed::Box::new(#assets), + ::std::boxed::Box::new(assets), #default_window_icon, #app_icon, #package_info, @@ -468,14 +468,16 @@ pub fn context_codegen(data: ContextData) -> EmbeddedAssetsResult { context }); - Ok(quote!({ - // Wrapping in a function to make rust analyzer faster, - // see https://github.com/tauri-apps/tauri/pull/14457 - fn inner() -> #root::Context { + // Wrapping in a function to make rust analyzer faster, + // see https://github.com/tauri-apps/tauri/pull/14457 + // We take the assets as an argument so when the caller provides custom `assets` the closure + // does not capture from the caller's scope ("can't capture dynamic environment in a fn item"). + let output = quote!({ + fn inner + 'static>(assets: A) -> #root::Context { let thread = ::std::thread::Builder::new() .name(String::from("generated tauri context creation")) .stack_size(8 * 1024 * 1024) - .spawn(|| #context) + .spawn(move || #context) .expect("unable to create thread with 8MiB stack"); match thread.join() { @@ -486,8 +488,10 @@ pub fn context_codegen(data: ContextData) -> EmbeddedAssetsResult { } } } - inner() - })) + inner(#assets) + }); + + Ok(output) } fn find_icon( From 06f911aaff495121f08ebc77d9d1b41382298a1f Mon Sep 17 00:00:00 2001 From: goosewobbler <432005+goosewobbler@users.noreply.github.com> Date: Tue, 3 Feb 2026 14:20:42 +0000 Subject: [PATCH 2/3] fix: don't inherit stdout from parent (#14871) --- .changes/fix-tauri-driver-stdout-pollution.md | 5 +++++ crates/tauri-driver/src/webdriver.rs | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .changes/fix-tauri-driver-stdout-pollution.md diff --git a/.changes/fix-tauri-driver-stdout-pollution.md b/.changes/fix-tauri-driver-stdout-pollution.md new file mode 100644 index 000000000000..dbe917df6511 --- /dev/null +++ b/.changes/fix-tauri-driver-stdout-pollution.md @@ -0,0 +1,5 @@ +--- +'tauri-driver': 'patch:bug' +--- + +Prevent native WebDriver stdout from polluting tauri-driver's stdout used by test frameworks. diff --git a/crates/tauri-driver/src/webdriver.rs b/crates/tauri-driver/src/webdriver.rs index 76bb93884787..73ce2b823215 100644 --- a/crates/tauri-driver/src/webdriver.rs +++ b/crates/tauri-driver/src/webdriver.rs @@ -1,9 +1,12 @@ -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy +// Copyright 2019-2026 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT use crate::cli::Args; -use std::{env::current_dir, process::Command}; +use std::{ + env::current_dir, + process::{Command, Stdio}, +}; // the name of the binary to find in $PATH #[cfg(target_os = "linux")] @@ -48,5 +51,11 @@ pub fn native(args: &Args) -> Command { cmd.env("TAURI_WEBVIEW_AUTOMATION", "true"); // 2.x cmd.arg(format!("--port={}", args.native_port)); cmd.arg(format!("--host={}", args.native_host)); + + // Don't inherit stdout from parent to prevent native WebDriver binary/HTTP protocol data + // from corrupting tauri-driver's stdout (which gets captured by the test framework). + // Keep stderr inherited so WebDriver logs/errors are still visible. + cmd.stdout(Stdio::null()); + cmd } From c37368f339f04d6716888214d1ea3438651e5554 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:54:01 -0300 Subject: [PATCH 3/3] apply version updates (#14884) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .changes/codegen-custom-context-assets-fix.md | 5 ----- .changes/fix-tauri-driver-stdout-pollution.md | 5 ----- Cargo.lock | 16 ++++++++-------- crates/tauri-build/CHANGELOG.md | 6 ++++++ crates/tauri-build/Cargo.toml | 4 ++-- crates/tauri-cli/config.schema.json | 2 +- crates/tauri-cli/metadata-v2.json | 4 ++-- crates/tauri-codegen/CHANGELOG.md | 6 ++++++ crates/tauri-codegen/Cargo.toml | 2 +- crates/tauri-driver/CHANGELOG.md | 6 ++++++ crates/tauri-driver/Cargo.toml | 2 +- crates/tauri-macros/CHANGELOG.md | 6 ++++++ crates/tauri-macros/Cargo.toml | 4 ++-- .../schemas/config.schema.json | 2 +- crates/tauri/CHANGELOG.md | 7 +++++++ crates/tauri/Cargo.toml | 6 +++--- 16 files changed, 52 insertions(+), 31 deletions(-) delete mode 100644 .changes/codegen-custom-context-assets-fix.md delete mode 100644 .changes/fix-tauri-driver-stdout-pollution.md diff --git a/.changes/codegen-custom-context-assets-fix.md b/.changes/codegen-custom-context-assets-fix.md deleted file mode 100644 index 09363e9eb18b..000000000000 --- a/.changes/codegen-custom-context-assets-fix.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"tauri-codegen": patch:bug ---- - -Fix `tauri::Context` code generation failing with `can't capture dynamic environment in a fn item` when custom assets are provided. diff --git a/.changes/fix-tauri-driver-stdout-pollution.md b/.changes/fix-tauri-driver-stdout-pollution.md deleted file mode 100644 index dbe917df6511..000000000000 --- a/.changes/fix-tauri-driver-stdout-pollution.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'tauri-driver': 'patch:bug' ---- - -Prevent native WebDriver stdout from polluting tauri-driver's stdout used by test frameworks. diff --git a/Cargo.lock b/Cargo.lock index bfa2675938ad..1b6aae204f98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1320,7 +1320,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] @@ -4327,7 +4327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -8504,7 +8504,7 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" -version = "2.10.1" +version = "2.10.2" dependencies = [ "anyhow", "bytes", @@ -8565,7 +8565,7 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.5.4" +version = "2.5.5" dependencies = [ "anyhow", "cargo_toml", @@ -8727,7 +8727,7 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.5.3" +version = "2.5.4" dependencies = [ "base64 0.22.1", "brotli", @@ -8752,7 +8752,7 @@ dependencies = [ [[package]] name = "tauri-driver" -version = "2.0.4" +version = "2.0.5" dependencies = [ "anyhow", "futures", @@ -8814,7 +8814,7 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.5.3" +version = "2.5.4" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -10330,7 +10330,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] diff --git a/crates/tauri-build/CHANGELOG.md b/crates/tauri-build/CHANGELOG.md index 80bc3d7cfcaa..fb3464970c34 100644 --- a/crates/tauri-build/CHANGELOG.md +++ b/crates/tauri-build/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.5.5] + +### Dependencies + +- Upgraded to `tauri-codegen@2.5.4` + ## \[2.5.4] ### Enhancements diff --git a/crates/tauri-build/Cargo.toml b/crates/tauri-build/Cargo.toml index 89c7950bd2f2..5c63381161ef 100644 --- a/crates/tauri-build/Cargo.toml +++ b/crates/tauri-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-build" -version = "2.5.4" +version = "2.5.5" description = "build time code to pair with https://crates.io/crates/tauri" exclude = ["CHANGELOG.md", "/target"] readme = "README.md" @@ -26,7 +26,7 @@ targets = [ [dependencies] anyhow = "1" quote = { version = "1", optional = true } -tauri-codegen = { version = "2.5.3", path = "../tauri-codegen", optional = true } +tauri-codegen = { version = "2.5.4", path = "../tauri-codegen", optional = true } tauri-utils = { version = "2.8.2", path = "../tauri-utils", features = [ "build", "resources", diff --git a/crates/tauri-cli/config.schema.json b/crates/tauri-cli/config.schema.json index ad983d0f7aeb..b56437751f55 100644 --- a/crates/tauri-cli/config.schema.json +++ b/crates/tauri-cli/config.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://schema.tauri.app/config/2.10.1", + "$id": "https://schema.tauri.app/config/2.10.2", "title": "Config", "description": "The Tauri configuration object.\n It is read from a file where you can define your frontend assets,\n configure the bundler and define a tray icon.\n\n The configuration file is generated by the\n [`tauri init`](https://v2.tauri.app/reference/cli/#init) command that lives in\n your Tauri application source directory (src-tauri).\n\n Once generated, you may modify it at will to customize your Tauri application.\n\n ## File Formats\n\n By default, the configuration is defined as a JSON file named `tauri.conf.json`.\n\n Tauri also supports JSON5 and TOML files via the `config-json5` and `config-toml` Cargo features, respectively.\n The JSON5 file name must be either `tauri.conf.json` or `tauri.conf.json5`.\n The TOML file name is `Tauri.toml`.\n\n ## Platform-Specific Configuration\n\n In addition to the default configuration file, Tauri can\n read a platform-specific configuration from `tauri.linux.conf.json`,\n `tauri.windows.conf.json`, `tauri.macos.conf.json`, `tauri.android.conf.json` and `tauri.ios.conf.json`\n (or `Tauri.linux.toml`, `Tauri.windows.toml`, `Tauri.macos.toml`, `Tauri.android.toml` and `Tauri.ios.toml` if the `Tauri.toml` format is used),\n which gets merged with the main configuration object.\n\n ## Configuration Structure\n\n The configuration is composed of the following objects:\n\n - [`app`](#appconfig): The Tauri configuration\n - [`build`](#buildconfig): The build configuration\n - [`bundle`](#bundleconfig): The bundle configurations\n - [`plugins`](#pluginconfig): The plugins configuration\n\n Example tauri.config.json file:\n\n ```json\n {\n \"productName\": \"tauri-app\",\n \"version\": \"0.1.0\",\n \"build\": {\n \"beforeBuildCommand\": \"\",\n \"beforeDevCommand\": \"\",\n \"devUrl\": \"http://localhost:3000\",\n \"frontendDist\": \"../dist\"\n },\n \"app\": {\n \"security\": {\n \"csp\": null\n },\n \"windows\": [\n {\n \"fullscreen\": false,\n \"height\": 600,\n \"resizable\": true,\n \"title\": \"Tauri App\",\n \"width\": 800\n }\n ]\n },\n \"bundle\": {},\n \"plugins\": {}\n }\n ```", "type": "object", diff --git a/crates/tauri-cli/metadata-v2.json b/crates/tauri-cli/metadata-v2.json index 63c2325b2fc9..59f76420ee20 100644 --- a/crates/tauri-cli/metadata-v2.json +++ b/crates/tauri-cli/metadata-v2.json @@ -3,7 +3,7 @@ "version": "2.10.0", "node": ">= 10.0.0" }, - "tauri": "2.10.1", - "tauri-build": "2.5.4", + "tauri": "2.10.2", + "tauri-build": "2.5.5", "tauri-plugin": "2.5.3" } diff --git a/crates/tauri-codegen/CHANGELOG.md b/crates/tauri-codegen/CHANGELOG.md index 8514b2f31314..3b721d32936c 100644 --- a/crates/tauri-codegen/CHANGELOG.md +++ b/crates/tauri-codegen/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.5.4] + +### Bug Fixes + +- [`eb5d88427`](https://www.github.com/tauri-apps/tauri/commit/eb5d88427a7dcb347fb0feae9e816db05b101844) ([#14883](https://www.github.com/tauri-apps/tauri/pull/14883) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Fix `tauri::Context` code generation failing with `can't capture dynamic environment in a fn item` when custom assets are provided. + ## \[2.5.3] ### Dependencies diff --git a/crates/tauri-codegen/Cargo.toml b/crates/tauri-codegen/Cargo.toml index 1c3cdaebd39b..19130b902879 100644 --- a/crates/tauri-codegen/Cargo.toml +++ b/crates/tauri-codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-codegen" -version = "2.5.3" +version = "2.5.4" description = "code generation meant to be consumed inside of `tauri` through `tauri-build` or `tauri-macros`" exclude = ["CHANGELOG.md", "/target"] readme = "README.md" diff --git a/crates/tauri-driver/CHANGELOG.md b/crates/tauri-driver/CHANGELOG.md index f53f342d923a..7dc771920114 100644 --- a/crates/tauri-driver/CHANGELOG.md +++ b/crates/tauri-driver/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.0.5] + +### Bug Fixes + +- [`06f911aaf`](https://www.github.com/tauri-apps/tauri/commit/06f911aaff495121f08ebc77d9d1b41382298a1f) ([#14871](https://www.github.com/tauri-apps/tauri/pull/14871) by [@goosewobbler](https://www.github.com/tauri-apps/tauri/../../goosewobbler)) Prevent native WebDriver stdout from polluting tauri-driver's stdout used by test frameworks. + ## \[2.0.4] ### Enhancements diff --git a/crates/tauri-driver/Cargo.toml b/crates/tauri-driver/Cargo.toml index 9b35fe111337..c25b57feeac0 100644 --- a/crates/tauri-driver/Cargo.toml +++ b/crates/tauri-driver/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-driver" -version = "2.0.4" +version = "2.0.5" authors = ["Tauri Programme within The Commons Conservancy"] categories = ["gui", "web-programming"] license = "Apache-2.0 OR MIT" diff --git a/crates/tauri-macros/CHANGELOG.md b/crates/tauri-macros/CHANGELOG.md index ec3a13b02e5e..956c665e6d9d 100644 --- a/crates/tauri-macros/CHANGELOG.md +++ b/crates/tauri-macros/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.5.4] + +### Dependencies + +- Upgraded to `tauri-codegen@2.5.4` + ## \[2.5.3] ### Dependencies diff --git a/crates/tauri-macros/Cargo.toml b/crates/tauri-macros/Cargo.toml index 364eb81057cb..b18d1e20a847 100644 --- a/crates/tauri-macros/Cargo.toml +++ b/crates/tauri-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-macros" -version = "2.5.3" +version = "2.5.4" description = "Macros for the tauri crate." exclude = ["CHANGELOG.md", "/target"] readme = "README.md" @@ -20,7 +20,7 @@ proc-macro2 = { version = "1", features = ["span-locations"] } quote = "1" syn = { version = "2", features = ["full"] } heck = "0.5" -tauri-codegen = { version = "2.5.3", default-features = false, path = "../tauri-codegen" } +tauri-codegen = { version = "2.5.4", default-features = false, path = "../tauri-codegen" } tauri-utils = { version = "2.8.2", path = "../tauri-utils" } [features] diff --git a/crates/tauri-schema-generator/schemas/config.schema.json b/crates/tauri-schema-generator/schemas/config.schema.json index ad983d0f7aeb..b56437751f55 100644 --- a/crates/tauri-schema-generator/schemas/config.schema.json +++ b/crates/tauri-schema-generator/schemas/config.schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://schema.tauri.app/config/2.10.1", + "$id": "https://schema.tauri.app/config/2.10.2", "title": "Config", "description": "The Tauri configuration object.\n It is read from a file where you can define your frontend assets,\n configure the bundler and define a tray icon.\n\n The configuration file is generated by the\n [`tauri init`](https://v2.tauri.app/reference/cli/#init) command that lives in\n your Tauri application source directory (src-tauri).\n\n Once generated, you may modify it at will to customize your Tauri application.\n\n ## File Formats\n\n By default, the configuration is defined as a JSON file named `tauri.conf.json`.\n\n Tauri also supports JSON5 and TOML files via the `config-json5` and `config-toml` Cargo features, respectively.\n The JSON5 file name must be either `tauri.conf.json` or `tauri.conf.json5`.\n The TOML file name is `Tauri.toml`.\n\n ## Platform-Specific Configuration\n\n In addition to the default configuration file, Tauri can\n read a platform-specific configuration from `tauri.linux.conf.json`,\n `tauri.windows.conf.json`, `tauri.macos.conf.json`, `tauri.android.conf.json` and `tauri.ios.conf.json`\n (or `Tauri.linux.toml`, `Tauri.windows.toml`, `Tauri.macos.toml`, `Tauri.android.toml` and `Tauri.ios.toml` if the `Tauri.toml` format is used),\n which gets merged with the main configuration object.\n\n ## Configuration Structure\n\n The configuration is composed of the following objects:\n\n - [`app`](#appconfig): The Tauri configuration\n - [`build`](#buildconfig): The build configuration\n - [`bundle`](#bundleconfig): The bundle configurations\n - [`plugins`](#pluginconfig): The plugins configuration\n\n Example tauri.config.json file:\n\n ```json\n {\n \"productName\": \"tauri-app\",\n \"version\": \"0.1.0\",\n \"build\": {\n \"beforeBuildCommand\": \"\",\n \"beforeDevCommand\": \"\",\n \"devUrl\": \"http://localhost:3000\",\n \"frontendDist\": \"../dist\"\n },\n \"app\": {\n \"security\": {\n \"csp\": null\n },\n \"windows\": [\n {\n \"fullscreen\": false,\n \"height\": 600,\n \"resizable\": true,\n \"title\": \"Tauri App\",\n \"width\": 800\n }\n ]\n },\n \"bundle\": {},\n \"plugins\": {}\n }\n ```", "type": "object", diff --git a/crates/tauri/CHANGELOG.md b/crates/tauri/CHANGELOG.md index b2c75fd0cb46..2dd574964db8 100644 --- a/crates/tauri/CHANGELOG.md +++ b/crates/tauri/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## \[2.10.2] + +### Dependencies + +- Upgraded to `tauri-macros@2.5.4` +- Upgraded to `tauri-build@2.5.5` + ## \[2.10.1] ### Dependencies diff --git a/crates/tauri/Cargo.toml b/crates/tauri/Cargo.toml index 937567cf0e40..7f0ed98cdc27 100644 --- a/crates/tauri/Cargo.toml +++ b/crates/tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri" -version = "2.10.1" +version = "2.10.2" description = "Make tiny, secure apps for all desktop platforms with Tauri" exclude = ["/test", "/.scripts", "CHANGELOG.md", "/target"] readme = "README.md" @@ -56,7 +56,7 @@ url = "2" anyhow = "1" thiserror = "2" tauri-runtime = { version = "2.10.0", path = "../tauri-runtime" } -tauri-macros = { version = "2.5.3", path = "../tauri-macros" } +tauri-macros = { version = "2.5.4", path = "../tauri-macros" } tauri-utils = { version = "2.8.2", features = [ "resources", ], path = "../tauri-utils" } @@ -164,7 +164,7 @@ objc2-ui-kit = { version = "0.3.0", default-features = false, features = [ [build-dependencies] glob = "0.3" heck = "0.5" -tauri-build = { path = "../tauri-build/", default-features = false, version = "2.5.4" } +tauri-build = { path = "../tauri-build/", default-features = false, version = "2.5.5" } tauri-utils = { path = "../tauri-utils/", version = "2.8.2", features = [ "build", ] }