Skip to content

Commit 272377b

Browse files
committed
Replace test code script with build.rs
1 parent cc2ca19 commit 272377b

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testing/README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
## Generating code from DBC files
44

5-
The `./generate_example_code.sh foo.dbc` script will use dbc-codegen to generate Rust code
5+
The `.can-messages/build.rs` will use dbc-codegen to generate Rust code
66
from a given DBC file in `./dbc-examples` (`example.dbc` when no file is given).
77

8-
IMPORTANT: The `rust-itegration` crate uses the generated code!
8+
IMPORTANT: The `rust-integration` crate uses the generated code!
99

1010
## Generate test data using nodejs and socketcan
1111

testing/can-messages/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ edition = "2018"
88
arbitrary = { version = "1.0", optional = true }
99
bitvec = { version = "0.21", default-features = false }
1010

11+
[build-dependencies]
12+
anyhow = "1.0"
13+
dbc-codegen = { path = "../../" }
14+
1115
[features]
1216
default = ["debug", "arb"]
1317
arb = ["arbitrary"]

testing/can-messages/build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use std::path::PathBuf;
2+
3+
use anyhow::Result;
4+
5+
fn main() -> Result<()> {
6+
let dbc_file: PathBuf = PathBuf::from("../dbc-examples/example.dbc");
7+
let out: PathBuf = PathBuf::from("src/");
8+
println!("cargo:rerun-if-changed=../dbc-examples/example.dbc");
9+
dbc_codegen::codegen(dbc_file, out, true)?;
10+
Ok(())
11+
}

testing/cantools-messages/generate_example_code.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)