Skip to content

Commit

Permalink
Use CodegenFileSystem to ensure binding rules are recompiled
Browse files Browse the repository at this point in the history
  • Loading branch information
ggiraldez committed Jul 24, 2024
1 parent 8e7c917 commit 8f4abc6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/codegen/runtime/generator/src/bindings/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use codegen_language_definition::model;
use infra_utils::codegen::CodegenFileSystem;
use infra_utils::paths::PathExtensions;
use serde::Serialize;

Expand All @@ -10,11 +11,10 @@ pub struct BindingsModel {

impl BindingsModel {
pub fn from_language(language: &model::Language) -> Result<Self> {
let binding_rules_source = language.binding_rules_file.read_to_string()?;
println!(
"cargo:rerun-if-changed={}",
language.binding_rules_file.to_string_lossy()
);
// We use `CodegenFileSystem` here to ensure the rules are rebuilt if the rules file changes
let binding_rules_dir = language.binding_rules_file.unwrap_parent();
let mut fs = CodegenFileSystem::new(binding_rules_dir)?;
let binding_rules_source = fs.read_file(&language.binding_rules_file)?;

Ok(Self {
binding_rules_source,
Expand Down

0 comments on commit 8f4abc6

Please sign in to comment.