Skip to content

Commit b0b7c6d

Browse files
committed
Fix build script
1 parent 174be0c commit b0b7c6d

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1+
use std::env;
12
use std::process::Command;
23

34
fn main() {
4-
// Tell Cargo that if the given file changes, to rerun this build script.
5-
println!("cargo:rerun-if-changed=Cargo.lock");
6-
75
let output = Command::new("cargo")
86
.args(&["tree", "--quiet", "--color", "never"])
97
.output()
@@ -18,5 +16,7 @@ fn main() {
1816
.collect();
1917
let deps = deps.trim_end();
2018

21-
std::fs::write("./dependencies.txt", deps).expect("could not write to file `dependencies.txt`");
19+
let mut path = env::var("OUT_DIR").unwrap();
20+
path.push_str("/dependencies.txt");
21+
std::fs::write(&path, deps).expect("could not write to file `dependencies.txt`");
2222
}

src/cli/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub const APP_NAME: &str = env!("CARGO_PKG_NAME");
2020
pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
2121

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

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

0 commit comments

Comments
 (0)