diff --git a/Cargo.lock b/Cargo.lock index a5fd520..24e6ef2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -551,7 +551,12 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", + "bytes 0.4.12", + "crunch-file", "crunch-traits", + "prost 0.12.1", + "prost-build", + "prost-types 0.12.1", "tokio", "tracing", ] @@ -1926,13 +1931,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "test-bin" -version = "0.1.0" -dependencies = [ - "crunch-envelope", -] - [[package]] name = "textwrap" version = "0.16.0" diff --git a/Cargo.toml b/Cargo.toml index 682d8e2..2f2911e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ toml_edit = {version = "0.20.0",features = ["serde"]} serde = {version = "1.0.88", features = ["derive"]} prost = {version = "0.12"} prost-types = {version = "0.12"} +prost-build = "0.5" bytes = {version = "0.4"} diff --git a/crates/crunch-codegen/Cargo.toml b/crates/crunch-codegen/Cargo.toml index 01fc24d..16eb84d 100644 --- a/crates/crunch-codegen/Cargo.toml +++ b/crates/crunch-codegen/Cargo.toml @@ -7,8 +7,13 @@ edition = "2021" [dependencies] crunch-traits.workspace = true +crunch-file.workspace = true anyhow.workspace = true tracing.workspace = true tokio.workspace = true async-trait.workspace = true +prost.workspace = true +prost-types.workspace = true +prost-build.workspace = true +bytes.workspace = true diff --git a/crates/crunch-codegen/src/lib.rs b/crates/crunch-codegen/src/lib.rs index 7d12d9a..192c2a8 100644 --- a/crates/crunch-codegen/src/lib.rs +++ b/crates/crunch-codegen/src/lib.rs @@ -1,14 +1,15 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - #[cfg(test)] mod tests { - use super::*; + #[tokio::test] + async fn test_can_generate_output_rust() { + let proto_spec = r#" +syntax = "proto3"; - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); +package test.can.generate.output.rust; + +message MyEvent { + string name = 1; +} +"#; } } diff --git a/crates/test-bin/Cargo.toml b/crates/test-bin/Cargo.toml deleted file mode 100644 index 1485ae8..0000000 --- a/crates/test-bin/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "test-bin" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -crunch-envelope.workspace = true diff --git a/crates/test-bin/src/main.rs b/crates/test-bin/src/main.rs deleted file mode 100644 index b250fd9..0000000 --- a/crates/test-bin/src/main.rs +++ /dev/null @@ -1,27 +0,0 @@ -fn main() { - #[no_mangle] - fn envelope_capnp_benchmark(content: &[u8]) { - let out = crunch_envelope::wrap("some-domain", "some-entity", content); - - let out = crunch_envelope::unwrap(&out).expect("to be able to unwrap capnp message"); - - println!("{:?}", out.1); - } - - #[no_mangle] - fn envelope_json_benchmark(content: &[u8]) { - let out = crunch_envelope::json::wrap("some-domain", "some-entity", content); - - let out = crunch_envelope::json::unwrap(&out).expect("to be able to unwrap capnp message"); - - println!("{:?}", out.1); - } - - let large_content: [u8; 1000000] = [0; 1000000]; - - envelope_capnp_benchmark(&large_content); - - envelope_json_benchmark(&large_content); - - println!("done") -}