-
-
Save pczarn/19ee08f2995f2b84231d to your computer and use it in GitHub Desktop.
Rust: dependency graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io; | |
fn main() { | |
println!("digraph {{"); | |
let mut input = io::stdin(); | |
let mut lines = input.lines(); | |
loop { | |
match lines.next() { | |
Some(line) => { | |
let line = line.unwrap(); | |
let line = line.as_slice(); | |
if !line.starts_with("DEPS_") { continue } | |
let mut parts = line.as_slice().words(); | |
let name = parts.next().unwrap(); | |
let name = name.slice_from(5); | |
let _ign = parts.next(); | |
for dep in parts { | |
if dep.starts_with("native:") { continue } | |
if dep == "\\" { | |
let newline = lines.next().unwrap().unwrap(); | |
for word in newline.as_slice().words() { | |
if word.starts_with("native:") { continue } | |
println!(" {} -> {};", name, word); | |
} | |
} else { | |
println!(" {} -> {};", name, dep); | |
} | |
} | |
} | |
None => break | |
} | |
} | |
println!("}}"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat rust/mk/crates.mk | ./deps | dot -Tpdf > deps.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment