Closed safinaskar closed 3 months ago
To regenerate all action files, I think we can use force(true)
in rustemo_compiler::Settings
. For example, in build.rs
, use the following code:
fn main() {
rustemo_compiler::Settings::new()
.force(true)
.process_dir()
.unwrap();
}
This should solve the problem mentioned in the post.
@fogarecious , yes, but anyway I think current behavior is a bug. force(true)
should be ~applied~ implied. rm -r target
should never be needed
I agree. This should be treated as a bug as the product of parser compilation should not depend on what is already in the target folder. Until the bugfix is released @fogarecious workaround can be used.
Reproduction Create these files in some test dir:
Cargo.toml
:build.rs
:src/a.rustemo
:src/main.rs
:Make sure nothing else exists in the dir. In particular, make sure there is no
target
dir.Now run
cargo build
. Everything will build successfully (modulo some warnings). Then replace allfoo
s withbar
s insrc/a.rustemo
, i. e. you should get this:Now, without removing
target
, runcargo build
. You will see this error message (I ommited warnings):Now remove
target
and runcargo build
again. Everything will be built successfully.So, we see that
rm -r target
is needed to build project. This never should be necessary.I thing the reason is so: rustemo doesn't regenerate
a_actions.rs
(despitea_actions.rs
is located intarget
). I think this is wrong, because this behavior necessitates using ofrm -r target
. So, if*_actions.rs
is located intarget
, then always regenerate it