2 years ago
#136257

David 天宇 Wong
Using dune in OCaml, does promote overwrite manual changes?
The nice thing about Rust and generated code, is that it can live in the target directory and rust-analyzer makes it easy to go and see what's there. But in OCaml, with dune, if I have a rule to generate some code, for example:
(rule
(target kimchi.ml)
(deps
Cargo.toml
rust-toolchain.toml
../../../../.ocamlformat
(source_tree src)
(source_tree binding_generation)
(source_tree ../../proof-systems))
(action
(chdir
binding_generation
(progn
(run rm -rf ./target)
(run rm -f ./Cargo.lock)
(run cargo run ../kimchi.ml)
(run ocamlformat --impl -i ../kimchi.ml)))))
The file it generates seems to be inaccessible from ocaml-lsp in vscode without knowing the exact path. So what I can do is add:
(mode promote)
but now, I run the risk of manually overwriting a generated file. Does building overwrites my manual changes again?
ocaml
dune
0 Answers
Your Answer