Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Codegen in Rust with Daedalus #67

Merged
merged 9 commits into from
Nov 5, 2024
Merged
13 changes: 2 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,5 @@ mod.rs
command_data.rs
serverdata.rs

# cangen files generaed by calypsogen.py
decode_master_mapping.rs
decode_data.rs
encode_data.rs
encode_master_mapping.rs
format_data.rs
simulate_data.rs

# my dumb script
./format
/privatetest/
# private testing
/privatetest/
124 changes: 109 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ default-run = "calypso"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace]
members = ["libs/daedalus", "libs/calypso-cangen"]

[workspace.dependencies]
proc-macro2 = "1.0.89"
quote = "1.0.37"
serde = { version = "1.0.214", features = ["derive"] }
serde_json = "1.0.132"


[dependencies]
socketcan = "3.3.0"
paho-mqtt = "0.12.5"
Expand All @@ -15,6 +25,9 @@ protobuf = "3.5.1"
bitstream-io = "2.5.3"
clap = { version = "4.5.20", features = ["derive", "env"] }
rand = "0.8"
phf = { version = "0.11.2", features = ["macros"] }
calypso-cangen = { path = "./libs/calypso-cangen" }
daedalus = { path = "./libs/daedalus" }


[build-dependencies]
Expand Down
16 changes: 0 additions & 16 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
use std::process::Command;

/* Prebuild script */
fn main() {
println!("cargo:rerun-if-changed=Embedded-Base");

match Command::new("python3").arg("./calypsogen.py").status() {
Ok(status) if status.success() => {
println!("Python script executed successfully");
}
Ok(status) => {
eprintln!("Python script exited with status: {}", status);
std::process::exit(1);
}
Err(e) => {
eprintln!("Failed to execute Python script: {}", e);
std::process::exit(1);
}
}

protobuf_codegen::Codegen::new()
.pure()
// All inputs and imports from the inputs must reside in `includes` directories.
Expand Down
66 changes: 0 additions & 66 deletions calypsogen.py

This file was deleted.

9 changes: 9 additions & 0 deletions libs/calypso-cangen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "calypso-cangen"
version = "0.1.0"
edition = "2021"

[dependencies]
proc-macro2.workspace = true
quote.workspace = true
serde = { workspace = true, features = ["derive"] }
Loading
Loading