Update gtk to 0.16 (#6155)

Co-authored-by: Wu Yu Wei <wusyong9104@gmail.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
Ngo Iok Ui (Wu Yu Wei) 2023-01-30 02:08:27 +08:00 committed by GitHub
parent 8835633955
commit 7eb9aa75cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 150 additions and 148 deletions

View File

@ -7,7 +7,7 @@
"getPublishedVersion": "node ../../.scripts/covector/package-latest-version.js cargo ${ pkgFile.pkg.package.name } ${ pkgFile.pkg.package.version }",
"prepublish": [
"sudo apt-get update",
"sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev",
"sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev",
"cargo install cargo-audit --features=fix",
{
"command": "cargo generate-lockfile",

8
.changes/gtk16.md Normal file
View File

@ -0,0 +1,8 @@
---
"tauri-runtime": minor
"tauri-runtime-wry": minor
"tauri": minor
---
Update gtk to 0.16.

13
.changes/msrv-1.64.md Normal file
View File

@ -0,0 +1,13 @@
---
"cli.rs": minor
"tauri-bundler": minor
"tauri": minor
"tauri-build": minor
"tauri-codegen": minor
"tauri-macros": minor
"tauri-utils": minor
"tauri-runtime": minor
"tauri-runtime-wry": minor
---
Bump the MSRV to 1.64.

View File

@ -6,7 +6,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
# Derived from Tauri contribution and setup guides:
# See: https://github.com/tauri-apps/tauri/blob/dev/.github/CONTRIBUTING.md#development-guide
# See: https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-linux
ARG TAURI_BUILD_DEPS="build-essential curl libappindicator3-dev libgtk-3-dev librsvg2-dev libssl-dev libwebkit2gtk-4.0-dev wget"
ARG TAURI_BUILD_DEPS="build-essential curl libappindicator3-dev libgtk-3-dev librsvg2-dev libssl-dev libwebkit2gtk-4.1-dev wget"
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends $TAURI_BUILD_DEPS

View File

@ -41,4 +41,4 @@ ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
RUN dpkg --add-architecture arm64
RUN apt-get update
RUN apt-get install --assume-yes --no-install-recommends libssl-dev:arm64 libdbus-1-dev:arm64 libsoup2.4-dev:arm64 libssl-dev:arm64 libgtk-3-dev:arm64 webkit2gtk-4.0-dev:arm64 libappindicator3-1:arm64 librsvg2-dev:arm64 patchelf:arm64
RUN apt-get install --assume-yes --no-install-recommends libssl-dev:arm64 libdbus-1-dev:arm64 libsoup2.4-dev:arm64 libssl-dev:arm64 libgtk-3-dev:arm64 webkit2gtk-4.1-dev:arm64 libappindicator3-1:arm64 librsvg2-dev:arm64 patchelf:arm64

View File

@ -40,7 +40,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
with:

View File

@ -47,7 +47,7 @@ jobs:
run: |
python -m pip install --upgrade pip
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev xvfb
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev xvfb
wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
sudo dpkg -i hyperfine_1.11.0_amd64.deb
pip install memory_profiler

View File

@ -30,7 +30,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev libfuse2
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev libfuse2
- uses: Swatinem/rust-cache@v2
with:

View File

@ -111,7 +111,7 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
- name: Test
run: |

View File

@ -62,7 +62,7 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
- uses: actions-rs/toolchain@v1
with:

View File

@ -257,7 +257,7 @@ jobs:
- name: install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
- name: Test bindings
run: yarn test
test-linux-x64-musl-binding:
@ -351,7 +351,7 @@ jobs:
set -e
export PATH=/usr/local/cargo/bin/:/usr/local/fnm:$PATH
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends -y unzip webkit2gtk-4.0 libayatana-appindicator3-dev
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends -y unzip webkit2gtk-4.1 libayatana-appindicator3-dev
bash
curl https://sh.rustup.rs -sSf | bash -s -- -y
curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "/usr/local/fnm" --skip-shell

View File

@ -51,7 +51,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
with:

View File

@ -34,35 +34,35 @@ jobs:
- {
target: x86_64-pc-windows-msvc,
os: windows-latest,
toolchain: '1.61.0',
toolchain: '1.64.0',
cross: false,
command: 'test'
}
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-latest,
toolchain: '1.59.0',
toolchain: '1.64.0',
cross: false,
command: 'test'
}
- {
target: x86_64-apple-darwin,
os: macos-latest,
toolchain: '1.59.0',
toolchain: '1.64.0',
cross: false,
command: 'test'
}
- {
target: aarch64-apple-ios,
os: macos-latest,
toolchain: '1.59.0',
toolchain: '1.64.0',
cross: false,
command: 'build'
}
- {
target: aarch64-linux-android,
os: ubuntu-latest,
toolchain: '1.59.0',
toolchain: '1.64.0',
cross: true,
command: 'build'
}
@ -95,7 +95,7 @@ jobs:
if: contains(matrix.platform.target, 'unknown-linux')
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
with:

View File

@ -33,7 +33,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1
- name: setup node
uses: actions/setup-node@v3

View File

@ -157,7 +157,7 @@ jobs:
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
- uses: actions-rs/cargo@v1
with:

View File

@ -70,7 +70,7 @@ For **developing** Tauri apps refer to the [Getting Started guide on tauri.app](
For **running** Tauri apps we support the below configurations (these are automatically added as dependencies for .deb and are bundled for AppImage so that your users don't need to manually install them):
- Debian (Ubuntu 18.04 and above or equivalent) with the following packages installed:
- `libwebkit2gtk-4.0-37`, `libgtk-3-0`, `libayatana-appindicator3-1`<sup>1</sup>
- `libwebkit2gtk-4.1-0`, `libgtk-3-0`, `libayatana-appindicator3-1`<sup>1</sup>
- Arch with the following packages installed:
- `webkit2gtk`, `gtk3`, `libayatana-appindicator`<sup>1</sup>
- Fedora (latest 2 versions) with the following packages installed:

View File

@ -8,7 +8,7 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri/tree/dev/core/tauri-build"
description = "build time code to pair with https://crates.io/crates/tauri"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"

View File

@ -8,7 +8,7 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri/tree/dev/core/tauri-codegen"
description = "code generation meant to be consumed inside of `tauri` through `tauri-build` or `tauri-macros`"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"

View File

@ -8,7 +8,7 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri"
description = "Macros for the tauri crate."
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"

View File

@ -8,12 +8,12 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri"
description = "Wry bindings to the Tauri runtime"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
[dependencies]
wry = { git = "https://github.com/tauri-apps/wry", branch = "dev", default-features = false, features = [ "file-drop", "protocol" ] }
wry = { version = "0.25.0", default-features = false, features = [ "file-drop", "protocol" ] }
tauri-runtime = { version = "0.13.0-alpha.0", path = "../tauri-runtime" }
tauri-utils = { version = "2.0.0-alpha.0", path = "../tauri-utils" }
uuid = { version = "1", features = [ "v4" ] }
@ -28,8 +28,8 @@ webview2-com = "0.19.1"
features = [ "Win32_Foundation" ]
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
gtk = { version = "0.15", features = [ "v3_20" ] }
webkit2gtk = { version = "0.18.2", features = [ "v2_22" ] }
gtk = { version = "0.16", features = [ "v3_24" ] }
webkit2gtk = { version = "0.19.1", features = [ "v2_38" ] }
percent-encoding = "2.1"
[target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies]

View File

@ -8,7 +8,7 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri"
description = "Runtime for Tauri applications"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
@ -41,7 +41,7 @@ webview2-com = "0.19.1"
features = [ "Win32_Foundation" ]
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
gtk = { version = "0.15", features = [ "v3_20" ] }
gtk = { version = "0.16", features = [ "v3_24" ] }
[features]
devtools = [ ]

View File

@ -7,7 +7,7 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri"
description = "Utilities for Tauri"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"

View File

@ -3,7 +3,7 @@ authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
description = "Make tiny, secure apps for all desktop platforms with Tauri"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
exclude = [ "/test", "/.scripts", "CHANGELOG.md", "/target" ]
homepage = "https://tauri.app"
license = "Apache-2.0 OR MIT"
@ -87,13 +87,13 @@ ico = { version = "0.2.0", optional = true }
encoding_rs = "0.8.31"
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
rfd = { version = "0.10", optional = true }
rfd = { git = "https://github.com/PolyMeilex/rfd", version = "0.10", optional = true }
notify-rust = { version = "4.5", default-features = false, features = [ "d" ], optional = true }
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
gtk = { version = "0.15", features = [ "v3_20" ] }
glib = "0.15"
webkit2gtk = { version = "0.18.2", features = [ "v2_22" ] }
gtk = { version = "0.16", features = [ "v3_24" ] }
glib = "0.16"
webkit2gtk = { version = "0.19.1", features = [ "v2_38" ] }
[target."cfg(target_os = \"macos\")".dependencies]
embed_plist = "1.2"

View File

@ -3,7 +3,7 @@ name = "api"
version = "0.1.0"
description = "An example Tauri Application showcasing the api"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
license = "Apache-2.0 OR MIT"
[lib]

View File

@ -85,7 +85,7 @@ fn force_async(the_argument: String) -> String {
#[command(async)]
fn force_async_with_result(the_argument: &str) -> Result<&str, MyError> {
(!the_argument.is_empty())
.then(|| the_argument)
.then_some(the_argument)
.ok_or(MyError::FooError)
}
@ -121,7 +121,7 @@ fn force_async_snake(the_argument: String) -> String {
#[command(rename_all = "snake_case", async)]
fn force_async_with_result_snake(the_argument: &str) -> Result<&str, MyError> {
(!the_argument.is_empty())
.then(|| the_argument)
.then_some(the_argument)
.ok_or(MyError::FooError)
}
@ -131,7 +131,7 @@ fn force_async_with_result_snake(the_argument: &str) -> Result<&str, MyError> {
fn simple_command_with_result(the_argument: String) -> Result<String, MyError> {
println!("{the_argument}");
(!the_argument.is_empty())
.then(|| the_argument)
.then_some(the_argument)
.ok_or(MyError::FooError)
}
@ -150,7 +150,7 @@ fn stateful_command_with_result(
fn simple_command_with_result_snake(the_argument: String) -> Result<String, MyError> {
println!("{the_argument}");
(!the_argument.is_empty())
.then(|| the_argument)
.then_some(the_argument)
.ok_or(MyError::FooError)
}

View File

@ -3,7 +3,7 @@ name = "resources"
version = "0.1.0"
description = "A Tauri application that uses Node.js with app resources"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] }

View File

@ -3,7 +3,7 @@ name = "sidecar"
version = "0.1.0"
description = "A Tauri application with a sidecar binary"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[build-dependencies]
tauri-build = { path = "../../../core/tauri-build", features = ["codegen"] }

View File

@ -3,7 +3,7 @@ name = "app1"
version = "0.1.0"
description = "A simple app that makes a dll call"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[workspace]

View File

@ -3,7 +3,7 @@ name = "tauri_app"
version = "0.1.0"
description = "A very simple Dll Library that runs tauri and launches a webview window"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[workspace]

View File

@ -3,7 +3,7 @@ name = "updater-example"
version = "0.1.0"
description = "A very simple Tauri Application"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
license = "Apache-2.0 OR MIT"
[build-dependencies]

View File

@ -7,7 +7,7 @@ license = ""
repository = ""
default-run = "app"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[build-dependencies]
tauri-build = { path = "../../../../core/tauri-build", features = [] }

View File

@ -5,7 +5,7 @@ name = "tauri_bench"
version = "0.1.0"
authors = [ "Tauri Programme within The Commons Conservancy" ]
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
license = "Apache-2.0 OR MIT"
description = "Cross-platform WebView rendering library"
repository = "https://github.com/tauri-apps/wry"

View File

@ -3,7 +3,7 @@ name = "bench_cpu_intensive"
version = "0.1.0"
description = "A very simple Tauri Application"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[build-dependencies]
tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" ] }

View File

@ -3,7 +3,7 @@ name = "bench_files_transfer"
version = "0.1.0"
description = "A very simple Tauri Application"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[build-dependencies]
tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" ] }

View File

@ -3,7 +3,7 @@ name = "bench_helloworld"
version = "0.1.0"
description = "A very simple Tauri Application"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[build-dependencies]
tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" ] }

View File

@ -13,7 +13,7 @@ keywords = [ "bundle", "cargo", "tauri" ]
repository = "https://github.com/tauri-apps/tauri"
description = "Wrap rust executables in OS-specific app bundles for Tauri"
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
exclude = [ "CHANGELOG.md", "/target", "rustfmt.toml" ]
[dependencies]

View File

@ -254,8 +254,7 @@ impl<'d> serde::de::Visitor<'d> for AppCategoryVisitor {
match self.did_you_mean {
Some(string) => write!(
formatter,
"a valid app category string (did you mean \"{}\"?)",
string
"a valid app category string (did you mean \"{string}\"?)"
),
None => write!(formatter, "a valid app category string"),
}

View File

@ -72,14 +72,12 @@ pub fn copy_file(from: impl AsRef<Path>, to: impl AsRef<Path>) -> crate::Result<
let to = to.as_ref();
if !from.exists() {
return Err(crate::Error::GenericError(format!(
"{:?} does not exist",
from
"{from:?} does not exist"
)));
}
if !from.is_file() {
return Err(crate::Error::GenericError(format!(
"{:?} is not a file",
from
"{from:?} is not a file"
)));
}
let dest_dir = to.parent().expect("No data in parent");
@ -96,20 +94,17 @@ pub fn copy_file(from: impl AsRef<Path>, to: impl AsRef<Path>) -> crate::Result<
pub fn copy_dir(from: &Path, to: &Path) -> crate::Result<()> {
if !from.exists() {
return Err(crate::Error::GenericError(format!(
"{:?} does not exist",
from
"{from:?} does not exist"
)));
}
if !from.is_dir() {
return Err(crate::Error::GenericError(format!(
"{:?} is not a Directory",
from
"{from:?} is not a Directory"
)));
}
if to.exists() {
return Err(crate::Error::GenericError(format!(
"{:?} already exists",
from
"{from:?} already exists"
)));
}
let parent = to.parent().expect("No data in parent");
@ -142,7 +137,7 @@ pub trait CommandExt {
impl CommandExt for Command {
fn output_ok(&mut self) -> crate::Result<Output> {
let program = self.get_program().to_string_lossy().into_owned();
debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{} {}", acc, arg)));
debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{acc} {arg}")));
self.stdout(Stdio::piped());
self.stderr(Stdio::piped());
@ -196,8 +191,7 @@ impl CommandExt for Command {
Ok(output)
} else {
Err(crate::Error::GenericError(format!(
"failed to run {}",
program
"failed to run {program}"
)))
}
}

View File

@ -65,13 +65,13 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
settings.version_string(),
arch
);
let package_name = format!("{}.deb", package_base_name);
let package_name = format!("{package_base_name}.deb");
let base_dir = settings.project_out_directory().join("bundle/deb");
let package_dir = base_dir.join(&package_base_name);
if package_dir.exists() {
fs::remove_dir_all(&package_dir)
.with_context(|| format!("Failed to remove old {}", package_base_name))?;
.with_context(|| format!("Failed to remove old {package_base_name}"))?;
}
let package_path = base_dir.join(&package_name);
@ -118,7 +118,7 @@ pub fn generate_data(
for bin in settings.binaries() {
let bin_path = settings.binary_path(bin);
common::copy_file(&bin_path, bin_dir.join(bin.name()))
.with_context(|| format!("Failed to copy binary from {:?}", bin_path))?;
.with_context(|| format!("Failed to copy binary from {bin_path:?}"))?;
}
copy_resource_files(settings, &data_dir).with_context(|| "Failed to copy resource files")?;
@ -137,7 +137,7 @@ pub fn generate_data(
/// Generate the application desktop file and store it under the `data_dir`.
fn generate_desktop_file(settings: &Settings, data_dir: &Path) -> crate::Result<()> {
let bin_name = settings.main_binary_name();
let desktop_file_name = format!("{}.desktop", bin_name);
let desktop_file_name = format!("{bin_name}.desktop");
let desktop_file_path = data_dir
.join("usr/share/applications")
.join(desktop_file_name);
@ -153,8 +153,8 @@ fn generate_desktop_file(settings: &Settings, data_dir: &Path) -> crate::Result<
if !settings.short_description().is_empty() {
writeln!(file, "Comment={}", settings.short_description())?;
}
writeln!(file, "Exec={}", bin_name)?;
writeln!(file, "Icon={}", bin_name)?;
writeln!(file, "Exec={bin_name}")?;
writeln!(file, "Icon={bin_name}")?;
writeln!(file, "Name={}", settings.product_name())?;
writeln!(file, "Terminal=false")?;
writeln!(file, "Type=Application")?;
@ -174,11 +174,11 @@ fn generate_control_file(
let mut file = common::create_file(&dest_path)?;
writeln!(file, "Package: {}", AsKebabCase(settings.product_name()))?;
writeln!(file, "Version: {}", settings.version_string())?;
writeln!(file, "Architecture: {}", arch)?;
writeln!(file, "Architecture: {arch}")?;
// 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)?;
writeln!(file, "Maintainer: {authors}")?;
if !settings.homepage_url().is_empty() {
writeln!(file, "Homepage: {}", settings.homepage_url())?;
}
@ -194,13 +194,13 @@ fn generate_control_file(
if long_description.is_empty() {
long_description = "(none)";
}
writeln!(file, "Description: {}", short_description)?;
writeln!(file, "Description: {short_description}")?;
for line in long_description.lines() {
let line = line.trim();
if line.is_empty() {
writeln!(file, " .")?;
} else {
writeln!(file, " {}", line)?;
writeln!(file, " {line}")?;
}
}
writeln!(file, "Priority: optional")?;
@ -223,14 +223,14 @@ fn generate_md5sums(control_dir: &Path, data_dir: &Path) -> crate::Result<()> {
let mut hash = md5::Context::new();
io::copy(&mut file, &mut hash)?;
for byte in hash.compute().iter() {
write!(md5sums_file, "{:02x}", byte)?;
write!(md5sums_file, "{byte:02x}")?;
}
let rel_path = path.strip_prefix(data_dir)?;
let path_str = rel_path.to_str().ok_or_else(|| {
let msg = format!("Non-UTF-8 path: {:?}", rel_path);
let msg = format!("Non-UTF-8 path: {rel_path:?}");
io::Error::new(io::ErrorKind::InvalidData, msg)
})?;
writeln!(md5sums_file, " {}", path_str)?;
writeln!(md5sums_file, " {path_str}")?;
}
Ok(())
}

View File

@ -104,7 +104,7 @@ where
let from = from.as_ref();
if !from.exists() {
if let Some(msg) = from.to_str() {
let msg = format!("Path \"{}\" does not exist or you don't have access", msg);
let msg = format!("Path \"{msg}\" does not exist or you don't have access");
return Err(crate::Error::PathUtilError(msg));
}
return Err(crate::Error::PathUtilError(
@ -114,7 +114,7 @@ where
if !from.is_file() {
if let Some(msg) = from.to_str() {
let msg = format!("Path \"{}\" is not a file!", msg);
let msg = format!("Path \"{msg}\" is not a file!");
return Err(crate::Error::PathUtilError(msg));
}
return Err(crate::Error::PathUtilError(
@ -127,7 +127,7 @@ where
}
if let Some(msg) = to.as_ref().to_str() {
let msg = format!("Path \"{}\" is exist", msg);
let msg = format!("Path \"{msg}\" is exist");
return Err(crate::Error::PathUtilError(msg));
}
}
@ -145,7 +145,7 @@ where
let from = from.as_ref();
if !from.exists() {
if let Some(msg) = from.to_str() {
let msg = format!("Path \"{}\" does not exist or you don't have access!", msg);
let msg = format!("Path \"{msg}\" does not exist or you don't have access!");
return Err(crate::Error::PathUtilError(msg));
}
return Err(crate::Error::PathUtilError(
@ -154,7 +154,7 @@ where
}
if !from.is_dir() {
if let Some(msg) = from.to_str() {
let msg = format!("Path \"{}\" is not a directory!", msg);
let msg = format!("Path \"{msg}\" is not a directory!");
return Err(crate::Error::PathUtilError(msg));
}
return Err(crate::Error::PathUtilError(

View File

@ -95,10 +95,10 @@ pub fn target_triple() -> Result<String, crate::Error> {
)));
};
format!("{}-{}", os, env)
format!("{os}-{env}")
};
Ok(format!("{}-{}", arch, os))
Ok(format!("{arch}-{os}"))
}
#[cfg(test)]

View File

@ -574,8 +574,7 @@ impl Settings {
"windows" => vec![PackageType::WindowsMsi],
os => {
return Err(crate::Error::GenericError(format!(
"Native {} bundles not yet supported.",
os
"Native {os} bundles not yet supported."
)))
}
};

View File

@ -6,7 +6,7 @@ name = "tauri-cli"
version = "2.0.0-alpha.1"
authors = [ "Tauri Programme within The Commons Conservancy" ]
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
homepage = "https://tauri.app"

View File

@ -8,7 +8,7 @@ authors = [ "Tauri Programme within The Commons Conservancy" ]
license = ""
repository = ""
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[package.metadata.bundle]
identifier = "com.tauri.dev"

View File

@ -89,8 +89,7 @@ pub fn command(mut options: Options) -> Result<()> {
}
None => {
return Err(anyhow::anyhow!(format!(
"Unsupported bundle format: {}",
name
"Unsupported bundle format: {name}"
)));
}
}
@ -361,7 +360,7 @@ fn run_hook(name: &str, hook: HookCommand, interface: &AppInterface, debug: bool
.current_dir(cwd)
.envs(env)
.piped()
.with_context(|| format!("failed to run `{}` with `sh -c`", script))?;
.with_context(|| format!("failed to run `{script}` with `sh -c`"))?;
if !status.success() {
bail!(
@ -396,9 +395,9 @@ mod pkgconfig_utils {
pub fn get_appindicator_library_path() -> PathBuf {
match get_library_path("ayatana-appindicator3-0.1") {
Some(p) => format!("{}/libayatana-appindicator3.so.1", p).into(),
Some(p) => format!("{p}/libayatana-appindicator3.so.1").into(),
None => match get_library_path("appindicator3-0.1") {
Some(p) => format!("{}/libappindicator3.so.1", p).into(),
Some(p) => format!("{p}/libappindicator3.so.1").into(),
None => panic!("Can't detect any appindicator library"),
},
}

View File

@ -231,7 +231,7 @@ pub fn setup(options: &mut Options, mobile: bool) -> Result<AppInterface> {
command.stderr(os_pipe::dup_stderr()?);
let child = SharedChild::spawn(&mut command)
.unwrap_or_else(|_| panic!("failed to run `{}`", before_dev));
.unwrap_or_else(|_| panic!("failed to run `{before_dev}`"));
let child = Arc::new(child);
let child_ = child.clone();
@ -294,7 +294,7 @@ pub fn setup(options: &mut Options, mobile: bool) -> Result<AppInterface> {
let server_address = SocketAddr::new(ip, port);
let path = path.canonicalize()?;
start_dev_server(server_address, path);
let server_url = format!("http://{}", server_address);
let server_url = format!("http://{server_address}");
dev_path = AppUrl::Url(WindowUrl::External(server_url.parse().unwrap()));
// TODO: in v2, use an env var to pass the url to the app context
@ -306,10 +306,7 @@ pub fn setup(options: &mut Options, mobile: bool) -> Result<AppInterface> {
c.build.dev_path = dev_path.clone();
options.config = Some(serde_json::to_string(&c).unwrap());
} else {
options.config = Some(format!(
r#"{{ "build": {{ "devPath": "{}" }} }}"#,
server_url
))
options.config = Some(format!(r#"{{ "build": {{ "devPath": "{server_url}" }} }}"#))
}
}

View File

@ -209,7 +209,7 @@ fn acquire(
}
}
}
let msg = format!("waiting for file lock on {}", msg);
let msg = format!("waiting for file lock on {msg}");
log::info!(action = "Blocking"; "{}", &msg);
lock_block().with_context(|| format!("failed to lock file: {}", path.display()))?;

View File

@ -81,11 +81,11 @@ where
}
let mut sk_writer = create_file(sk_path)?;
write!(sk_writer, "{:}", key)?;
write!(sk_writer, "{key:}")?;
sk_writer.flush()?;
let mut pk_writer = create_file(pk_path)?;
write!(pk_writer, "{:}", pubkey)?;
write!(pk_writer, "{pubkey:}")?;
pk_writer.flush()?;
Ok((fs::canonicalize(sk_path)?, fs::canonicalize(pk_path)?))

View File

@ -83,7 +83,7 @@ fn appx(source: &DynamicImage, out_dir: &Path) -> Result<()> {
resize_and_save_png(source, 50, &out_dir.join("StoreLogo.png"))?;
for size in [30, 44, 71, 89, 107, 142, 150, 284, 310] {
let file_name = format!("Square{}x{}Logo.png", size, size);
let file_name = format!("Square{size}x{size}Logo.png");
log::info!(action = "Appx"; "Creating {}", file_name);
resize_and_save_png(source, size, &out_dir.join(&file_name))?;
@ -115,7 +115,7 @@ fn icns(source: &DynamicImage, out_dir: &Path) -> Result<()> {
&image,
IconType::from_ostype(entry.ostype.parse().unwrap()).unwrap(),
)
.with_context(|| format!("Can't add {} to Icns Family", name))?;
.with_context(|| format!("Can't add {name} to Icns Family"))?;
}
let mut out_file = BufWriter::new(File::create(out_dir.join("icon.icns"))?);
@ -169,7 +169,7 @@ fn png(source: &DynamicImage, out_dir: &Path) -> Result<()> {
let file_name = match size {
256 => "128x128@2x.png".to_string(),
512 => "icon.png".to_string(),
_ => format!("{}x{}.png", size, size),
_ => format!("{size}x{size}.png"),
};
entries.push(PngEntry {
@ -307,10 +307,7 @@ fn png(source: &DynamicImage, out_dir: &Path) -> Result<()> {
});
}
for multiplier in target.multipliers {
let name = format!(
"AppIcon-{size_str}@{multiplier}x.png",
multiplier = multiplier
);
let name = format!("AppIcon-{size_str}@{multiplier}x.png");
entries.push(PngEntry {
out_path: out_dir.join(&name),
name,

View File

@ -128,7 +128,7 @@ pub(crate) fn cli_upstream_version() -> Result<String> {
}
fn crate_latest_version(name: &str) -> Option<String> {
let url = format!("https://docs.rs/crate/{}/", name);
let url = format!("https://docs.rs/crate/{name}/");
match ureq::get(&url).call() {
Ok(response) => match (response.status(), response.header("location")) {
(302, Some(location)) => Some(location.replace(&url, "")),
@ -431,7 +431,7 @@ fn crate_version(
crate_lock_package.version.clone()
};
(
format!("{} (no manifest)", version_string),
format!("{version_string} (no manifest)"),
vec![crate_lock_package.version.clone()],
)
}
@ -457,14 +457,14 @@ fn crate_version(
Ok(manifest) => manifest.package.version,
Err(_) => "unknown version".to_string(),
};
format!("path:{:?} [{}]", p, v)
format!("path:{p:?} [{v}]")
} else if let Some(g) = p.git {
is_git = true;
let mut v = format!("git:{}", g);
let mut v = format!("git:{g}");
if let Some(branch) = p.branch {
let _ = write!(v, "&branch={}", branch);
let _ = write!(v, "&branch={branch}");
} else if let Some(rev) = p.rev {
let _ = write!(v, "#{}", rev);
let _ = write!(v, "#{rev}");
}
v
} else {
@ -505,7 +505,7 @@ fn crate_version(
(Some(version), Some(target_version)) => {
let target_version = semver::Version::parse(&target_version).unwrap();
if version < target_version {
Some(format!(" (outdated, latest: {})", target_version))
Some(format!(" (outdated, latest: {target_version})"))
} else {
None
}

View File

@ -950,8 +950,8 @@ fn tauri_config_to_bundle_settings(
}
}
// provides `libwebkit2gtk-4.0.so.37` and all `4.0` versions have the -37 package name
depends.push("libwebkit2gtk-4.0-37".to_string());
// provides `libwebkit2gtk-4.1.so.37` and all `4.0` versions have the -37 package name
depends.push("libwebkit2gtk-4.1-0".to_string());
depends.push("libgtk-3-0".to_string());
}

View File

@ -103,7 +103,7 @@ fn get_file_path(
warn: bool,
) -> Result<Option<PathBuf>> {
let possible = dir.join(filename_without_extension);
let possible_with_extension = dir.join(format!("{}.toml", filename_without_extension));
let possible_with_extension = dir.join(format!("{filename_without_extension}.toml"));
if possible.exists() {
if warn && possible_with_extension.exists() {

View File

@ -151,10 +151,10 @@ pub fn build(
let triple_out_dir = app_settings
.out_dir(Some(triple.into()), options.debug)
.with_context(|| format!("failed to get {} out dir", triple))?;
.with_context(|| format!("failed to get {triple} out dir"))?;
build_production_app(options, available_targets, config_features.clone())
.with_context(|| format!("failed to build {} binary", triple))?;
.with_context(|| format!("failed to build {triple} binary"))?;
lipo_cmd.arg(triple_out_dir.join(bin_name));
}
@ -162,8 +162,7 @@ pub fn build(
let lipo_status = lipo_cmd.output_ok()?.status;
if !lipo_status.success() {
return Err(anyhow::anyhow!(format!(
"Result of `lipo` command was unsuccessful: {}. (Is `lipo` installed?)",
lipo_status
"Result of `lipo` command was unsuccessful: {lipo_status}. (Is `lipo` installed?)"
)));
}
} else {

View File

@ -54,7 +54,7 @@ impl Manifest {
let mut all_enabled_features: Vec<String> = self
.tauri_features
.iter()
.map(|f| format!("tauri/{}", f))
.map(|f| format!("tauri/{f}"))
.collect();
let manifest_features = self.features();
@ -86,7 +86,7 @@ pub fn read_manifest(manifest_path: &Path) -> crate::Result<Document> {
let mut manifest_str = String::new();
let mut manifest_file = File::open(manifest_path)
.with_context(|| format!("failed to open `{:?}` file", manifest_path))?;
.with_context(|| format!("failed to open `{manifest_path:?}` file"))?;
manifest_file.read_to_string(&mut manifest_str)?;
let manifest: Document = manifest_str

View File

@ -184,7 +184,7 @@ where
.try_init();
if let Err(err) = init_res {
eprintln!("Failed to attach logger: {}", err);
eprintln!("Failed to attach logger: {err}");
}
match cli.command {
@ -235,14 +235,14 @@ impl CommandExt for Command {
self.stdout(os_pipe::dup_stdout()?);
self.stderr(os_pipe::dup_stderr()?);
let program = self.get_program().to_string_lossy().into_owned();
debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{} {}", acc, arg)));
debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{acc} {arg}")));
self.status().map_err(Into::into)
}
fn output_ok(&mut self) -> crate::Result<Output> {
let program = self.get_program().to_string_lossy().into_owned();
debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{} {}", acc, arg)));
debug!(action = "Running"; "Command `{} {}`", program, self.get_args().map(|arg| arg.to_string_lossy()).fold(String::new(), |acc, arg| format!("{acc} {arg}")));
self.stdout(Stdio::piped());
self.stderr(Stdio::piped());

View File

@ -193,10 +193,7 @@ fn get_str<'a>(helper: &'a Helper) -> &'a str {
.unwrap_or("")
}
fn get_str_array<'a>(
helper: &'a Helper,
formatter: impl Fn(&str) -> String,
) -> Option<Vec<String>> {
fn get_str_array(helper: &Helper, formatter: impl Fn(&str) -> String) -> Option<Vec<String>> {
helper.param(0).and_then(|v| {
v.value().as_array().and_then(|arr| {
arr
@ -249,7 +246,7 @@ fn quote_and_join(
) -> HelperResult {
out
.write(
&get_str_array(helper, |s| format!("{:?}", s))
&get_str_array(helper, |s| format!("{s:?}"))
.ok_or_else(|| RenderError::new("`quote-and-join` helper wasn't given an array"))?
.join(", "),
)
@ -265,7 +262,7 @@ fn quote_and_join_colon_prefix(
) -> HelperResult {
out
.write(
&get_str_array(helper, |s| format!("{:?}", format!(":{}", s)))
&get_str_array(helper, |s| format!("{:?}", format!(":{s}")))
.ok_or_else(|| {
RenderError::new("`quote-and-join-colon-prefix` helper wasn't given an array")
})?

View File

@ -160,7 +160,7 @@ fn setup_dev_config(config_extension: &mut Option<String>) -> crate::Result<()>
c.build.dev_path = dev_path.clone();
config_extension.replace(serde_json::to_string(&c).unwrap());
} else {
config_extension.replace(format!(r#"{{ "build": {{ "devPath": "{}" }} }}"#, url));
config_extension.replace(format!(r#"{{ "build": {{ "devPath": "{url}" }} }}"#));
}
reload_config(config_extension.as_deref())?;
}

View File

@ -6,7 +6,7 @@ authors = ["you"]
license = ""
repository = ""
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -6,7 +6,7 @@
"getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -",
"prepublish": [
"sudo apt-get update",
"sudo apt-get install -y webkit2gtk-4.0",
"sudo apt-get install -y webkit2gtk-4.1",
"cargo install cargo-audit",
{
"command": "cargo generate-lockfile",

View File

@ -21,7 +21,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y webkit2gtk-4.1
- name: Install clippy with stable toolchain
uses: actions-rs/toolchain@v1
with:

View File

@ -35,7 +35,7 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y webkit2gtk-4.1
- uses: Swatinem/rust-cache@v2

View File

@ -4,7 +4,7 @@ version = "0.0.0"
authors = [ "{{ author }}" ]
description = ""
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
exclude = ["/examples"]
[dependencies]

View File

@ -5,7 +5,7 @@ description = "A Tauri App"
authors = [ "{{ author }}" ]
repository = ""
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[dependencies]
serde_json = "1.0"

View File

@ -6,7 +6,7 @@
"getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -",
"prepublish": [
"sudo apt-get update",
"sudo apt-get install -y webkit2gtk-4.0",
"sudo apt-get install -y webkit2gtk-4.1",
"cargo install cargo-audit",
{
"command": "cargo generate-lockfile",

View File

@ -21,7 +21,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y webkit2gtk-4.1
- name: Install clippy with stable toolchain
uses: actions-rs/toolchain@v1
with:

View File

@ -34,7 +34,7 @@ jobs:
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y webkit2gtk-4.1
- uses: Swatinem/rust-cache@v2

View File

@ -4,7 +4,7 @@ version = "0.0.0"
authors = [ "{{ author }}" ]
description = ""
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
exclude = ["/examples", "/webview-dist", "/webview-src", "node_modules"]
[dependencies]

View File

@ -5,7 +5,7 @@ description = "A Tauri App"
authors = [ "{{ author }}" ]
repository = ""
edition = "2021"
rust-version = "1.59"
rust-version = "1.64"
[dependencies]
serde_json = "1.0"