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

Make not require linux for socketcan #93

Open
wants to merge 2 commits into
base: Develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# editor things
.idea/
.zed/
.vscode/

# misc things
.DS_Store
.gitignore
*.nix

# python things
pyrightconfig.json
__pycache__/

# Added by cargo (rust things)
/target
build/
dist/
logs/

# protobuf
mod.rs
command_data.rs
serverdata.rs

# private testing
/privatetest/
2 changes: 1 addition & 1 deletion .github/workflows/calypso-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Create and publish Calypso docker image
on:
push:
branches: ['Develop']
path:
paths:
- "Dockerfile"
workflow_dispatch:

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Build
run: cargo build --verbose
run: cargo build --all --verbose
- name: Test
run: cargo test --verbose
- name: Fmt
run: cargo fmt --check
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --verbose --all -- -D warnings
- name: Audit
Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is awesome

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ serde_json = "1.0.134"


[dependencies]
socketcan = "3.3.1"
paho-mqtt = "0.12.5"
protobuf-codegen = "3.5.1"
protobuf = "3.5.1"
Expand All @@ -29,6 +28,9 @@ phf = { version = "0.11.2", features = ["macros"] }
calypso-cangen = { path = "./libs/calypso-cangen" }
daedalus = { path = "./libs/daedalus" }

[target.'cfg(target_os = "linux")'.dependencies]
socketcan = { version = "3.3.1" }


[build-dependencies]
protobuf-codegen = "3.5.1"
Expand Down
20 changes: 1 addition & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,4 @@ Now view calypso interpret the can message and broadcast it on `mqttui`
#### Run from Docker
- ```docker pull ghcr.io/northeastern-electric-racing/calypso:Develop```
- ```docker run -d --rm --network host ghcr.io/northeastern-electric-racing/calypso:Develop```
- ```docker run -d --rm -e CALYPSO_SIREN_HOST_URL=127.0.0.1:1883 --network host ghcr.io/northeastern-electric-racing/calypso:Develop```



### Generate Proto

#### linux
`apt-get install protobuf-compiler -y`

#### mac
`brew install protobuf`

`cargo install protobuf-codegen`

`PATH="$HOME/.cargo/bin:$PATH"`

`protoc --rust_out ./src ./src/proto/serverdata.proto`

delete the `mod.rs` file
- ```docker run -d --rm -e CALYPSO_SIREN_HOST_URL=127.0.0.1:1883 --network host ghcr.io/northeastern-electric-racing/calypso:Develop```
3 changes: 2 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::process;
/* Prebuild script */
fn main() {
println!("cargo:rerun-if-changed=Embedded-Base");
println!("cargo:rerun-if-changed=src/proto");

protobuf_codegen::Codegen::new()
.pure()
Expand All @@ -13,7 +14,7 @@ fn main() {
.input("src/proto/command_data.proto")
.input("src/proto/serverdata.proto")
// Specify output directory relative to Cargo output directory.
.out_dir("src")
.out_dir("src/proto")
.run_from_script();

// Validate CAN spec
Expand Down
4 changes: 2 additions & 2 deletions src/bin/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::{
time::{Duration, UNIX_EPOCH},
};

use calypso::proto::serverdata;
use calypso::{
mqtt::MqttClient, serverdata, simulatable_message::SimShared,
simulate_data::create_simulated_components,
mqtt::MqttClient, simulatable_message::SimShared, simulate_data::create_simulated_components,
};
use clap::Parser;

Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
pub mod command_data;
pub mod data;
pub mod decode_data;
pub mod encode_data;
pub mod mqtt;
pub mod serverdata;
pub mod proto;
pub mod simulatable_message;
pub mod simulate_data;
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use std::{
};

use calypso::{
command_data, data::DecodeData, data::EncodeData, decode_data::*, encode_data::*,
mqtt::MqttClient, serverdata,
data::DecodeData, data::EncodeData, decode_data::*, encode_data::*, mqtt::MqttClient,
proto::command_data, proto::serverdata,
};
use clap::Parser;
use protobuf::Message;
Expand Down
Loading