From 511f4108bfc89ebf4afe2abad69dd7360b483c4a Mon Sep 17 00:00:00 2001 From: Alfredo Gallardo Date: Fri, 23 Aug 2024 11:49:01 -0400 Subject: [PATCH] - fix: publish --- libs/shinkai-tools-runner/Cargo.toml | 9 ++++++++- libs/shinkai-tools-runner/build.rs | 23 +++++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/libs/shinkai-tools-runner/Cargo.toml b/libs/shinkai-tools-runner/Cargo.toml index 82599d7..402bdde 100644 --- a/libs/shinkai-tools-runner/Cargo.toml +++ b/libs/shinkai-tools-runner/Cargo.toml @@ -4,7 +4,14 @@ description = "Rust library to execute shinkai-tools in a safe and performant en version = { workspace = true } edition = { workspace = true } keywords = ["shinkai", "tools", "runner", "safe", "ai"] -include = ["src/**/*", "tools/**/*", "build.rs", "Cargo.toml", "Cargo.lock"] +include = [ + "src/**/*", + "tools/**/*", + "shinkai-tools-runner-resources/**/*", + "build.rs", + "Cargo.toml", + "Cargo.lock", +] license-file = { workspace = true } homepage = { workspace = true } readme = { workspace = true } diff --git a/libs/shinkai-tools-runner/build.rs b/libs/shinkai-tools-runner/build.rs index 2d19180..f058ae4 100644 --- a/libs/shinkai-tools-runner/build.rs +++ b/libs/shinkai-tools-runner/build.rs @@ -10,22 +10,35 @@ fn main() { let target_path = Path::new(&env::var("OUT_DIR").unwrap()).join("shinkai-tools-runner-resources"); + println!("Resources path: {:?}", resources_path); + println!("Target path: {:?}", target_path); + let shinkai_tools_backend_binary_name = if cfg!(target_os = "windows") { "shinkai-tools-backend.exe" } else { "shinkai-tools-backend" }; - let source = resources_path.join(shinkai_tools_backend_binary_name); - let backend_path = target_path.join("shinkai-tools-backend"); + let shinkai_tools_backend_source_path = resources_path.join(shinkai_tools_backend_binary_name); + let shinkai_tools_backend_destination_path = + target_path.join(shinkai_tools_backend_binary_name); + println!("Source path: {:?}", shinkai_tools_backend_source_path); + println!("Backend path: {:?}", shinkai_tools_backend_destination_path); if resources_path.exists() { fs::create_dir_all(&target_path).unwrap(); - fs::copy(source, backend_path.clone()).unwrap(); + fs::copy( + shinkai_tools_backend_source_path, + shinkai_tools_backend_destination_path.clone(), + ) + .unwrap(); + println!("Copied backend binary to target path"); + } else { + println!("Resources path does not exist"); } if !cfg!(target_os = "windows") { let output = std::process::Command::new("chmod") .arg("+x") - .arg(&backend_path) + .arg(&shinkai_tools_backend_destination_path) .output() .expect("Failed to execute chmod command"); if !output.status.success() { @@ -33,6 +46,8 @@ fn main() { "chmod command failed: {}", String::from_utf8_lossy(&output.stderr) ); + } else { + println!("Successfully set executable permissions on backend binary"); } } }