From 8d4e004a78a4db9e72fac3832bedd5d0b2fa1e91 Mon Sep 17 00:00:00 2001 From: debris Date: Tue, 8 Nov 2016 17:01:15 +0100 Subject: [PATCH] make tools/draw_graph.sh work again --- Cargo.toml | 2 ++ tools/draw_graph.sh | 16 ++++++++++++++-- tools/workspace.diff | 10 ++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 tools/workspace.diff diff --git a/Cargo.toml b/Cargo.toml index fca51d55..6a16dd68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,3 +24,5 @@ import = { path = "import" } [[bin]] path = "pbtc/main.rs" name = "pbtc" + +[workspace] diff --git a/tools/draw_graph.sh b/tools/draw_graph.sh index 27ea7a59..ab356836 100755 --- a/tools/draw_graph.sh +++ b/tools/draw_graph.sh @@ -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 diff --git a/tools/workspace.diff b/tools/workspace.diff new file mode 100644 index 00000000..4d73c314 --- /dev/null +++ b/tools/workspace.diff @@ -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]