Rerun build script only when necessary

This commit is contained in:
cyqsimon 2023-11-02 23:59:20 +08:00
parent 9f7d70f642
commit 7cfd1e0d78
No known key found for this signature in database
GPG Key ID: 1D8CE2F297390D65

View File

@ -199,6 +199,8 @@ fn read_all_mappings() -> anyhow::Result<MappingList> {
/// Build the static syntax mappings defined in /src/syntax_mapping/builtins/
/// into a .rs source file, which is to be inserted with `include!`.
pub fn build_static_mappings() -> anyhow::Result<()> {
println!("cargo:rerun-if-changed=src/syntax_mapping/builtins/");
let mappings = read_all_mappings()?;
let codegen_path = Path::new(&env::var_os("OUT_DIR").ok_or(anyhow!("OUT_DIR is unset"))?)