diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 6f33f539..46cd71dd 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1699,6 +1699,7 @@ dependencies = [ "protoc-bin-vendored", "serde", "serde_json", + "tauri", "tokio", "tokio-stream", "tonic", @@ -1763,9 +1764,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -1773,7 +1774,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap 2.1.0", "slab", "tokio", "tokio-util", @@ -2974,6 +2975,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "os_pipe" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "overload" version = "0.1.1" @@ -4164,6 +4175,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shared_child" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "signature" version = "2.1.0" @@ -4197,9 +4218,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" @@ -4776,6 +4797,7 @@ dependencies = [ "once_cell", "open", "os_info", + "os_pipe", "percent-encoding", "rand 0.8.5", "raw-window-handle", @@ -4787,6 +4809,7 @@ dependencies = [ "serde_json", "serde_repr", "serialize-to-javascript", + "shared_child", "state", "sys-locale", "tar", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index ca0e3294..23749c90 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -44,6 +44,7 @@ tauri = { version = "1.5.4", features = [ "os-all", "protocol-asset", "shell-open", + "shell-sidecar", "updater", "window-close", "window-maximize", diff --git a/src-tauri/grpc/Cargo.toml b/src-tauri/grpc/Cargo.toml index 4f32754c..3de6213c 100644 --- a/src-tauri/grpc/Cargo.toml +++ b/src-tauri/grpc/Cargo.toml @@ -20,3 +20,4 @@ hyper = { version = "0.14" } hyper-rustls = { version = "0.24.0", features = ["http2"] } protoc-bin-vendored = "3.0.0" uuid = { version = "1.7.0", features = ["v4"] } +tauri = { version = "1.5.4", features = ["process-command-api"]} diff --git a/src-tauri/grpc/src/proto.rs b/src-tauri/grpc/src/proto.rs index 7219c93e..0677d598 100644 --- a/src-tauri/grpc/src/proto.rs +++ b/src-tauri/grpc/src/proto.rs @@ -1,23 +1,23 @@ use std::env::temp_dir; use std::ops::Deref; use std::path::PathBuf; -use std::process::Command; use std::str::FromStr; use anyhow::anyhow; -use hyper::client::HttpConnector; use hyper::Client; +use hyper::client::HttpConnector; use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}; -use log::{debug, warn}; +use log::{debug, info, warn}; use prost::Message; use prost_reflect::{DescriptorPool, MethodDescriptor}; use prost_types::{FileDescriptorProto, FileDescriptorSet}; +use tauri::api::process::{Command, CommandEvent}; use tokio::fs; use tokio_stream::StreamExt; use tonic::body::BoxBody; use tonic::codegen::http::uri::PathAndQuery; -use tonic::transport::Uri; use tonic::Request; +use tonic::transport::Uri; use tonic_reflection::pb::server_reflection_client::ServerReflectionClient; use tonic_reflection::pb::server_reflection_request::MessageRequest; use tonic_reflection::pb::server_reflection_response::MessageResponse; @@ -27,36 +27,67 @@ pub async fn fill_pool_from_files(paths: Vec) -> Result { + info!("protoc stdout: {}", line); + } + CommandEvent::Stderr(line) => { + info!("protoc stderr: {}", line); + } + CommandEvent::Error(e) => { + return Err(e.to_string()); + } + CommandEvent::Terminated(c) => { + match c.code { + Some(0) => { + // success + } + Some(code) => { + return Err(format!( + "protoc failed with exit code: {}", + code, + )); + } + None => { + return Err("protoc failed with no exit code".to_string()); + } + } + } + _ => {} + }; } let bytes = fs::read(desc_path.as_path()) diff --git a/src-tauri/protoc-vendored/protoc-aarch64-apple-darwin b/src-tauri/protoc-vendored/protoc-aarch64-apple-darwin new file mode 100755 index 00000000..9b65af26 Binary files /dev/null and b/src-tauri/protoc-vendored/protoc-aarch64-apple-darwin differ diff --git a/src-tauri/protoc-vendored/protoc-x86_64-apple-darwin b/src-tauri/protoc-vendored/protoc-x86_64-apple-darwin new file mode 100755 index 00000000..66a62656 Binary files /dev/null and b/src-tauri/protoc-vendored/protoc-x86_64-apple-darwin differ diff --git a/src-tauri/protoc-vendored/protoc-x86_64-pc-windows-msvc.exe b/src-tauri/protoc-vendored/protoc-x86_64-pc-windows-msvc.exe new file mode 100755 index 00000000..add9eeb5 Binary files /dev/null and b/src-tauri/protoc-vendored/protoc-x86_64-pc-windows-msvc.exe differ diff --git a/src-tauri/protoc-vendored/protoc-x86_64-unknown-linux-gnu b/src-tauri/protoc-vendored/protoc-x86_64-unknown-linux-gnu new file mode 100755 index 00000000..d40a980c Binary files /dev/null and b/src-tauri/protoc-vendored/protoc-x86_64-unknown-linux-gnu differ diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 7aebe081..14d8e754 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "Yaak", - "version": "2024.3.0-beta.1" + "version": "2024.3.0-beta.2" }, "tauri": { "windows": [], @@ -32,7 +32,13 @@ }, "shell": { "all": false, - "open": true + "open": true, + "sidecar": true, + "scope": [ + { "name": "protoc", "sidecar": true, + "args": true + } + ] }, "window": { "close": true, @@ -56,7 +62,9 @@ "active": true, "category": "DeveloperTool", "copyright": "", - "externalBin": [], + "externalBin": [ + "protoc-vendored/protoc" + ], "icon": [ "icons/release/32x32.png", "icons/release/128x128.png",