Skip to content

Commit

Permalink
Avoid running build.rs every time
Browse files Browse the repository at this point in the history
  • Loading branch information
phorward committed Apr 25, 2022
1 parent c88a492 commit d5f3fab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use glob::glob;
use std::collections::HashMap;
use tokay; // This is Tokay v0.4

static PATTERN: &str = "src/**/*.rs";

fn main() {
let mut res: HashMap<String, String> = HashMap::new();

Expand All @@ -19,7 +21,7 @@ fn main() {
// This is some little, naive attempt to run the build.tok script on all .rs-source files
// and obtain the module path from the src/-file- and folder-structure. It surely can be done
// better, but suffices the current requirements.
for entry in glob("src/**/*.rs").expect("Failed to read glob pattern") {
for entry in glob(PATTERN).expect("Failed to read glob pattern") {
match entry {
Ok(path) => {
match program.run_from_string(
Expand All @@ -28,6 +30,7 @@ fn main() {
) {
Ok(None) => {}
Ok(Some(matches)) => {
println!("cargo:rerun-if-changed={}", path.display());
//let path = path.into_iter().map(|part| part.to_str().unwrap().to_string()).collect::<Vec<String>>();

// Generate result entries from all matches of build.tok
Expand Down

0 comments on commit d5f3fab

Please sign in to comment.