-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to create files outside of _build #21
Comments
¹: I think it is better to create in the build dir and then link than to create in |
I set
|
Trying your suggestion to define a "project files" rule, I have this: $ cat myocamlbuild.ml
open Ocamlbuild_plugin
let () = dispatch (function
| After_rules -> (
rule ".merlin"
~prod:".merlin"
(fun env _ -> Echo (["S ./src/**"], ".merlin"))
;
rule "project files"
~stamp:"project_files.stamp"
(fun _ build ->
let project_files = [[".merlin"]] in
List.map Outcome.good (build project_files) |>
List.map (fun result ->
Cmd (S [A "ln"; A "-sf";
P (!Options.build_dir/result);
P Pathname.pwd] )
) |>
fun l -> Seq l
)
)
| _ -> ()
) The "project files" rule has no |
Building in _build is of course good; it should be the default but I shouldn't be disallowed from creating a file elsewhere. Your suggestion to link files is a hack because the link isn't a first class entity of the build DAG. A better solution would be: relative paths should by default be assumed to be relative to _build, but it should be possible to give |
I still don't know how to invoke the "project rules" rule, so I thought a workaround is to do |
I thought I had answered already, sorry. Just request the stamp as target: (Yes, automatic linking is kind of flaky right now, and I'm not sure exactly how to specify it and whether making it more uniform is a good idea.) |
Thanks. I thought I had tried that, but must have done something wrong. This works. Another thing I noticed is that one cannot create the symlink and git commit it because ocamlbuild deletes the symlink! |
I'm writing a rule like this:
which produces the file
_build/.merlin
, but we want.merlin
in the root of our repo. I tried usingPathname.pwd
but that doesn't seem to help. I'm also not usingenv
, but AFAICT that only expands variable names so it isn't relevant.(I realize my issues are questions, but hopefully they suggest documentation improvements so are relevant to this repo.)
The text was updated successfully, but these errors were encountered: