Is dune just for building targets, or can I also make it organize build output?

Echoing what @sim642 mentioned, you can use copy_files or copy actions, or in the worst case, just shell out to bash (assuming you don’t care much about supporting non-unix environments (who uses them anyway? :wink: )). For example, I’m not sure if this was the most elegant way, but I was able to use dune to setup a website generator that performed some fairly complex re-arrangment of the source directory using the following build rules:

(rule
 (alias all)
 (deps (sandbox always) (glob_files_rec static/*) (glob_files_rec data/*) favicon.ico)
 (targets (dir web))
 (action
  (progn
   (bash "mkdir web")
   (bash "cp favicon.ico web/")
   (bash "cp -lR ./static/ ./web/static/")
   (run ./src/generator/generator.exe "./data" "./web")
)))
2 Likes