Skip to content

Commit

Permalink
Fix build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Aloso committed Nov 4, 2020
1 parent 174be0c commit b0b7c6d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use std::env;
use std::process::Command;

fn main() {
// Tell Cargo that if the given file changes, to rerun this build script.
println!("cargo:rerun-if-changed=Cargo.lock");

let output = Command::new("cargo")
.args(&["tree", "--quiet", "--color", "never"])
.output()
Expand All @@ -18,5 +16,7 @@ fn main() {
.collect();
let deps = deps.trim_end();

std::fs::write("./dependencies.txt", deps).expect("could not write to file `dependencies.txt`");
let mut path = env::var("OUT_DIR").unwrap();
path.push_str("/dependencies.txt");
std::fs::write(&path, deps).expect("could not write to file `dependencies.txt`");
}
2 changes: 1 addition & 1 deletion src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub const APP_NAME: &str = env!("CARGO_PKG_NAME");
pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION");

/// The dependency tree, generated by the build script
pub const DEPENDENCIES: &str = include_str!("../../dependencies.txt");
pub const DEPENDENCIES: &str = include_str!(concat!(env!("OUT_DIR"), "/dependencies.txt"));

/// Color spaces, as they can be provided in the command line
const COLOR_FORMATS: &[&str] = &[
Expand Down

0 comments on commit b0b7c6d

Please sign in to comment.