Remove alloc guards and update codegen
Remove unnecessary `alloc` feature guards in `roto-tonic`. Add `roto-runtime` dependency to `codegen`, fix test data paths, and include `async-trait` in the hello world build test.
This commit is contained in:
@@ -5,6 +5,7 @@ edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
roto-runtime = { path = "../runtime" }
|
||||
roto-tonic = { path = "../roto-tonic" }
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
log = "0.4"
|
||||
|
||||
@@ -646,7 +646,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_protoc_binary_compatibility() {
|
||||
let data = include_bytes!("../data/test_data.pb");
|
||||
let data = include_bytes!("../../data/test_data.pb");
|
||||
let acc = ProtoAccessor::new(data).unwrap();
|
||||
|
||||
// 1. Varints (Integers, Booleans, Enums)
|
||||
|
||||
@@ -34,7 +34,11 @@ fn test_helloworld_generated_code_builds() {
|
||||
|
||||
// Create new library project
|
||||
let status = Command::new("cargo")
|
||||
.args(["new", "--lib", temp_project_dir.to_str().expect("Invalid path")])
|
||||
.args([
|
||||
"new",
|
||||
"--lib",
|
||||
temp_project_dir.to_str().expect("Invalid path"),
|
||||
])
|
||||
.status()
|
||||
.expect("Failed to run cargo new");
|
||||
assert!(status.success(), "cargo new failed");
|
||||
@@ -44,7 +48,7 @@ fn test_helloworld_generated_code_builds() {
|
||||
let cargo_toml_content =
|
||||
fs::read_to_string(&cargo_toml_path).expect("Failed to read Cargo.toml");
|
||||
let updated_cargo_toml = format!(
|
||||
"{}\n\nroto-codegen = {{ path = \"{}\" }}\nroto-runtime = {{ path = \"{}\" }}\nroto-tonic = {{ path = \"{}\" }}\nbytes = \"1.7\"\ntonic = \"0.12\"\ntokio-stream = \"0.1\"\ntower = \"0.4\"\nfutures-util = \"0.3\"\nhttp-body-util = \"0.1\"\nhttp-body = \"1.0\"\n\nhttp = \"1.0\"\n\n[workspace]\n",
|
||||
"{}\n\nroto-codegen = {{ path = \"{}\" }}\nroto-runtime = {{ path = \"{}\" }}\nroto-tonic = {{ path = \"{}\" }}\nbytes = \"1.7\"\ntonic = \"0.12\"\ntokio-stream = \"0.1\"\ntower = \"0.4\"\nfutures-util = \"0.3\"\nhttp-body-util = \"0.1\"\nhttp-body = \"1.0\"\nasync-trait = \"0.1\"\n\nhttp = \"1.0\"\n\n[workspace]\n",
|
||||
cargo_toml_content,
|
||||
codegen_root.to_string_lossy(),
|
||||
project_root.join("runtime").to_string_lossy(),
|
||||
@@ -55,7 +59,10 @@ fn test_helloworld_generated_code_builds() {
|
||||
// 4. Write the generated code to src/lib.rs
|
||||
let mut all_code = String::new();
|
||||
for (_, content) in generated_files {
|
||||
let replaced = content.replace("use crate::{BufferPool, StatusBody};", "use roto_tonic::{BufferPool, StatusBody};");
|
||||
let replaced = content.replace(
|
||||
"use crate::{BufferPool, StatusBody};",
|
||||
"use roto_tonic::{BufferPool, StatusBody};",
|
||||
);
|
||||
all_code.push_str(&replaced);
|
||||
all_code.push_str("\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user