Skip to content

Commit

Permalink
- fix: publish
Browse files Browse the repository at this point in the history
  • Loading branch information
agallardol committed Aug 23, 2024
1 parent 10ab5f0 commit 511f410
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
9 changes: 8 additions & 1 deletion libs/shinkai-tools-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
23 changes: 19 additions & 4 deletions libs/shinkai-tools-runner/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,44 @@ 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() {
panic!(
"chmod command failed: {}",
String::from_utf8_lossy(&output.stderr)
);
} else {
println!("Successfully set executable permissions on backend binary");
}
}
}

0 comments on commit 511f410

Please sign in to comment.