Specify rerun-if-changed files manually

This commit is contained in:
Ryan 2022-04-19 23:45:34 -07:00
parent f5f8264a70
commit 6be10bba5a

View file

@ -1,20 +1,10 @@
use std::fs;
use anyhow::Context;
use proc_macro2::{Ident, Span}; use proc_macro2::{Ident, Span};
mod block; mod block;
pub fn main() -> anyhow::Result<()> { pub fn main() -> anyhow::Result<()> {
// If any of the files in the data directory are modified, rerun the build for file in ["blocks.json"] {
// script. println!("cargo:rerun-if-changed=data/{file}");
for entry in fs::read_dir("data")? {
let entry = entry?;
if entry.metadata()?.is_file() {
let buf = entry.path();
let path = buf.to_str().context("bad file name")?;
println!("cargo:rerun-if-changed={path}");
}
} }
block::build()?; block::build()?;