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:
2026-06-09 22:25:35 -07:00
parent 6ac13ff43e
commit 2979dd476e
6 changed files with 13 additions and 263 deletions
+10 -3
View File
@@ -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");
}