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

feat/dotgraph: implement dot graph rendering as part of the proc-macro #43

Merged
merged 8 commits into from
Jul 18, 2023
Merged
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
70 changes: 58 additions & 12 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ The path to the generated file will be displayed and is of the form
`${OUT_DIR}/${orchestra|lowercase}-subsystem-messaging.dot`.
Use `dot -Tpng ${OUT_DIR}/${orchestra|lowercase}-subsystem-messaging.dot > connectivity.dot` to
convert to i.e. a `png` image or use your favorite dot file viewer.
It also creates a `.svg` alongside the `.dot` graph, derived from the `.dot` graph for
direct usage.

## Caveats

Expand Down
4 changes: 3 additions & 1 deletion metered-channel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ derive_more = "0.99"
tracing = "0.1.35"
thiserror = "1.0.31"
crossbeam-queue = "0.3.5"
nanorand = { version = "0.7.0", default-features = false, features = ["wyrand"] }
nanorand = { version = "0.7.0", default-features = false, features = [
"wyrand",
] }
coarsetime = "^0.1.22"

[dev-dependencies]
Expand Down
5 changes: 3 additions & 2 deletions orchestra/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ name = "bench_main"
harness = false

[features]
default = ["deny_unconsumed_messages","deny_unsent_messages"]
default = ["deny_unconsumed_messages", "deny_unsent_messages"]
# Generate a file containing the generated code that
# is used via `include_str!`.
expand = ["orchestra-proc-macro/expand"]
# Generate a connectivity graph in dot-graph form.
# Generated file: `${OUT_DIR}/${orchestra|lowercase}-subsystem-messaging.dot`
# Use with `dot $path/to/dot.file -Tpng > connection.graph`
# Use with `dot $path/to/dot.file -Tpng > connection.graph` or use
# the generated `*.svg` file directly.
# or use a dot-graph viewer of your choice.
dotgraph = ["orchestra-proc-macro/dotgraph"]
# Creates a compile error if unconsumed messages are encountered
Expand Down
20 changes: 12 additions & 8 deletions orchestra/proc-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,29 @@ syn = { version = "1.0.109", features = ["full", "extra-traits"] }
quote = "1.0.20"
proc-macro2 = { version = "1.0.47", features = ["span-locations"] }
proc-macro-crate = "1.1.3"
expander = { version = "1.0.0", default-features = false }
expander = { version = "2.0.0", default-features = false }
petgraph = "0.6.0"
itertools = { version = "0.10.3" }
indexmap = "1"
itertools = { version = "0.11" }
indexmap = "2"
dotlay = { package = "layout-rs", version = "0.1.1", features = [
"log",
], optional = true }
fs-err = { version = "2", optional = true }
anyhow = { version = "1", optional = true }

[dev-dependencies]
assert_matches = "1.5"
orchestra = { path = "../" }
thiserror = "1"
tracing = "0.1"

[features]
default = [] # enable "dotgraph" by default, blocked by <https://github.com/paritytech/ci_cd/issues/433>
default = []
# enable "dotgraph" by default, blocked by <https://github.com/paritytech/ci_cd/issues/433>
# write the expanded version to a `orchestra-expansion.[a-f0-9]{10}.rs`
# in the `OUT_DIR` as defined by `cargo` for the `expander` crate.
expand = []
# Create directional message consuming / outgoing graph.
# Generates: `${OUT_DIR}/${orchestra|lowercase}-subsystem-messaging.dot`
dotgraph = []
dotgraph = ["dotlay", "anyhow", "fs-err"]

# Creates a compile error if unconsumed messages are encountered
deny_unconsumed_messages = []
# Creates a compile error if unsent messages are encountered
Expand Down
Loading