Skip to content

Commit 5075b67

Browse files
authored
fix(tauri): build without the wry feature flag (#14039)
* fix(tauri): build without the wry feature flag * change file * fix windows
1 parent c3252f7 commit 5075b67

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

.changes/build-without-wry.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri": patch:bug
3+
---
4+
5+
Fix compilation when the `wry` Cargo feature is disabled.
6+

.github/workflows/test-core.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ jobs:
9595

9696
- name: test
9797
if: ${{ !matrix.platform.cross }}
98-
run: cargo ${{ matrix.platform.command }} --target ${{ matrix.platform.target }} ${{ matrix.features.args }} --manifest-path crates/tauri/Cargo.toml
98+
run: cargo ${{ matrix.features.key == 'no-default' && 'check' || matrix.platform.command }} --target ${{ matrix.platform.target }} ${{ matrix.features.args }} --manifest-path crates/tauri/Cargo.toml
9999

100100
- name: test (using cross)
101101
if: ${{ matrix.platform.cross }}
102102
run: |
103103
cargo install cross --git https://github.com/cross-rs/cross --rev 51f46f296253d8122c927c5bb933e3c4f27cc317 --locked
104-
cross ${{ matrix.platform.command }} --target ${{ matrix.platform.target }} ${{ matrix.features.args }} --manifest-path crates/tauri/Cargo.toml
104+
cross ${{ matrix.features.key == 'no-default' && 'check' || matrix.platform.command }} --target ${{ matrix.platform.target }} ${{ matrix.features.args }} --manifest-path crates/tauri/Cargo.toml

crates/tauri/src/webview/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ fn main() {
11761176

11771177
/// Set the environment for the webview.
11781178
/// Useful if you need to share the same environment, for instance when using the [`Self::on_new_window`].
1179-
#[cfg(windows)]
1179+
#[cfg(all(feature = "wry", windows))]
11801180
pub fn with_environment(
11811181
mut self,
11821182
environment: webview2_com::Microsoft::Web::WebView2::Win32::ICoreWebView2Environment,

crates/tauri/src/webview/webview_window.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ impl<R: Runtime, M: Manager<R>> WebviewWindowBuilder<'_, R, M> {
12651265

12661266
/// Set the environment for the webview.
12671267
/// Useful if you need to share the same environment, for instance when using the [`Self::on_new_window`].
1268-
#[cfg(windows)]
1268+
#[cfg(all(feature = "wry", windows))]
12691269
pub fn with_environment(
12701270
mut self,
12711271
environment: webview2_com::Microsoft::Web::WebView2::Win32::ICoreWebView2Environment,
@@ -1331,19 +1331,22 @@ impl<R: Runtime, M: Manager<R>> WebviewWindowBuilder<'_, R, M> {
13311331
.with_webview_configuration(features.opener().target_configuration.clone());
13321332
}
13331333

1334-
#[cfg(windows)]
1334+
#[cfg(all(feature = "wry", windows))]
13351335
{
13361336
self.webview_builder = self
13371337
.webview_builder
13381338
.with_environment(features.opener().environment.clone());
13391339
}
13401340

1341-
#[cfg(any(
1342-
target_os = "linux",
1343-
target_os = "dragonfly",
1344-
target_os = "freebsd",
1345-
target_os = "netbsd",
1346-
target_os = "openbsd"
1341+
#[cfg(all(
1342+
feature = "wry",
1343+
any(
1344+
target_os = "linux",
1345+
target_os = "dragonfly",
1346+
target_os = "freebsd",
1347+
target_os = "netbsd",
1348+
target_os = "openbsd",
1349+
)
13471350
))]
13481351
{
13491352
self.webview_builder = self

0 commit comments

Comments
 (0)