From e64b8f1dcedad3222f46755bf6f30392a7ec2f90 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Thu, 18 Apr 2024 05:21:21 +0200 Subject: [PATCH] chore: merge remote-tracking branch '1.x' into v2 (#9479) * chore: port PR template from `dev` branch (#9004) * fix(runtime-wry): avoid panic during clipboard initialization on wayland (#9003) closes #8964 * ci: downgrade thread_local to 1.1.7 in msrv list (#9012) * Apply Version Updates From Current Changes (v1) (#9013) Co-authored-by: lucasfernog * fix(bundler): escape potentially problematic strings in an XML (#9040) * fix(bundler): escape potentially problematic strings in an XML (#9030) - replace characters invalid in XML with their escaped form to properly bundle resources with such characters in their pathnames. * change file * fix(cli): use `matched_path_or_any_parents` when checking if a file is ignored (#8903) * fix: taurignore ignoreing folders not working for watch * docs: add to changes * fix: panic: path is expected to be under the root * Update taurignore-ignoring-folders-not-working-for-watch.md * Update taurignore-ignoring-folders-not-working-for-watch.md * fix(cli): migrate to stable features of `log` crate (#9119) * fix(cli): migrate to stable features of `log` crate * to_cow_str * Apply Version Updates From Current Changes (v1) (#9074) Co-authored-by: lucasfernog * fix(core/path): remove suffix in basename only once (#9166) * fix(core/path): remove suffix in basename only once ref: #9064 * Update tooling/api/src/path.ts --------- Co-authored-by: Lucas Fernandes Nogueira * fix(cli): Clone Options struct after mutating it. (#9188) * fix(bundler): Fix nsis resource paths on non-windows build systems. (#9281) * fix(bundler): Fix nsis resource paths on non-windows build systems. * remove leftover from alternative * fix(bundler/nsis): Don't use /R flag on installation dir (#9282) * fix(cli): upgrade heck to better support Chinese/Japanese prodcut name on Linux (#9298) * chore: fix clippy false positive (#9329) * fix(cli/info): fix crash when checking node version (#9411) closes #9396 --------- Co-authored-by: Amr Bashir Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: lucasfernog Co-authored-by: bifs <127015052+bifs@users.noreply.github.com> Co-authored-by: anatawa12 Co-authored-by: Lucas Fernandes Nogueira Co-authored-by: Jet Li --- .changes/bundler-r-flag.md | 5 ++++ .changes/bundler-resources-unix.md | 5 ++++ .changes/cli-chinese-product-name.md | 6 +++++ .changes/runner-config.md | 6 +++++ .../covector-version-or-publish-v1.yml | 1 + Cargo.lock | 4 +-- core/tauri-build/Cargo.toml | 2 +- core/tauri-runtime-wry/CHANGELOG.md | 6 +++++ core/tauri-utils/Cargo.toml | 2 +- tooling/bundler/CHANGELOG.md | 7 ++++++ tooling/bundler/Cargo.toml | 2 +- tooling/bundler/src/bundle/windows/msi/wix.rs | 6 ++--- tooling/bundler/src/bundle/windows/nsis.rs | 25 +++++++++++++++++++ .../bundle/windows/templates/installer.nsi | 12 +++------ tooling/cli/CHANGELOG.md | 11 ++++++++ tooling/cli/Cargo.lock | 4 +-- tooling/cli/metadata.json | 4 +-- tooling/cli/node/CHANGELOG.md | 10 ++++++++ tooling/cli/src/interface/rust.rs | 6 ++++- 19 files changed, 103 insertions(+), 21 deletions(-) create mode 100644 .changes/bundler-r-flag.md create mode 100644 .changes/bundler-resources-unix.md create mode 100644 .changes/cli-chinese-product-name.md create mode 100644 .changes/runner-config.md diff --git a/.changes/bundler-r-flag.md b/.changes/bundler-r-flag.md new file mode 100644 index 000000000..01bb177a0 --- /dev/null +++ b/.changes/bundler-r-flag.md @@ -0,0 +1,5 @@ +--- +'tauri-bundler': 'patch:bug' +--- + +The NSIS uninstaller now won't mindlessly try to remove the whole installation folder when the "Remove application data" checkbox was ticked. This prevents data loss when the app was installed in a folder which contained other files. diff --git a/.changes/bundler-resources-unix.md b/.changes/bundler-resources-unix.md new file mode 100644 index 000000000..5c9561848 --- /dev/null +++ b/.changes/bundler-resources-unix.md @@ -0,0 +1,5 @@ +--- +'tauri-bundler': 'patch:bug' +--- + +Fixed an issue causing the NSIS bundler to install resources incorrectly when the installer was built on a non-Windows system. diff --git a/.changes/cli-chinese-product-name.md b/.changes/cli-chinese-product-name.md new file mode 100644 index 000000000..cc036ead8 --- /dev/null +++ b/.changes/cli-chinese-product-name.md @@ -0,0 +1,6 @@ +--- +'tauri-cli': 'patch:bug' +'@tauri-apps/cli': 'patch:bug' +--- + +Upgrade `heck` to v0.5 to better support Chinese and Japanese product name, because Chinese do not have word separation. diff --git a/.changes/runner-config.md b/.changes/runner-config.md new file mode 100644 index 000000000..c810ccfbb --- /dev/null +++ b/.changes/runner-config.md @@ -0,0 +1,6 @@ +--- +'tauri-cli': 'patch:bug' +'@tauri-apps/cli': 'patch:bug' +--- + +Fixed an issue causing the `build.runner` and `build.features` configs to not take effect. diff --git a/.github/workflows/covector-version-or-publish-v1.yml b/.github/workflows/covector-version-or-publish-v1.yml index e018b7bb1..0f73a7dce 100644 --- a/.github/workflows/covector-version-or-publish-v1.yml +++ b/.github/workflows/covector-version-or-publish-v1.yml @@ -99,6 +99,7 @@ jobs: cargo update -p serde_json --precise 1.0.97 cargo update -p petgraph --precise 0.6.3 cargo update -p os_str_bytes --precise 6.5.1 + cargo update -p thread_local --precise 1.1.7 - name: test build run: cargo check --target ${{ matrix.platform.target }} --features tracing,compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,test diff --git a/Cargo.lock b/Cargo.lock index 40ae95a78..1990d177a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3558,7 +3558,7 @@ dependencies = [ "cargo_toml", "dirs-next", "glob", - "heck 0.4.1", + "heck 0.5.0", "json-patch", "quote", "schemars", @@ -3687,7 +3687,7 @@ dependencies = [ "dunce", "getrandom 0.2.12", "glob", - "heck 0.4.1", + "heck 0.5.0", "html5ever", "infer", "json-patch", diff --git a/core/tauri-build/Cargo.toml b/core/tauri-build/Cargo.toml index 3bf723663..6b35f7897 100644 --- a/core/tauri-build/Cargo.toml +++ b/core/tauri-build/Cargo.toml @@ -33,7 +33,7 @@ tauri-utils = { version = "2.0.0-beta.12", path = "../tauri-utils", features = [ cargo_toml = "0.17" serde = "1" serde_json = "1" -heck = "0.4" +heck = "0.5" json-patch = "1.2" walkdir = "2" tauri-winres = "0.1" diff --git a/core/tauri-runtime-wry/CHANGELOG.md b/core/tauri-runtime-wry/CHANGELOG.md index 47f382093..98810da0d 100644 --- a/core/tauri-runtime-wry/CHANGELOG.md +++ b/core/tauri-runtime-wry/CHANGELOG.md @@ -351,6 +351,12 @@ - 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.5] + +### What's Changed + +- [`d42668ce`](https://www.github.com/tauri-apps/tauri/commit/d42668ce17494ab778f436aaa9b216d6db3f0b31)([#9003](https://www.github.com/tauri-apps/tauri/pull/9003)) Fix panic during intialization on wayland when using `clipboard` feature, instead propagate the error during API usage. + ## \[0.14.4] ### Bug Fixes diff --git a/core/tauri-utils/Cargo.toml b/core/tauri-utils/Cargo.toml index 613cfe900..8b9ed4f06 100644 --- a/core/tauri-utils/Cargo.toml +++ b/core/tauri-utils/Cargo.toml @@ -44,7 +44,7 @@ log = "0.4.21" cargo_metadata = { version = "0.18", optional = true } [target."cfg(target_os = \"linux\")".dependencies] -heck = "0.4" +heck = "0.5" [target."cfg(target_os = \"macos\")".dependencies] swift-rs = { version = "1.0.6", optional = true, features = [ "build" ] } diff --git a/tooling/bundler/CHANGELOG.md b/tooling/bundler/CHANGELOG.md index a0c2b1a05..afbb91d69 100644 --- a/tooling/bundler/CHANGELOG.md +++ b/tooling/bundler/CHANGELOG.md @@ -225,6 +225,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] + +### Bug Fixes + +- [`516386158`](https://www.github.com/tauri-apps/tauri/commit/5163861588b229fe2e13e61bf65fbf5b88743bb3)([#9040](https://www.github.com/tauri-apps/tauri/pull/9040)) On Windows, fix building WiX installer when resources contains an XML charcter that should be escaped. +- [`97a05145f`](https://www.github.com/tauri-apps/tauri/commit/97a05145fbb24533526eba6589594f03046e11df)([#9119](https://www.github.com/tauri-apps/tauri/pull/9119)) Fix compilation error due to dependency on unstable features of `log` crate. + ## \[1.5.0] ### New Features diff --git a/tooling/bundler/Cargo.toml b/tooling/bundler/Cargo.toml index 2bd4b14b1..36b1e112f 100644 --- a/tooling/bundler/Cargo.toml +++ b/tooling/bundler/Cargo.toml @@ -63,7 +63,7 @@ plist = "1" regex = "1" [target."cfg(target_os = \"linux\")".dependencies] -heck = "0.4" +heck = "0.5" ar = "0.9.0" md5 = "0.7.0" rpm = "0.14.0" diff --git a/tooling/bundler/src/bundle/windows/msi/wix.rs b/tooling/bundler/src/bundle/windows/msi/wix.rs index 99904599c..05da41076 100644 --- a/tooling/bundler/src/bundle/windows/msi/wix.rs +++ b/tooling/bundler/src/bundle/windows/msi/wix.rs @@ -16,7 +16,7 @@ use crate::bundle::{ }, }; use anyhow::{bail, Context}; -use handlebars::{to_json, Handlebars}; +use handlebars::{html_escape, to_json, Handlebars}; use regex::Regex; use serde::{Deserialize, Serialize}; use std::{ @@ -121,7 +121,7 @@ impl ResourceDirectory { r#""#, id = file.id, guid = file.guid, - path = file.path.display() + path = html_escape(&file.path.display().to_string()) ).as_str() ); } @@ -139,7 +139,7 @@ impl ResourceDirectory { format!( r#"{files}{directories}"#, id = Uuid::new_v4().as_simple(), - name = self.name, + name = html_escape(&self.name), files = files, directories = directories, ) diff --git a/tooling/bundler/src/bundle/windows/nsis.rs b/tooling/bundler/src/bundle/windows/nsis.rs index 5179e37f1..98ed8d6dc 100644 --- a/tooling/bundler/src/bundle/windows/nsis.rs +++ b/tooling/bundler/src/bundle/windows/nsis.rs @@ -339,6 +339,31 @@ fn build_nsis_app_installer( resources_ancestors.sort_by_key(|p| std::cmp::Reverse(p.components().count())); resources_ancestors.pop(); // Last one is always "" + // We need to convert / to \ for nsis to move the files into the correct dirs + #[cfg(not(target_os = "windows"))] + let resources: ResourcesMap = resources + .into_iter() + .map(|(r, p)| { + ( + r, + ( + p.0.display().to_string().replace('/', "\\").into(), + p.1.display().to_string().replace('/', "\\").into(), + ), + ) + }) + .collect(); + #[cfg(not(target_os = "windows"))] + let resources_ancestors: Vec = resources_ancestors + .into_iter() + .map(|p| p.display().to_string().replace('/', "\\").into()) + .collect(); + #[cfg(not(target_os = "windows"))] + let resources_dirs: Vec = resources_dirs + .into_iter() + .map(|p| p.display().to_string().replace('/', "\\").into()) + .collect(); + data.insert("resources_ancestors", to_json(resources_ancestors)); data.insert("resources_dirs", to_json(resources_dirs)); data.insert("resources", to_json(&resources)); diff --git a/tooling/bundler/src/bundle/windows/templates/installer.nsi b/tooling/bundler/src/bundle/windows/templates/installer.nsi index ea8932ebe..f26bdd31c 100644 --- a/tooling/bundler/src/bundle/windows/templates/installer.nsi +++ b/tooling/bundler/src/bundle/windows/templates/installer.nsi @@ -674,14 +674,10 @@ Section Uninstall ; Delete uninstaller Delete "$INSTDIR\uninstall.exe" - ${If} $DeleteAppDataCheckboxState == 1 - RMDir /R /REBOOTOK "$INSTDIR" - ${Else} - {{#each resources_ancestors}} - RMDir /REBOOTOK "$INSTDIR\\{{this}}" - {{/each}} - RMDir "$INSTDIR" - ${EndIf} + {{#each resources_ancestors}} + RMDir /REBOOTOK "$INSTDIR\\{{this}}" + {{/each}} + RMDir "$INSTDIR" ; Remove start menu shortcut !insertmacro MUI_STARTMENU_GETFOLDER Application $AppStartMenuFolder diff --git a/tooling/cli/CHANGELOG.md b/tooling/cli/CHANGELOG.md index c55ec99f4..7738392cd 100644 --- a/tooling/cli/CHANGELOG.md +++ b/tooling/cli/CHANGELOG.md @@ -564,6 +564,17 @@ - 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.11] + +### Bug Fixes + +- [`97a05145f`](https://www.github.com/tauri-apps/tauri/commit/97a05145fbb24533526eba6589594f03046e11df)([#9119](https://www.github.com/tauri-apps/tauri/pull/9119)) Fix compilation error due to dependency on unstable features of `log` crate. +- [`b15948b11`](https://www.github.com/tauri-apps/tauri/commit/b15948b11c0e362eea7ef57a4606f15f7dbd886b)([#8903](https://www.github.com/tauri-apps/tauri/pull/8903)) Fix `.taurignore` failing to ignore in some cases. + +### Dependencies + +- Upgraded to `tauri-bundler@1.5.1` + ## \[1.5.10] ### New Features diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index 2667b4ebe..fbec3fb2c 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -4866,7 +4866,7 @@ dependencies = [ "flate2", "glob", "handlebars 5.1.0", - "heck 0.4.1", + "heck 0.5.0", "hex", "image", "log", @@ -5023,7 +5023,7 @@ dependencies = [ "dunce", "getrandom 0.2.12", "glob", - "heck 0.4.1", + "heck 0.5.0", "html5ever", "infer 0.15.0", "json-patch", diff --git a/tooling/cli/metadata.json b/tooling/cli/metadata.json index 604a96d11..e1d2dbfe8 100644 --- a/tooling/cli/metadata.json +++ b/tooling/cli/metadata.json @@ -1,8 +1,8 @@ { "cli.js": { - "version": "1.5.10", + "version": "1.5.11", "node": ">= 10.0.0" }, - "tauri": "1.6.0", + "tauri": "1.6.1", "tauri-build": "1.5.1" } diff --git a/tooling/cli/node/CHANGELOG.md b/tooling/cli/node/CHANGELOG.md index f4a511575..7023faa63 100644 --- a/tooling/cli/node/CHANGELOG.md +++ b/tooling/cli/node/CHANGELOG.md @@ -528,6 +528,16 @@ - 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.11] + +### Bug Fixes + +- [`b15948b11`](https://www.github.com/tauri-apps/tauri/commit/b15948b11c0e362eea7ef57a4606f15f7dbd886b)([#8903](https://www.github.com/tauri-apps/tauri/pull/8903)) Fix `.taurignore` failing to ignore in some cases. + +### Dependencies + +- Upgraded to `tauri-cli@1.5.11` + ## \[1.5.10] ### Bug Fixes diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 4ef204118..ab6a45888 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -263,7 +263,11 @@ struct IgnoreMatcher(Vec); impl IgnoreMatcher { fn is_ignore(&self, path: &Path, is_dir: bool) -> bool { for gitignore in &self.0 { - if gitignore.matched(path, is_dir).is_ignore() { + if path.starts_with(gitignore.path()) + && gitignore + .matched_path_or_any_parents(path, is_dir) + .is_ignore() + { return true; } }