Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Rust protobuf bindings (#765)
## Description: <!-- Describe this change, how it works, and the motivation behind it. --> ## Is this change user facing? YES/NO <!-- If yes, please add the "user facing" label to the PR --> <!-- If yes, don't forget to include docs changes where relevant --> ## References (if applicable): <!-- Add relevant Github Issues, Discord threads, or other helpful information. -->
- Loading branch information
1 parent
fb3e922
commit 0e47003
Showing
10 changed files
with
4,059 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "kurtosis-sdk" | ||
version = "0.0.0" | ||
license = "BUSL-1.1" | ||
description = "Rust SDK for Kurtosis" | ||
edition = "2021" | ||
readme = "README.md" | ||
homepage = "https://kurtosis.com" | ||
repository = "https://github.com/kurtosis-tech/kurtosis" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
prost = "0.11.9" | ||
prost-types = "0.11.9" | ||
tokio = { version = "1.28.2", features = ["macros", "rt-multi-thread"] } | ||
tonic = "0.9.2" | ||
|
||
|
||
[build-dependencies] | ||
tonic-build = "0.9.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Kurtosis Rust SDK | ||
|
||
This is an SDK for [Kurtosis](https://github.com/kurtosis-tech/kurtosis), based on the protobufs available [here](https://github.com/kurtosis-tech/kurtosis/tree/main/api/protobuf); | ||
|
||
More details can be found on the [docs](https://docs.kurtosis.com/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use std::io::Result; | ||
use std::str; | ||
use std::process::Command; | ||
|
||
fn main() -> Result<()> { | ||
// Protobuf compilation only happens inside Kurtosis monorepo | ||
let regenerate_protobuf_bindings = option_env!("KURTOSIS_REGENERATE_BINDINGS"); | ||
if regenerate_protobuf_bindings.is_some() { | ||
let mut kurtosis_folder_command = Command::new("git"); | ||
kurtosis_folder_command.arg("rev-parse").arg("--show-toplevel"); | ||
let kurtosis_folder = kurtosis_folder_command.output()?; | ||
let kurtosis_folder_str = str::from_utf8(&kurtosis_folder.stdout).unwrap().trim(); | ||
return tonic_build::configure() | ||
.out_dir("src") | ||
.compile(&[ | ||
format!("{}/api/protobuf/engine/engine_service.proto", kurtosis_folder_str), | ||
format!("{}/api/protobuf/core/api_container_service.proto", kurtosis_folder_str) | ||
], &[kurtosis_folder_str]) | ||
} | ||
Ok(()) | ||
} |
Oops, something went wrong.