fix(core): `raw-window-handle` dependency, closes #2460 (#2465)

This commit is contained in:
Lucas Fernandes Nogueira 2021-08-17 10:27:18 -03:00 committed by GitHub
parent 8d1fe0ea05
commit aecdfaf76f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 7375 additions and 38 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch
---
Fix `raw-window-handle` dependency declaration.

View File

@ -7,20 +7,12 @@ members = [
"core/tauri-macros",
"core/tauri-utils",
"core/tauri-build",
"core/tauri-codegen",
# examples
"core/tauri-codegen"
]
exclude = [
# examples that can be compiled with the tauri CLI
"examples/api/src-tauri",
"examples/commands/src-tauri",
"examples/helloworld/src-tauri",
"examples/multiwindow/src-tauri",
"examples/navigation/src-tauri",
"examples/splashscreen/src-tauri",
"examples/state/src-tauri",
"examples/sidecar/src-tauri",
"examples/resources/src-tauri",
# used to build updater artifacts
"examples/updater/src-tauri",
"examples/updater/src-tauri"
]
# default to small, optimized workspace release binaries

View File

@ -67,7 +67,7 @@ open = { version = "2.0", optional = true }
shared_child = { version = "0.3", optional = true }
os_pipe = { version = "0.9", optional = true }
rfd = { version = "0.4.3", features = [ "parent" ] }
raw-window-handle = { version = "0.3.3", optional = true }
raw-window-handle = "0.3.3"
minisign-verify = { version = "0.1", optional = true }
os_info = { version = "3.0.6", optional = true }
futures-lite = "1.12"
@ -129,10 +129,38 @@ shell-all = [ "shell-open", "shell-execute" ]
shell-execute = [ "shared_child", "os_pipe" ]
shell-open = [ "open" ]
dialog-all = [ "dialog-open", "dialog-save" ]
dialog-open = [ "raw-window-handle" ]
dialog-save = [ "raw-window-handle" ]
dialog-open = [ ]
dialog-save = [ ]
http-all = [ ]
http-request = [ ]
notification-all = [ "notify-rust" ]
global-shortcut-all = [ ]
os-all = [ "os_info" ]
[[example]]
name = "commands"
path = "../../examples/commands/src-tauri/src/main.rs"
[[example]]
name = "helloworld"
path = "../../examples/helloworld/src-tauri/src/main.rs"
[[example]]
name = "multiwindow"
path = "../../examples/multiwindow/src-tauri/src/main.rs"
[[example]]
name = "navigation"
path = "../../examples/navigation/src-tauri/src/main.rs"
[[example]]
name = "splashscreen"
path = "../../examples/splashscreen/src-tauri/src/main.rs"
[[example]]
name = "state"
path = "../../examples/state/src-tauri/src/main.rs"
[[example]]
name = "resources"
path = "../../examples/resources/src-tauri/src/main.rs"

View File

@ -318,6 +318,7 @@ impl Command {
let (mut rx, _child) = self.spawn()?;
let code = crate::async_runtime::block_on(async move {
let mut code = None;
#[allow(clippy::collapsible_match)]
while let Some(event) = rx.recv().await {
if let CommandEvent::Terminated(payload) = event {
code = payload.code;

View File

@ -410,8 +410,6 @@ pub(crate) async fn check_update_with_dialog<R: Runtime>(
EVENT_STATUS_ERROR,
Some(dialog.err().unwrap().to_string()),
);
return;
}
}
}

3708
examples/api/src-tauri/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -185,6 +185,8 @@ fn main() {
future_simple_command_with_result,
async_stateful_command_with_result,
])
.run(tauri::generate_context!())
.run(tauri::generate_context!(
"../../examples/commands/src-tauri/tauri.conf.json"
))
.expect("error while running tauri application");
}

View File

@ -9,6 +9,8 @@
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.run(tauri::generate_context!(
"../../examples/helloworld/src-tauri/tauri.conf.json"
))
.expect("error while running tauri application");
}

View File

@ -24,6 +24,8 @@ fn main() {
(window_builder.title("Tauri - Rust"), webview_attributes)
},
)
.run(tauri::generate_context!())
.run(tauri::generate_context!(
"../../examples/multiwindow/src-tauri/tauri.conf.json"
))
.expect("failed to run tauri application");
}

View File

@ -9,6 +9,8 @@
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.run(tauri::generate_context!(
"../../examples/navigation/src-tauri/tauri.conf.json"
))
.expect("error while running tauri application");
}

View File

@ -7,16 +7,21 @@
windows_subsystem = "windows"
)]
use tauri::{
api::{
path::{resolve_path, BaseDirectory},
process::{Command, CommandEvent},
},
Manager,
};
#[cfg(not(any(feature = "api-all", feature = "shell-all", feature = "shell-execute")))]
fn main() {
let context = tauri::generate_context!();
eprintln!("Not supported without `api-all`, `shell-all` or `shell-execute`")
}
#[cfg(any(feature = "api-all", feature = "shell-all", feature = "shell-execute"))]
fn main() {
use tauri::{
api::{
path::{resolve_path, BaseDirectory},
process::{Command, CommandEvent},
},
Manager,
};
let context = tauri::generate_context!("../../examples/resources/src-tauri/tauri.conf.json");
let script_path = resolve_path(
context.config(),
context.package_info(),
@ -34,6 +39,7 @@ fn main() {
.spawn()
.expect("Failed to spawn node");
#[allow(clippy::collapsible_match)]
while let Some(event) = rx.recv().await {
if let CommandEvent::Stdout(line) = event {
window

View File

@ -39,6 +39,8 @@ fn main() {
Ok(())
})
.run(tauri::generate_context!())
.run(tauri::generate_context!(
"../../examples/sidecar/src-tauri/tauri.conf.json"
))
.expect("error while running tauri application");
}

View File

@ -8,7 +8,7 @@ Run the following scripts on the root directory of the repository:
```bash
# runs the example that wait on a Rust initialization script to show the main window
$ cargo run --bin splashscreen
$ cargo run --example splashscreen
# runs the example that wait on the UI to load to show the main window
$ cargo run --bin splashscreen --features ui
$ cargo run --example splashscreen --features ui
```

View File

@ -35,7 +35,9 @@ mod rust {
Ok(())
})
.invoke_handler(tauri::generate_handler![close_splashscreen])
.run(tauri::generate_context!())
.run(tauri::generate_context!(
"../../examples/splashscreen/src-tauri/tauri.conf.json"
))
.expect("failed to run app");
}
}
@ -76,7 +78,9 @@ mod ui {
Ok(())
})
.invoke_handler(tauri::generate_handler![close_splashscreen])
.run(tauri::generate_context!())
.run(tauri::generate_context!(
"../../examples/splashscreen/src-tauri/tauri.conf.json"
))
.expect("error while running tauri application");
}
}

View File

@ -81,6 +81,8 @@ fn main() {
disconnect,
connection_send
])
.run(tauri::generate_context!())
.run(tauri::generate_context!(
"../../examples/state/src-tauri/tauri.conf.json"
))
.expect("error while running tauri application");
}

3583
examples/updater/src-tauri/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -117,7 +117,7 @@ switch ($smoke_test_path.parent) {
}
# if tauri run the helloworld example from the tauri folder.
"tauri" {
cd $CWD/tauri; cargo run --bin helloworld
cd $CWD/tauri; cargo run --example helloworld
}
# transpiled are not supported yet.
"transpiled" {