make tools/draw_graph.sh work again

This commit is contained in:
debris 2016-11-08 17:01:15 +01:00
parent 68a3bb2d34
commit 8d4e004a78
3 changed files with 26 additions and 2 deletions

View File

@ -24,3 +24,5 @@ import = { path = "import" }
[[bin]]
path = "pbtc/main.rs"
name = "pbtc"
[workspace]

View File

@ -1,4 +1,16 @@
#!/bin/bash
cargo graph --build-shape box --build-line-style dashed > graph.dot
dot -Tpng > graph.png graph.dot
# Cargo graph does not work with cargo worspaces #33
# https://github.com/kbknapp/cargo-graph/issues/33
# so first we need to patch Cargo.toml and remove workspace
patch -R Cargo.toml tools/workspace.diff
# Now let's rebuild Cargo.lock by telling cargo to update local package
cargo update -p pbtc
# And draw dependencies graph using cargo graph
cargo graph --build-shape box --build-line-style dashed > tools/graph.dot
dot -Tpng > tools/graph.png tools/graph.dot
# Finally let's bring back old Cargo.toml file
patch Cargo.toml tools/workspace.diff

10
tools/workspace.diff Normal file
View File

@ -0,0 +1,10 @@
diff --git Cargo.toml Cargo.toml
index fca51d5..6a16dd6 100644
--- Cargo.toml
+++ Cargo.toml
@@ -24,3 +24,5 @@ import = { path = "import" }
[[bin]]
path = "pbtc/main.rs"
name = "pbtc"
+
+[workspace]